Previous 199869 Revisions Next

r34899 Friday 6th February, 2015 at 22:29:14 UTC by Angelo Salese
Merge branch 'master' of https://github.com/mamedev/mame
[/trunk]makefile
[src/build]flags_clang.mak flags_gcc.mak
[src/emu]addrmap.h schedule.c
[src/emu/bus/abckb]abc99.c
[src/emu/bus/pc_kbd]ec1841.c iskr1030.c pcat84.c pcxt83.c
[src/emu/cpu/i386]i386.h x87ops.inc
[src/lib/formats]flex_dsk.c flex_dsk.h kaypro_dsk.c kaypro_dsk.h pc98_dsk.c trd_dsk.c trd_dsk.h
[src/mame]mame.lst
[src/mame/drivers]d9final.c gunsmoke.c megadrvb.c naomi.c peplus.c segas16b.c sidearms.c silvmil.c toki.c
[src/mame/includes]toki.h
[src/mame/machine]315-5838_317-0229_comp.c 315-5881_crypt.c 315_5296.c
[src/mess/drivers]atm.c hx20.c indiana.c kaypro.c pc9801.c pentagon.c pt68k4.c scorpion.c ti74.c ticalc1x.c
[src/mess/includes]kaypro.h
[src/mess/machine]apollo.c beta.c beta.h kaypro.c pc1512kb.c victor9kb.c wangpckb.c
[src/mess/tools/imgtool/modules]ti990hd.c
[src/osd/modules/sound]direct_sound.c
[src/osd/sdl]draw13.c drawbgfx.c drawogl.c drawsdl.c input.c input.h video.c window.c window.h
[src/osd/windows]d3dhlsl.c drawbgfx.c drawd3d.c drawd3d.h drawdd.c drawgdi.c drawnone.c window.c window.h
[src/tools]chdman.c

trunk/makefile
r243410r243411
281281# uncomment to enable OpenMP optimized code
282282# OPENMP = 1
283283
284# uncomment to compile c++ code as C++11
285# CPP11 = 1
286
284287# specify optimization level or leave commented to use the default
285288# (default is OPTIMIZE = 3 normally, or OPTIMIZE = 0 with symbols)
286289# OPTIMIZE = 3
r243410r243411
525528# we compile C-only to C89 standard with GNU extensions
526529# we compile C++ code to C++98 standard with GNU extensions
527530CONLYFLAGS += -std=gnu89
531ifdef CPP11
532CPPONLYFLAGS += -x c++ -std=gnu++11
533else
528534CPPONLYFLAGS += -x c++ -std=gnu++98
535endif
529536COBJFLAGS += -x objective-c++
530537
531538# this speeds it up a bit by piping between the preprocessor/compiler/assembler
trunk/src/build/flags_clang.mak
r243410r243411
11CCOMFLAGS += \
22   -Wno-cast-align \
3   -Wno-tautological-compare \
4   -Wno-format-security
3   -Wno-tautological-compare
54
65# caused by obj/sdl64d/emu/cpu/tms57002/tms57002.inc
76CCOMFLAGS += -Wno-self-assign-field
87
9# caused by src/mame/video/jagblit.inc on older clang versions
10CCOMFLAGS += -Wno-constant-logical-operand
8# caused by popmessage(NULL) on older clang versions
9#CCOMFLAGS += -Wno-format-security
1110
1211ifneq (,$(findstring undefined,$(SANITIZE)))
1312# TODO: check if linker is clang++
r243410r243411
2120CCOMFLAGS += -fsanitize-memory-track-origins -fPIE
2221endif
2322
23ifdef CPP11
24CCOMFLAGS += -Wno-deprecated-register -Wno-c++11-narrowing
25endif
26
2427# TODO: needs to use $(CC)
2528TEST_CLANG := $(shell clang --version)
2629
2730ifeq ($(findstring 3.4,$(TEST_CLANG)),3.4)
2831CCOMFLAGS += -Wno-inline-new-delete
32
33# caused by src/mame/video/jagblit.inc
34CCOMFLAGS += -Wno-constant-logical-operand
2935endif
3036
3137ifeq ($(findstring 3.5,$(TEST_CLANG)),3.5)
3238CCOMFLAGS += -Wno-inline-new-delete
33# caused by src/mess/drivers/x07.c, src/osd/sdl/window.c, src/emu/sound/disc_mth.inc
39
40# caused by src/mess/drivers/x07.c, src/osd/sdl/window.c, src/emu/sound/disc_mth.inc, src/mame/video/chihiro.c
3441CCOMFLAGS += -Wno-absolute-value
35# these were disabled because of bugs in older clang versions
36CCOMFLAGS += -Wformat-security -Wconstant-logical-operand
37# these show up when compiling as c++11
38CCOMFLAGS += -Wno-deprecated-register -Wno-reserved-user-defined-literal -Wno-c++11-narrowing
42
3943# TODO: add proper detection of XCode 6.0.1
4044# XCode 6.0.1 is built on a pre-release SVN version of clang 3.5, that doesn't support -Wno-absolute-value yet
4145CCOMFLAGS += -Wno-unknown-warning-option
r243410r243411
5660endif
5761endif
5862
63ifeq ($(findstring 3.6,$(TEST_CLANG)),3.6)
64CCOMFLAGS += -Wno-inline-new-delete
65
66# caused by src/mess/drivers/x07.c, src/osd/sdl/window.c, src/emu/sound/disc_mth.inc, src/mame/video/chihiro.c
67CCOMFLAGS += -Wno-absolute-value
68endif
69
5970ifeq ($(TARGETOS),emscripten)
6071CCOMFLAGS += -Qunused-arguments
6172endif
trunk/src/build/flags_gcc.mak
r243410r243411
66endif
77
88ifeq ($(findstring 4.8.,$(TEST_GCC)),4.8.)
9   CCOMFLAGS += -Wno-narrowing -Wno-attributes -Wno-unused-local-typedefs
9   CCOMFLAGS += -Wno-narrowing -Wno-attributes
1010   # array bounds checking seems to be buggy in 4.8.1 (try it on video/stvvdp1.c and video/model1.c without -Wno-array-bounds)
1111   CCOMFLAGS += -Wno-unused-variable -Wno-array-bounds
1212endif
1313
1414ifeq ($(findstring 4.9.,$(TEST_GCC)),4.9.)
15   CCOMFLAGS += -Wno-narrowing -Wno-attributes -Wno-unused-local-typedefs
15   CCOMFLAGS += -Wno-narrowing -Wno-attributes
1616   CCOMFLAGS += -Wno-array-bounds
1717endif
1818
trunk/src/emu/addrmap.h
r243410r243411
305305#define ADDRESS_MAP_START(_name, _space, _bits, _class) \
306306void ADDRESS_MAP_NAME(_name)(address_map &map, device_t &device) \
307307{ \
308   typedef read##_bits##_delegate read_delegate; \
309   typedef write##_bits##_delegate write_delegate; \
308   typedef read##_bits##_delegate read_delegate ATTR_UNUSED; \
309   typedef write##_bits##_delegate write_delegate ATTR_UNUSED; \
310310   address_map_entry##_bits *curentry = NULL; \
311311   (void)curentry; \
312312   map.configure(_space, _bits); \
313   typedef _class drivdata_class;
313   typedef _class drivdata_class ATTR_UNUSED;
314314#define DEVICE_ADDRESS_MAP_START(_name, _bits, _class) \
315315void _class :: _name(::address_map &map, device_t &device) \
316316{ \
317   typedef read##_bits##_delegate read_delegate; \
318   typedef write##_bits##_delegate write_delegate; \
317   typedef read##_bits##_delegate read_delegate ATTR_UNUSED; \
318   typedef write##_bits##_delegate write_delegate ATTR_UNUSED; \
319319   address_map_entry##_bits *curentry = NULL; \
320320   (void)curentry; \
321321   map.configure(AS_PROGRAM, _bits);  \
322   typedef _class drivdata_class;
322   typedef _class drivdata_class ATTR_UNUSED;
323323#define ADDRESS_MAP_END \
324324}
325325
trunk/src/emu/bus/abckb/abc99.c
r243410r243411
302302   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Keypad 2") PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD))
303303   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED )
304304   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED )
305   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("|"UTF8_LEFT) PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_MAMEKEY(RALT))
305   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("|" UTF8_LEFT) PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_MAMEKEY(RALT))
306306
307307   PORT_START("X9")
308308   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED )
trunk/src/emu/bus/pc_kbd/ec1841.c
r243410r243411
126126   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D')
127127   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C')
128128   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RCONTROL) // 0x5a = R/L (R)
129   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 8 "UTF8_UP) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD))
129   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 8 " UTF8_UP) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD))
130130   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
131131   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
132132
r243410r243411
146146   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G')
147147   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B')
148148   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1))
149   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 4 "UTF8_LEFT) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD))
149   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 4 " UTF8_LEFT) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD))
150150   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
151151   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
152152
r243410r243411
166166   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J')
167167   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M')
168168   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3))
169   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 6 "UTF8_RIGHT) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD))
169   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 6 " UTF8_RIGHT) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD))
170170   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
171171   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
172172
r243410r243411
186186   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L')
187187   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?2a?")
188188   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5))
189   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 2 "UTF8_DOWN) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD))
189   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 2 " UTF8_DOWN) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD))
190190   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
191191   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
192192
trunk/src/emu/bus/pc_kbd/iskr1030.c
r243410r243411
124124   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D')
125125   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C')
126126   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RCONTROL) // 0x5a = R/L (R)
127   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 8 "UTF8_UP) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD))
127   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 8 " UTF8_UP) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD))
128128   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
129129   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
130130
r243410r243411
144144   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G')
145145   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B')
146146   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1))
147   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 4 "UTF8_LEFT) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD))
147   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 4 " UTF8_LEFT) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD))
148148   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
149149   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
150150
r243410r243411
164164   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J')
165165   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M')
166166   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3))
167   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 6 "UTF8_RIGHT) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD))
167   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 6 " UTF8_RIGHT) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD))
168168   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
169169   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
170170
r243410r243411
184184   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L')
185185   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?2a?")
186186   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5))
187   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 2 "UTF8_DOWN) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD))
187   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 2 " UTF8_DOWN) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD))
188188   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
189189   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
190190
trunk/src/emu/bus/pc_kbd/pcat84.c
r243410r243411
274274   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
275275   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 1 End") PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD))
276276   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
277   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 4 "UTF8_LEFT) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD))
277   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 4 " UTF8_LEFT) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD))
278278   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 7 Home") PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD))
279279   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED )
280280   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
r243410r243411
283283   PORT_START("DR14")
284284   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 0 Ins") PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD))
285285   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad . Del") PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD))
286   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 2 "UTF8_DOWN) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD))
286   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 2 " UTF8_DOWN) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD))
287287   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD))
288   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 6 "UTF8_RIGHT) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD))
289   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 8 "UTF8_UP) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD))
288   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 6 " UTF8_RIGHT) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD))
289   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 8 " UTF8_UP) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD))
290290   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC))
291291   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_NUMLOCK) PORT_CHAR(UCHAR_MAMEKEY(NUMLOCK))
292292
trunk/src/emu/bus/pc_kbd/pcxt83.c
r243410r243411
113113   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
114114   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD))
115115   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 3 PgDn") PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD))
116   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 6 "UTF8_RIGHT) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD))
116   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 6 " UTF8_RIGHT) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD))
117117   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD))
118118   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 9 PgUp") PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD))
119119   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
r243410r243411
121121
122122   PORT_START("MD01")
123123   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad . Del") PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD))
124   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 2 "UTF8_DOWN) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD))
124   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 2 " UTF8_DOWN) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD))
125125   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 1 End") PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD))
126126   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD))
127   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 4 "UTF8_LEFT) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD))
127   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 4 " UTF8_LEFT) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD))
128128   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 7 Home") PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD))
129   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 8 "UTF8_UP) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD))
129   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 8 " UTF8_UP) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD))
130130   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_NUMLOCK) PORT_CHAR(UCHAR_MAMEKEY(NUMLOCK))
131131
132132   PORT_START("MD02")
trunk/src/emu/cpu/i386/i386.h
r243410r243411
11871187   void x87_fxtract(UINT8 modrm);
11881188   void x87_ftst(UINT8 modrm);
11891189   void x87_fxam(UINT8 modrm);
1190   void x87_fcmovb_sti(UINT8 modrm);
1191   void x87_fcmove_sti(UINT8 modrm);
1192   void x87_fcmovbe_sti(UINT8 modrm);
1193   void x87_fcmovu_sti(UINT8 modrm);
1194   void x87_fcmovnb_sti(UINT8 modrm);
1195   void x87_fcmovne_sti(UINT8 modrm);
1196   void x87_fcmovnbe_sti(UINT8 modrm);
1197   void x87_fcmovnu_sti(UINT8 modrm);
11901198   void x87_ficom_m16int(UINT8 modrm);
11911199   void x87_ficom_m32int(UINT8 modrm);
11921200   void x87_ficomp_m16int(UINT8 modrm);
r243410r243411
11971205   void x87_fcomp_m32real(UINT8 modrm);
11981206   void x87_fcomp_m64real(UINT8 modrm);
11991207   void x87_fcomp_sti(UINT8 modrm);
1208   void x87_fcomi_sti(UINT8 modrm);
12001209   void x87_fcomip_sti(UINT8 modrm);
1210   void x87_fucomi_sti(UINT8 modrm);
1211   void x87_fucomip_sti(UINT8 modrm);
12011212   void x87_fcompp(UINT8 modrm);
12021213   void x87_fucom_sti(UINT8 modrm);
12031214   void x87_fucomp_sti(UINT8 modrm);
trunk/src/emu/cpu/i386/x87ops.inc
r243410r243411
115115
116116extern flag floatx80_is_nan( floatx80 a );
117117
118extern flag floatx80_is_signaling_nan(floatx80 a);
119
120INLINE flag floatx80_is_quiet_nan(floatx80 a)
121{
122   bits64 aLow;
123
124   aLow = a.low & ~LIT64(0x4000000000000000);
125   return
126      ((a.high & 0x7FFF) == 0x7FFF)
127      && (bits64)(aLow << 1)
128      && (a.low != aLow);
129}
130
118131INLINE int floatx80_is_zero(floatx80 fx)
119132{
120133   return (((fx.high & 0x7fff) == 0) && ((fx.low << 1) == 0));
r243410r243411
19571970   CYCLES(22);
19581971}
19591972
1973/*************************************
1974*
1975* Conditional Move
1976*
1977*************************************/
19601978
1979void i386_device::x87_fcmovb_sti(UINT8 modrm)
1980{
1981   floatx80 result;
1982   int i = modrm & 7;
1983
1984   if (m_CF == 1)
1985   {
1986      if (X87_IS_ST_EMPTY(i))
1987      {
1988         x87_set_stack_underflow();
1989         result = fx80_inan;
1990      }
1991      else
1992         result = ST(i);
1993
1994      if (x87_check_exceptions())
1995      {
1996         ST(0) = result;
1997      }
1998   }
1999
2000   CYCLES(4);
2001}
2002
2003void i386_device::x87_fcmove_sti(UINT8 modrm)
2004{
2005   floatx80 result;
2006   int i = modrm & 7;
2007
2008   if (m_ZF == 1)
2009   {
2010      if (X87_IS_ST_EMPTY(i))
2011      {
2012         x87_set_stack_underflow();
2013         result = fx80_inan;
2014      }
2015      else
2016         result = ST(i);
2017
2018      if (x87_check_exceptions())
2019      {
2020         ST(0) = result;
2021      }
2022   }
2023
2024   CYCLES(4);
2025}
2026
2027void i386_device::x87_fcmovbe_sti(UINT8 modrm)
2028{
2029   floatx80 result;
2030   int i = modrm & 7;
2031
2032   if ((m_CF | m_ZF) == 1)
2033   {
2034      if (X87_IS_ST_EMPTY(i))
2035      {
2036         x87_set_stack_underflow();
2037         result = fx80_inan;
2038      }
2039      else
2040         result = ST(i);
2041
2042      if (x87_check_exceptions())
2043      {
2044         ST(0) = result;
2045      }
2046   }
2047
2048   CYCLES(4);
2049}
2050
2051void i386_device::x87_fcmovu_sti(UINT8 modrm)
2052{
2053   floatx80 result;
2054   int i = modrm & 7;
2055
2056   if (m_PF == 1)
2057   {
2058      if (X87_IS_ST_EMPTY(i))
2059      {
2060         x87_set_stack_underflow();
2061         result = fx80_inan;
2062      }
2063      else
2064         result = ST(i);
2065
2066      if (x87_check_exceptions())
2067      {
2068         ST(0) = result;
2069      }
2070   }
2071
2072   CYCLES(4);
2073}
2074
2075void i386_device::x87_fcmovnb_sti(UINT8 modrm)
2076{
2077   floatx80 result;
2078   int i = modrm & 7;
2079
2080   if (m_CF == 0)
2081   {
2082      if (X87_IS_ST_EMPTY(i))
2083      {
2084         x87_set_stack_underflow();
2085         result = fx80_inan;
2086      }
2087      else
2088         result = ST(i);
2089
2090      if (x87_check_exceptions())
2091      {
2092         ST(0) = result;
2093      }
2094   }
2095
2096   CYCLES(4);
2097}
2098
2099void i386_device::x87_fcmovne_sti(UINT8 modrm)
2100{
2101   floatx80 result;
2102   int i = modrm & 7;
2103
2104   if (m_ZF == 0)
2105   {
2106      if (X87_IS_ST_EMPTY(i))
2107      {
2108         x87_set_stack_underflow();
2109         result = fx80_inan;
2110      }
2111      else
2112         result = ST(i);
2113
2114      if (x87_check_exceptions())
2115      {
2116         ST(0) = result;
2117      }
2118   }
2119
2120   CYCLES(4);
2121}
2122
2123void i386_device::x87_fcmovnbe_sti(UINT8 modrm)
2124{
2125   floatx80 result;
2126   int i = modrm & 7;
2127
2128   if ((m_CF == 0) && (m_ZF == 0))
2129   {
2130      if (X87_IS_ST_EMPTY(i))
2131      {
2132         x87_set_stack_underflow();
2133         result = fx80_inan;
2134      }
2135      else
2136         result = ST(i);
2137
2138      if (x87_check_exceptions())
2139      {
2140         ST(0) = result;
2141      }
2142   }
2143
2144   CYCLES(4);
2145}
2146
2147void i386_device::x87_fcmovnu_sti(UINT8 modrm)
2148{
2149   floatx80 result;
2150   int i = modrm & 7;
2151
2152   if (m_PF == 0)
2153   {
2154      if (X87_IS_ST_EMPTY(i))
2155      {
2156         x87_set_stack_underflow();
2157         result = fx80_inan;
2158      }
2159      else
2160         result = ST(i);
2161
2162      if (x87_check_exceptions())
2163      {
2164         ST(0) = result;
2165      }
2166   }
2167
2168   CYCLES(4);
2169}
2170
19612171/*************************************
19622172 *
19632173 * Miscellaneous arithmetic
r243410r243411
37643974   CYCLES(4);
37653975}
37663976
3977void i386_device::x87_fcomi_sti(UINT8 modrm)
3978{
3979   int i = modrm & 7;
3980
3981   if (X87_IS_ST_EMPTY(0) || X87_IS_ST_EMPTY(i))
3982   {
3983      x87_set_stack_underflow();
3984      m_ZF = 1;
3985      m_PF = 1;
3986      m_CF = 1;
3987   }
3988   else
3989   {
3990      m_x87_sw &= ~X87_SW_C1;
3991
3992      floatx80 a = ST(0);
3993      floatx80 b = ST(i);
3994
3995      if (floatx80_is_nan(a) || floatx80_is_nan(b))
3996      {
3997         m_ZF = 1;
3998         m_PF = 1;
3999         m_CF = 1;
4000         m_x87_sw |= X87_SW_IE;
4001      }
4002      else
4003      {
4004         m_ZF = 0;
4005         m_PF = 0;
4006         m_CF = 0;
4007
4008         if (floatx80_eq(a, b))
4009            m_ZF = 1;
4010
4011         if (floatx80_lt(a, b))
4012            m_CF = 1;
4013      }
4014   }
4015
4016   x87_check_exceptions();
4017
4018   CYCLES(4); // TODO: correct cycle count
4019}
4020
37674021void i386_device::x87_fcomip_sti(UINT8 modrm)
37684022{
37694023   int i = modrm & 7;
r243410r243411
38094063   CYCLES(4); // TODO: correct cycle count
38104064}
38114065
4066void i386_device::x87_fucomi_sti(UINT8 modrm)
4067{
4068   int i = modrm & 7;
4069
4070   if (X87_IS_ST_EMPTY(0) || X87_IS_ST_EMPTY(i))
4071   {
4072      x87_set_stack_underflow();
4073      m_ZF = 1;
4074      m_PF = 1;
4075      m_CF = 1;
4076   }
4077   else
4078   {
4079      m_x87_sw &= ~X87_SW_C1;
4080
4081      floatx80 a = ST(0);
4082      floatx80 b = ST(i);
4083
4084      if (floatx80_is_quiet_nan(a) || floatx80_is_quiet_nan(b))
4085      {
4086         m_ZF = 1;
4087         m_PF = 1;
4088         m_CF = 1;
4089      }
4090      else if (floatx80_is_nan(a) || floatx80_is_nan(b))
4091      {
4092         m_ZF = 1;
4093         m_PF = 1;
4094         m_CF = 1;
4095         m_x87_sw |= X87_SW_IE;
4096      }
4097      else
4098      {
4099         m_ZF = 0;
4100         m_PF = 0;
4101         m_CF = 0;
4102
4103         if (floatx80_eq(a, b))
4104            m_ZF = 1;
4105
4106         if (floatx80_lt(a, b))
4107            m_CF = 1;
4108      }
4109   }
4110
4111   x87_check_exceptions();
4112
4113   CYCLES(4); // TODO: correct cycle count
4114}
4115
4116void i386_device::x87_fucomip_sti(UINT8 modrm)
4117{
4118   int i = modrm & 7;
4119
4120   if (X87_IS_ST_EMPTY(0) || X87_IS_ST_EMPTY(i))
4121   {
4122      x87_set_stack_underflow();
4123      m_ZF = 1;
4124      m_PF = 1;
4125      m_CF = 1;
4126   }
4127   else
4128   {
4129      m_x87_sw &= ~X87_SW_C1;
4130
4131      floatx80 a = ST(0);
4132      floatx80 b = ST(i);
4133
4134      if (floatx80_is_quiet_nan(a) || floatx80_is_quiet_nan(b))
4135      {
4136         m_ZF = 1;
4137         m_PF = 1;
4138         m_CF = 1;
4139      }
4140      else if (floatx80_is_nan(a) || floatx80_is_nan(b))
4141      {
4142         m_ZF = 1;
4143         m_PF = 1;
4144         m_CF = 1;
4145         m_x87_sw |= X87_SW_IE;
4146      }
4147      else
4148      {
4149         m_ZF = 0;
4150         m_PF = 0;
4151         m_CF = 0;
4152
4153         if (floatx80_eq(a, b))
4154            m_ZF = 1;
4155
4156         if (floatx80_lt(a, b))
4157            m_CF = 1;
4158      }
4159   }
4160
4161   if (x87_check_exceptions())
4162      x87_inc_stack();
4163
4164   CYCLES(4); // TODO: correct cycle count
4165}
4166
38124167void i386_device::x87_fcompp(UINT8 modrm)
38134168{
38144169   if (X87_IS_ST_EMPTY(0) || X87_IS_ST_EMPTY(1))
r243410r243411
45084863      {
45094864         switch (modrm)
45104865         {
4511            case 0xe9: ptr = &i386_device::x87_fucompp;       break;
4866         case 0xc0: case 0xc1: case 0xc2: case 0xc3: case 0xc4: case 0xc5: case 0xc6: case 0xc7: ptr = &i386_device::x87_fcmovb_sti;  break;
4867         case 0xc8: case 0xc9: case 0xca: case 0xcb: case 0xcc: case 0xcd: case 0xce: case 0xcf: ptr = &i386_device::x87_fcmove_sti;  break;
4868         case 0xd0: case 0xd1: case 0xd2: case 0xd3: case 0xd4: case 0xd5: case 0xd6: case 0xd7: ptr = &i386_device::x87_fcmovbe_sti; break;
4869         case 0xd8: case 0xd9: case 0xda: case 0xdb: case 0xdc: case 0xdd: case 0xde: case 0xdf: ptr = &i386_device::x87_fcmovu_sti;  break;
4870         case 0xe9: ptr = &i386_device::x87_fucompp;       break;
45124871         }
45134872      }
45144873
r243410r243411
45404899      {
45414900         switch (modrm)
45424901         {
4902            case 0xc0: case 0xc1: case 0xc2: case 0xc3: case 0xc4: case 0xc5: case 0xc6: case 0xc7: ptr = &i386_device::x87_fcmovnb_sti;  break;
4903            case 0xc8: case 0xc9: case 0xca: case 0xcb: case 0xcc: case 0xcd: case 0xce: case 0xcf: ptr = &i386_device::x87_fcmovne_sti;  break;
4904            case 0xd0: case 0xd1: case 0xd2: case 0xd3: case 0xd4: case 0xd5: case 0xd6: case 0xd7: ptr = &i386_device::x87_fcmovnbe_sti; break;
4905            case 0xd8: case 0xd9: case 0xda: case 0xdb: case 0xdc: case 0xdd: case 0xde: case 0xdf: ptr = &i386_device::x87_fcmovnu_sti;  break;
45434906            case 0xe0: ptr = &i386_device::x87_fnop;          break; /* FENI */
45444907            case 0xe1: ptr = &i386_device::x87_fnop;          break; /* FDISI */
45454908            case 0xe2: ptr = &i386_device::x87_fclex;         break;
45464909            case 0xe3: ptr = &i386_device::x87_finit;         break;
45474910            case 0xe4: ptr = &i386_device::x87_fnop;          break; /* FSETPM */
4911            case 0xe8: case 0xe9: case 0xea: case 0xeb: case 0xec: case 0xed: case 0xee: case 0xef: ptr = &i386_device::x87_fucomi_sti;  break;
4912            case 0xf0: case 0xf1: case 0xf2: case 0xf3: case 0xf4: case 0xf5: case 0xf6: case 0xf7: ptr = &i386_device::x87_fcomi_sti; break;
45484913         }
45494914      }
45504915
r243410r243411
46985063         switch (modrm)
46995064         {
47005065            case 0xe0: ptr = &i386_device::x87_fstsw_ax;      break;
5066            case 0xe8: case 0xe9: case 0xea: case 0xeb: case 0xec: case 0xed: case 0xee: case 0xef: ptr = &i386_device::x87_fucomip_sti;    break;
47015067            case 0xf0: case 0xf1: case 0xf2: case 0xf3: case 0xf4: case 0xf5: case 0xf6: case 0xf7: ptr = &i386_device::x87_fcomip_sti;    break;
47025068         }
47035069      }
trunk/src/emu/schedule.c
r243410r243411
460460            {
461461               // compute how many cycles we want to execute
462462               int ran = exec->m_cycles_running = divu_64x32((UINT64)delta >> exec->m_divshift, exec->m_divisor);
463               LOG(("  cpu '%s': %"I64FMT"d (%d cycles)\n", exec->device().tag(), delta, exec->m_cycles_running));
463               LOG(("  cpu '%s': %" I64FMT"d (%d cycles)\n", exec->device().tag(), delta, exec->m_cycles_running));
464464
465465               // if we're not suspended, actually execute
466466               if (exec->m_suspend == 0)
trunk/src/lib/formats/flex_dsk.c
r243410r243411
9797   return true;
9898}
9999
100// Empty since geometry is determined from the disk image itself
101const flex_format::format flex_format::formats[] = { {} };
102
100103const floppy_format_type FLOPPY_FLEX_FORMAT = &floppy_image_format_creator<flex_format>;
trunk/src/lib/formats/flex_dsk.h
r243410r243411
3737      UINT8 last_sec;
3838      UINT8 unused2[216];
3939   } info;
40   static const format formats[];
4041};
4142
4243extern const floppy_format_type FLOPPY_FLEX_FORMAT;
trunk/src/lib/formats/kaypro_dsk.c
r243410r243411
11// license:BSD-3-Clause
2// copyright-holders:Olivier Galibert
2// copyright-holders:Olivier Galibert, Robbbert
33/*********************************************************************
44
55    formats/kaypro_dsk.c
r243410r243411
99    There is no inter-sector info on these disks. It is simply a
1010    dump of the 512 bytes from each sector and track in order.
1111    It is just like a headerless quickload.
12    Base class and gaps verified by OG. Please note that these
13    disks usually have DSK extension, but that conflicts with
14    the CPCEMU DSK format. You need to rename your Kaypro DSK
15    disks to KAY extension.
1216
1317*********************************************************************/
1418
1519#include "emu.h"
1620#include "formats/kaypro_dsk.h"
1721
18kayproii_format::kayproii_format() : wd177x_format(formats)
22kayproii_format::kayproii_format() : upd765_format(formats)
1923{
2024}
2125
r243410r243411
3135
3236const char *kayproii_format::extensions() const
3337{
34   return "dsk";
38   return "kay";
3539}
3640
37// gap info is a total guess
3841const kayproii_format::format kayproii_format::formats[] = {
3942   {   /*  191K 13cm double density single sided */
4043      floppy_image::FF_525,  floppy_image::SSDD, floppy_image::MFM,
41      2000, 10, 40, 1, 512, {}, 1, {}, 32, 22, 31
44      2000, 10, 40, 1, 512, {}, 0, {}, 80, 16, 22, 26
4245   },
4346   {}
4447};
4548
46kaypro2x_format::kaypro2x_format() : wd177x_format(formats)
49kaypro2x_format::kaypro2x_format() : upd765_format(formats)
4750{
4851}
4952
r243410r243411
5962
6063const char *kaypro2x_format::extensions() const
6164{
62   return "dsk";
65   return "kay";
6366}
6467
65// gap info is a total guess
6668const kaypro2x_format::format kaypro2x_format::formats[] = {
6769   {   /*  382K 13cm double density double sided */
6870      floppy_image::FF_525,  floppy_image::DSDD, floppy_image::MFM,
69      2000, 10, 80, 2, 512, {}, 1, {}, 32, 22, 31
71      2000, 10, 40, 2, 512, {}, 0, {}, 80, 16, 22, 26
7072   },
7173   {}
7274};
trunk/src/lib/formats/kaypro_dsk.h
r243410r243411
99#ifndef KAYPRO_DSK_H_
1010#define KAYPRO_DSK_H_
1111
12#include "wd177x_dsk.h"
12#include "upd765_dsk.h"
1313
14class kayproii_format : public wd177x_format {
14class kayproii_format : public upd765_format {
1515public:
1616   kayproii_format();
1717
r243410r243411
2323   static const format formats[];
2424};
2525
26class kaypro2x_format : public wd177x_format {
26class kaypro2x_format : public upd765_format {
2727public:
2828   kaypro2x_format();
2929
trunk/src/lib/formats/pc98_dsk.c
r243410r243411
5959   },
6060   {   /* 1200K 5 1/4 inch high density */
6161      floppy_image::FF_525, floppy_image::DSHD, floppy_image::MFM,
62      1200, 15, 40, 2, 512, {}, 1, {}, 80, 50, 22, 84
62      1200, 15, 80, 2, 512, {}, 1, {}, 80, 50, 22, 84
6363   },
6464   {   /*  720K 3 1/2 inch double density */
6565      floppy_image::FF_35,  floppy_image::DSDD, floppy_image::MFM,
r243410r243411
6767   },
6868   {   /* 1200K 3 1/2 inch high density (japanese variant) - gaps unverified */
6969      floppy_image::FF_35,  floppy_image::DSHD, floppy_image::MFM,
70      1200, 15, 40, 2, 512, {}, 1, {}, 80, 50, 22, 84
70      1200, 15, 80, 2, 512, {}, 1, {}, 80, 50, 22, 84
7171   },
7272   {   /* 1440K 3 1/2 inch high density */
7373      floppy_image::FF_35,  floppy_image::DSHD, floppy_image::MFM,
trunk/src/lib/formats/trd_dsk.c
r243410r243411
66
77*********************************************************************/
88
9#include <string.h>
9#include "emu.h"
10#include "formats/trd_dsk.h"
1011
11#include "trd_dsk.h"
12#include "basicdsk.h"
12trd_format::trd_format() : wd177x_format(formats)
13{
14}
1315
14
15static FLOPPY_IDENTIFY(trd_dsk_identify)
16const char *trd_format::name() const
1617{
17   *vote = 100;
18   return FLOPPY_ERROR_SUCCESS;
18   return "trd";
1919}
2020
21static FLOPPY_CONSTRUCT(trd_dsk_construct)
21const char *trd_format::description() const
2222{
23   struct basicdsk_geometry geometry;
24   UINT8 data[1];
25   int heads;
26   int cylinders;
23   return "TRD floppy disk image";
24}
2725
28   floppy_image_read( floppy, data, 0x8e3 , 1 );
29
30   /* guess geometry of disk */
31   heads =  data[0] & 0x08 ? 1 : 2;
32   cylinders = data[0] & 0x01 ? 40 : 80;
33
34   memset(&geometry, 0, sizeof(geometry));
35   geometry.heads = heads;
36   geometry.first_sector_id = 1;
37   geometry.sector_length = 256;
38   geometry.tracks = cylinders;
39   geometry.sectors = 16;
40   return basicdsk_construct(floppy, &geometry);
26const char *trd_format::extensions() const
27{
28   return "trd";
4129}
4230
31const trd_format::format trd_format::formats[] = {
32   {   //  5"25 640K double density
33      floppy_image::FF_525,  floppy_image::DSQD, floppy_image::MFM,
34      // GAP4A - 0(!) bytes, GAP1 - 10 bytes, GAP2 - 22 bytes, GAP3 - 60 bytes, GAP4B - upto track end
35      2000,  16, 80, 2, 256, {}, 1, {}, 10, 22, 60
36   },
37   {}
38};
4339
44
45/* ----------------------------------------------------------------------- */
46
47LEGACY_FLOPPY_OPTIONS_START( trd )
48   LEGACY_FLOPPY_OPTION( trd_dsk, "trd",       "TRD floppy disk image",    trd_dsk_identify, trd_dsk_construct, NULL, NULL)
49LEGACY_FLOPPY_OPTIONS_END
40const floppy_format_type FLOPPY_TRD_FORMAT = &floppy_image_format_creator<trd_format>;
trunk/src/lib/formats/trd_dsk.h
r243410r243411
99#ifndef TRD_DSK_H
1010#define TRD_DSK_H
1111
12#include "flopimg.h"
12#include "wd177x_dsk.h"
1313
14/**************************************************************************/
14class trd_format : public wd177x_format {
15public:
16   trd_format();
1517
16LEGACY_FLOPPY_OPTIONS_EXTERN(trd);
18   virtual const char *name() const;
19   virtual const char *description() const;
20   virtual const char *extensions() const;
1721
22private:
23   static const format formats[];
24};
25
26extern const floppy_format_type FLOPPY_TRD_FORMAT;
27
1828#endif /* TRD_DSK_H */
trunk/src/mame/drivers/d9final.c
r243410r243411
77    driver by Angelo Salese & David Haywood
88
99    TODO:
10    - Don't know where the ES8712 & RTC62421b chips routes;
10    - Don't know where the ES8712 & RTC62421b chips route;
1111    - A bunch of missing port outputs;
1212    - screen disable? Start-up fading looks horrible;
1313    - Game looks IGS-esque, is there any correlation?
r243410r243411
3131public:
3232   d9final_state(const machine_config &mconfig, device_type type, const char *tag)
3333      : driver_device(mconfig, type, tag),
34      m_maincpu(*this, "maincpu"),
35      m_gfxdecode(*this, "gfxdecode"),
3436      m_lo_vram(*this, "lo_vram"),
3537      m_hi_vram(*this, "hi_vram"),
36      m_cram(*this, "cram"),
37      m_maincpu(*this, "maincpu"),
38      m_gfxdecode(*this, "gfxdecode") { }
38      m_cram(*this, "cram") { }
3939
40   required_device<cpu_device> m_maincpu;
41   required_device<gfxdecode_device> m_gfxdecode;
42   
4043   required_shared_ptr<UINT8> m_lo_vram;
4144   required_shared_ptr<UINT8> m_hi_vram;
4245   required_shared_ptr<UINT8> m_cram;
46   
4347   tilemap_t *m_sc0_tilemap;
48   
4449   DECLARE_WRITE8_MEMBER(sc0_lovram);
4550   DECLARE_WRITE8_MEMBER(sc0_hivram);
4651   DECLARE_WRITE8_MEMBER(sc0_cram);
47   DECLARE_WRITE8_MEMBER(d9final_bank_w);
52   DECLARE_WRITE8_MEMBER(bank_w);
4853   DECLARE_READ8_MEMBER(prot_latch_r);
54   
4955   TILE_GET_INFO_MEMBER(get_sc0_tile_info);
50   virtual void machine_reset();
56   
57   virtual void machine_start();
5158   virtual void video_start();
52   UINT32 screen_update_d9final(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
53   required_device<cpu_device> m_maincpu;
54   required_device<gfxdecode_device> m_gfxdecode;
59   
60   UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
5561};
5662
5763
r243410r243411
7278   m_sc0_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(d9final_state::get_sc0_tile_info),this),TILEMAP_SCAN_ROWS,8,8,64,32);
7379}
7480
75UINT32 d9final_state::screen_update_d9final(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
81UINT32 d9final_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
7682{
7783   m_sc0_tilemap->draw(screen, bitmap, cliprect, 0,0);
7884   return 0;
r243410r243411
96102   m_sc0_tilemap->mark_tile_dirty(offset);
97103}
98104
99WRITE8_MEMBER(d9final_state::d9final_bank_w)
105WRITE8_MEMBER(d9final_state::bank_w)
100106{
101   UINT8 *ROM = memregion("maincpu")->base();
102   UINT32 bankaddress;
103
104   bankaddress = 0x10000+(0x4000 * (data & 0x7));
105   membank("bank1")->set_base(&ROM[bankaddress]);
107   membank("bank1")->set_entry(data & 0x7);
106108}
107109
108110/* game checks this after three attract cycles, otherwise coin inputs stop to work. */
r243410r243411
135137   AM_RANGE(0x40, 0x41) AM_DEVWRITE("ymsnd", ym2413_device, write)
136138   AM_RANGE(0x60, 0x60) AM_READ_PORT("DSWD")
137139   AM_RANGE(0x80, 0x80) AM_READ_PORT("IN0")
138   AM_RANGE(0xa0, 0xa0) AM_READ_PORT("IN1") AM_WRITE(d9final_bank_w)
140   AM_RANGE(0xa0, 0xa0) AM_READ_PORT("IN1") AM_WRITE(bank_w)
139141   AM_RANGE(0xe0, 0xe0) AM_READ_PORT("IN2")
140142ADDRESS_MAP_END
141143
r243410r243411
277279   GFXDECODE_ENTRY( "gfx1", 0, tiles16x8_layout, 0, 16*4 )
278280GFXDECODE_END
279281
280void d9final_state::machine_reset()
282void d9final_state::machine_start()
281283{
282   UINT8 *ROM = memregion("maincpu")->base();
283
284   membank("bank1")->set_base(&ROM[0x10000]);
284   membank("bank1")->configure_entries(0, 8, memregion("maincpu")->base() + 0x10000, 0x4000);
285285}
286286
287287static MACHINE_CONFIG_START( d9final, d9final_state )
r243410r243411
298298   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
299299   MCFG_SCREEN_SIZE(512, 256)
300300   MCFG_SCREEN_VISIBLE_AREA(0, 512-1, 16, 256-16-1)
301   MCFG_SCREEN_UPDATE_DRIVER(d9final_state, screen_update_d9final)
301   MCFG_SCREEN_UPDATE_DRIVER(d9final_state, screen_update)
302302   MCFG_SCREEN_PALETTE("palette")
303303
304304   MCFG_GFXDECODE_ADD("gfxdecode", "palette", d9final)
r243410r243411
326326
327327
328328
329GAME( 1992, d9final, 0, d9final, d9final, driver_device, 0, ROT0, "Excellent System", "Dream 9 Final (v2.24)", 0 )
329GAME( 1992, d9final, 0, d9final, d9final, driver_device, 0, ROT0, "Excellent System", "Dream 9 Final (v2.24)", GAME_SUPPORTS_SAVE )
trunk/src/mame/drivers/gunsmoke.c
r243410r243411
578578
579579/* Game Drivers */
580580
581GAME( 1985, gunsmoke,   0,        gunsmoke, gunsmoke,   driver_device, 0, ROT270, "Capcom", "Gun.Smoke (World)", GAME_SUPPORTS_SAVE )
582GAME( 1985, gunsmokeb,  gunsmoke, gunsmoke, gunsmoke,   driver_device, 0, ROT270, "bootleg", "Gun.Smoke (bootleg)", GAME_SUPPORTS_SAVE ) // based on world version, warning message patched out
583GAME( 1985, gunsmokej,  gunsmoke, gunsmoke, gunsmoke,   driver_device, 0, ROT270, "Capcom", "Gun.Smoke (Japan)", GAME_SUPPORTS_SAVE )
584GAME( 1985, gunsmokeu,  gunsmoke, gunsmoke, gunsmoke,   driver_device, 0, ROT270, "Capcom (Romstar license)", "Gun.Smoke (US set 1)", GAME_SUPPORTS_SAVE )
585GAME( 1986, gunsmokeua, gunsmoke, gunsmoke, gunsmokeua, driver_device, 0, ROT270, "Capcom (Romstar license)", "Gun.Smoke (US set 2)", GAME_SUPPORTS_SAVE )
581// at 0x7E50 in the first rom is 85113 (project ident code?) and the project codename 'Gunman' both stored as ASCII.
582// Following that at (stored as raw data) is the build date in yyyymmdd format.  After that a ROM identification string(?) which I've
583// left in the comment after each set.
584
585// this information is not displayed onscreen
586
587GAME( 1985, gunsmoke,   0,        gunsmoke, gunsmoke,   driver_device, 0, ROT270, "Capcom",                   "Gun.Smoke (World, 851115)", GAME_SUPPORTS_SAVE ) // GSE_03
588GAME( 1985, gunsmokeb,  gunsmoke, gunsmoke, gunsmoke,   driver_device, 0, ROT270, "bootleg",                  "Gun.Smoke (World, 851115) (bootleg)", GAME_SUPPORTS_SAVE ) // based  on above version, warning message patched out
589GAME( 1985, gunsmokej,  gunsmoke, gunsmoke, gunsmoke,   driver_device, 0, ROT270, "Capcom",                   "Gun.Smoke (Japan, 851115)", GAME_SUPPORTS_SAVE ) // GSJ_03
590GAME( 1985, gunsmokeu,  gunsmoke, gunsmoke, gunsmoke,   driver_device, 0, ROT270, "Capcom (Romstar license)", "Gun.Smoke (US, 851115)", GAME_SUPPORTS_SAVE ) // GSR_03
591GAME( 1986, gunsmokeua, gunsmoke, gunsmoke, gunsmokeua, driver_device, 0, ROT270, "Capcom (Romstar license)", "Gun.Smoke (US, 860408)", GAME_SUPPORTS_SAVE ) // GSA_03
trunk/src/mame/drivers/megadrvb.c
r243410r243411
886886GAME( 1994, ssf2mdb,  0, megadrvb_6b,  ssf2mdb,  md_boot_state,  ssf2mdb,  ROT0, "bootleg / Capcom", "Super Street Fighter II - The New Challengers (bootleg of Japanese MegaDrive version)", 0)
887887GAME( 1993, srmdb,    0, megadrvb,     srmdb,    md_boot_state,  srmdb,    ROT0, "bootleg / Konami", "Sunset Riders (bootleg of Megadrive version)", 0)
888888GAME( 1995, topshoot, 0, md_bootleg,   topshoot, md_boot_state,  topshoot, ROT0, "Sun Mixing",       "Top Shooter", 0)
889GAME( 1993, sonic2mb, 0, megadrvb,     aladmdb,  md_boot_state,  aladmdb,  ROT0, "bootleg / Sega",   "Sonic 2 (bootleg of Megadrive version)", GAME_NOT_WORKING )
889GAME( 1993, sonic2mb, 0, megadrvb,     aladmdb,  md_boot_state,  aladmdb,  ROT0, "bootleg / Sega",   "Sonic The Hedgehog 2 (bootleg of Megadrive version)", GAME_NOT_WORKING )
trunk/src/mame/drivers/naomi.c
r243410r243411
83788378   DISK_REGION( "gdrom" )
83798379   DISK_IMAGE_READONLY( "gds-0026", 0, BAD_DUMP SHA1(253acede106b7fbf49e24458e7fda868720e9549) )
83808380
8381   ROM_REGION( 0x50, "pic", ROMREGION_ERASE)
8382   ROM_LOAD("gds-0026.rom", 0x00, 0x50, NO_DUMP) // file on GD-ROM is BFK.BIN , _NOT_ BEM.BIN which is for Initial D : Arcade Stage (Japan)
8381   ROM_REGION( 0x4000, "pic", ROMREGION_ERASEFF)
8382   //PIC16C622A (317-0345-JPN)
8383   //(sticker 253-5508-0345J)
8384   ROM_LOAD( "317-0345-jpn.pic", 0x000000, 0x004000, CRC(56e1274a) SHA1(735a6071226f3297de64bc0a38be741e87f5d023) )
83838385ROM_END
83848386
83858387
trunk/src/mame/drivers/peplus.c
r243410r243411
50145014   ROM_LOAD( "cap1004.u50", 0x0000, 0x0100, CRC(5eced808) SHA1(b40b8efa8cbc76cff7560c36939275eb360c6f11) )
50155015ROM_END
50165016
5017ROM_START( peps0090 ) /* Normal board : Gold, Silver & Bronze (PS0090) - Payout 90.19% */
5018   ROM_REGION( 0x10000, "maincpu", 0 )
5019   ROM_LOAD( "ps0090_569-a2c.u68",   0x00000, 0x10000, CRC(5a727ff0) SHA1(6eed9d85620eff751c598d56807470f8753e8dd5) ) /* 3 Coins Max / 1 Line */
5020   
5021   ROM_REGION( 0x020000, "gfx1", 0 )
5022   ROM_LOAD( "mro-cg1059.u72",   0x00000, 0x8000, CRC(96210de3) SHA1(10daa358f1fc507e9f4c788265c0acc57678fa40) ) /* Also contains graphics for Double Diamonds, use CAP1003 */
5023   ROM_LOAD( "mgo-cg1059.u73",   0x08000, 0x8000, CRC(cfb9a357) SHA1(a390bed240960efd8da6e7815a0b0d272133f20f) )
5024   ROM_LOAD( "mbo-cg1059.u74",   0x10000, 0x8000, CRC(6c159972) SHA1(b6fbebba2749534b7fcb9cd32fe17cdc673912f7) )
5025   ROM_LOAD( "mxo-cg1059.u75",   0x18000, 0x8000, CRC(7ec9d699) SHA1(45ec30370d2ef12511f897cb1155327ed4d2ce01) )
5026
5027   ROM_REGION( 0x100, "proms", 0 )
5028   ROM_LOAD( "cap1059.u50", 0x0000, 0x0100, CRC(a995258f) SHA1(5c33fb2a9a939cfdf4634f886690fa7ccc57fe52) )
5029ROM_END
5030
50175031ROM_START( peps0092 ) /* Normal board : Wild Cherry Slots (PS0092) - Payout 90.18% */
50185032   ROM_REGION( 0x10000, "maincpu", 0 )
50195033   ROM_LOAD( "ps0092_569-a2c.u68",   0x00000, 0x10000, CRC(d533f6d5) SHA1(9c470f7c474022445aeb45ee8c5757d1b6957a91) ) /* 3 Coins Max / 1 Line */
r243410r243411
92839297GAMEL(1996, peps0043, peps0042, peplus, peplus_slots,   peplus_state, peplus,   ROT0,  "IGT - International Game Technology", "Player's Edge Plus (PS0043) Double Diamond Slots",          0, layout_pe_slots )
92849298GAMEL(1996, peps0045, peps0021, peplus, peplus_slots,   peplus_state, peplus,   ROT0,  "IGT - International Game Technology", "Player's Edge Plus (PS0045) Red White & Blue Slots",        0, layout_pe_slots )
92859299GAMEL(1996, peps0047, 0,        peplus, peplus_slots,   peplus_state, peplus,   ROT0,  "IGT - International Game Technology", "Player's Edge Plus (PS0047) Wild Cherry Slots",             GAME_NOT_WORKING, layout_pe_slots ) /* Needs MxO-CG1004.Uxx graphics roms redumped */
9300GAMEL(1996, peps0090, 0,        peplus, peplus_slots,   peplus_state, peplus,   ROT0,  "IGT - International Game Technology", "Player's Edge Plus (PS0090) Gold, Silver & Bronze Slots",   0, layout_pe_slots )
92869301GAMEL(1996, peps0092, peps0047, peplus, peplus_slots,   peplus_state, peplus,   ROT0,  "IGT - International Game Technology", "Player's Edge Plus (PS0092) Wild Cherry Slots",             GAME_NOT_WORKING, layout_pe_slots ) /* Needs MxO-CG1004.Uxx graphics roms redumped */
92879302GAMEL(1996, peps0206, peps0021, peplus, peplus_slots,   peplus_state, peplus,   ROT0,  "IGT - International Game Technology", "Player's Edge Plus (PS0206) Red White & Blue Slots",        0, layout_pe_slots )
92889303GAMEL(1996, peps0207, peps0021, peplus, peplus_slots,   peplus_state, peplus,   ROT0,  "IGT - International Game Technology", "Player's Edge Plus (PS0207) Red White & Blue Slots",        0, layout_pe_slots )
trunk/src/mame/drivers/segas16b.c
r243410r243411
7979Sega System 16B Hardware Overview
8080---------------------------------
8181
82The games on this system include... (there may be more??) //todo
82The games on this system include...
8383Ace Attacker               (C) Sega/Jaleco, 1989
8484Alien Syndrome             (C) Sega, 1987
8585Altered Beast / Jyuohki    (C) Sega, 1988
r243410r243411
386386-----------------|--------------------------------------------------------------------------------------------------|
387387Shinobi          |A1       A2       A3       A4       A5       A6       A7       A8       A9       A10      A11     |
388388CPU  - 317-0049  |--------------------------------------------------------------------------------------------------|
3898751 -           |EPR11280 EPR11281 -        EPR11282 EPR11283 -        EPR11287 EPR11288 EPR11289 -        -       |
3898751 - n/a       |EPR11280 EPR11281 -        EPR11282 EPR11283 -        EPR11287 EPR11288 EPR11289 -        -       |
390390                 |--------------------------------------------------------------------------------------------------|
391391                 |                                                                                                  |
392392J1 O O  J2 O-O   |B1       B2       B3       B4       B5       B6       B7       B8       B9       B10      B11     |
r243410r243411
430430-----------------|--------------------------------------------------------------------------------------------------|
431431Sonic Boom       |A1       A2       A3       A4       A5       A6       A7       A8       A9       A10      A11     |
432432CPU  - 317-0053  |--------------------------------------------------------------------------------------------------|
4338751 -           |EPR11340 EPR11341 -        EPR11342 EPR11343 -        EPR11347 EPR11348 EPR11349 -        -       |
4338751 - n/a       |EPR11340 EPR11341 -        EPR11342 EPR11343 -        EPR11347 EPR11348 EPR11349 -        -       |
434434                 |--------------------------------------------------------------------------------------------------|
435435                 |                                                                                                  |
436436                 |B1       B2       B3       B4       B5       B6       B7       B8       B9       B10      B11     |
r243410r243411
441441-----------------|--------------------------------------------------------------------------------------------------|
442442Passing Shot     |A1       A2       A3       A4       A5       A6       A7       A8       A9       A10      A11     |
443443CPU  - 317-0080  |--------------------------------------------------------------------------------------------------|
4448751 -           |EPR11870 -        -        EPR11871 -        -        EPR11857 EPR11858 EPR11859 EPR11860 EPR11861|
4448751 - n/a       |EPR11870 -        -        EPR11871 -        -        EPR11857 EPR11858 EPR11859 EPR11860 EPR11861|
445445                 |--------------------------------------------------------------------------------------------------|
446446                 |                                                                                                  |
447447J1 O O  J2 O-O   |B1       B2       B3       B4       B5       B6       B7       B8       B9       B10      B11     |
r243410r243411
452452-----------------|--------------------------------------------------------------------------------------------------|
453453Bullet           |A1       A2       A3       A4       A5       A6       A7       A8       A9       A10      A11     |
454454CPU  - 317-0041  |--------------------------------------------------------------------------------------------------|
4558751 -           |EPR11007 EPR11008 EPR11009 EPR11010 EPR11011 EPR11012 EPR10997 EPR10998 -        -        -       |
4558751 - n/a       |EPR11007 EPR11008 EPR11009 EPR11010 EPR11011 EPR11012 EPR10997 EPR10998 -        -        -       |
456456                 |--------------------------------------------------------------------------------------------------|
457457                 |                                                                                                  |
458458J1 O O  J2 O-O   |B1       B2       B3       B4       B5       B6       B7       B8       B9       B10      B11     |
r243410r243411
463463-----------------|--------------------------------------------------------------------------------------------------|
464464Tetris           |A1       A2       A3       A4       A5       A6       A7       A8       A9       A10      A11     |
465465CPU  - 317-0091  |--------------------------------------------------------------------------------------------------|
4668751 -           |EPR12163 -        -        EPR12164 -        -        EPR12168 -        -        -        -       |
4668751 - n/a       |EPR12163 -        -        EPR12164 -        -        EPR12168 -        -        -        -       |
467467                 |--------------------------------------------------------------------------------------------------|
468468                 |                                                                                                  |
469469                 |B1       B2       B3       B4       B5       B6       B7       B8       B9       B10      B11     |
r243410r243411
474474-----------------|--------------------------------------------------------------------------------------------------|
475475Wonder Boy III   |A1       A2       A3       A4       A5       A6       A7       A8       A9       A10      A11     |
476476CPU  - 317-0085  |--------------------------------------------------------------------------------------------------|
4778751 -           |EPR12198 EPR12199 -        EPR12100 EPR12101 -        EPR12127 -        -        -        -       |
4778751 - n/a       |EPR12198 EPR12199 -        EPR12100 EPR12101 -        EPR12127 -        -        -        -       |
478478                 |--------------------------------------------------------------------------------------------------|
479479                 |                                                                                                  |
480                 |B1       B2       B3       B4       B5       B6       B7       B8       B9       B10      B11     |
481                 |--------------------------------------------------------------------------------------------------|
482                 |EPR12190 EPR12191 EPR12192 EPR12193 EPR12194 EPR12195 EPR12196 EPR12197 EPR12124 EPR12125 EPR12126|
480J1 O O  J2 O-O   |B1       B2       B3       B4       B5       B6       B7       B8       B9       B10      B11     |
481J3 512 J4 256    |--------------------------------------------------------------------------------------------------|
482J5 512 J6 512    |EPR12190 EPR12191 EPR12192 EPR12193 EPR12194 EPR12195 EPR12196 EPR12197 EPR12124 EPR12125 EPR12126|
483483-----------------|--------------------------------------------------------------------------------------------------|
484484
485485-----------------|--------------------------------------------------------------------------------------------------|
486486Excite League    |A1       A2       A3       A4       A5       A6       A7       A8       A9       A10      A11     |
487CPU  - 317-0079? |--------------------------------------------------------------------------------------------------|
487CPU  - 317-0079 |--------------------------------------------------------------------------------------------------|
4884888751 -           |EPR11936 EPR11937 EPR11938 EPR11939 EPR11940 EPR11941 EPR11945 EPR11140 EPR11141 EPR11142 EPR11143|
489489                 |--------------------------------------------------------------------------------------------------|
490490                 |                                                                                                  |
491                 |B1       B2       B3       B4       B5       B6       B7       B8       B9       B10      B11     |
492                 |--------------------------------------------------------------------------------------------------|
493                 |EPR11950 EPR11951 EPR11952 EPR11953 EPR11954 EPR11955 EPR11956 EPR11957 EPR11942 EPR11943 EPR11944|
491J1 O O  J2 O-O   |B1       B2       B3       B4       B5       B6       B7       B8       B9       B10      B11     |
492J3 512 J4 256    |--------------------------------------------------------------------------------------------------|
493J5 512 J6 256/512|EPR11950 EPR11951 EPR11952 EPR11953 EPR11954 EPR11955 EPR11956 EPR11957 EPR11942 EPR11943 EPR11944|
494494-----------------|--------------------------------------------------------------------------------------------------|
495
495                  J6 jumper tied from lower left side of 256 jumper to upper right side of 512 jumper like this: /
496496-----------------|--------------------------------------------------------------------------------------------------|
497497Super League     |A1       A2       A3       A4       A5       A6       A7       A8       A9       A10      A11     |
498CPU  - 317-0045? |--------------------------------------------------------------------------------------------------|
498CPU  - 317-0045 |--------------------------------------------------------------------------------------------------|
4994998751 -           |EPR11130 EPR11131 EPR11132 EPR11133 EPR11134 EPR11135 EPR11139 EPR11140 EPR11141 EPR11142 EPR11143|
500500                 |--------------------------------------------------------------------------------------------------|
501501                 |                                                                                                  |
502                 |B1       B2       B3       B4       B5       B6       B7       B8       B9       B10      B11     |
503                 |--------------------------------------------------------------------------------------------------|
504                 |EPR11144 EPR11145 EPR11146 EPR11147 EPR11148 EPR11149 EPR11150 EPR11151 EPR11136 EPR11137 EPR11138|
502J1 O O  J2 O-O   |B1       B2       B3       B4       B5       B6       B7       B8       B9       B10      B11     |
503J3 512 J4 256    |--------------------------------------------------------------------------------------------------|
504J5 512 J6 512    |EPR11144 EPR11145 EPR11146 EPR11147 EPR11148 EPR11149 EPR11150 EPR11151 EPR11136 EPR11137 EPR11138|
505505-----------------|--------------------------------------------------------------------------------------------------|
506506
507507-----------------|--------------------------------------------------------------------------------------------------|
r243410r243411
592592315-5298 - Signetics PLS153F Field Programmable Logic Array stamped '315-5298' (DIP20)
593593315-5248 - Custom Sega IC (QFP100)
594594315-5250 - Custom Sega IC (QFP120)
595  S1-S16 - Jumpers to configure ROM sizes               //usage TODO
595  S1-S16 - Jumpers to configure ROM sizes
596596           Jumpers are either shorted or not shorted.
597597           In the tables below, the listed jumpers per game are the shorted ones, the unlisted ones are not shorted.
598598
r243410r243411
714714Notes:
715715       * - Empty position, no socket
716716315-5298 - Signetics PLS153F Field Programmable Logic Array stamped '315-5298' (DIP20)
717  S1-S18 - Jumpers to configure ROM sizes                                               //usage TODO
717  S1-S18 - Jumpers to configure ROM sizes
718718           Jumpers are either shorted or not shorted.
719719           In the tables below, the listed jumpers per game are the shorted ones, the unlisted ones are not shorted.
720720           S1/S2 - Jumpers to configure 68k program ROM size
r243410r243411
737737-----------------|--------------------------------------------------------------------------------------------------------------------------------------|
738738Golden Axe       |A1       A2       A3       A4       A5       A6       A7       A8       A10      A11      A12               A14      A15      A16     |
739739CPU  - 317-0121  |--------------------------------------------------------------------------------------------------------------------------------------|
7408751 -           |-        -        -        -        EPR12539 EPR12519 EPR12540 EPR12521 EPR12390 MPR12384 -                 EPR12385 EPR12386 EPR12387|
7408751 - n/a       |-        -        -        -        EPR12539 EPR12519 EPR12540 EPR12521 EPR12390 MPR12384 -                 EPR12385 EPR12386 EPR12387|
741741                 |--------------------------------------------------------------------------------------------------------------------------------------|
742742                 |                                                                                                                                      |
743743                 |B1       B2       B3       B4       B5       B6       B7       B8       B10      B11      B12      B13      B14      B15      B16     |
r243410r243411
814814-----------------|--------------------------------------------------------------------------------------------------------------------------------------|
815815Altered Beast    |A1       A2       A3       A4       A5       A6       A7       A8       A10      A11      A12               A14      A15      A16     |
816816CPU  - 68000     |--------------------------------------------------------------------------------------------------------------------------------------|
8178751 - 317-0078? |EPR11717 EPR11718 EPR11719 -        EPR11884 -        EPR11885 -        EPR11671 EPR11672 EPR11673          EPR11722 EPR11723 EPR11724|
8178751 - 317-0078 |EPR11717 EPR11718 EPR11719 -        EPR11884 -        EPR11885 -        EPR11671 EPR11672 EPR11673          EPR11722 EPR11723 EPR11724|
818818                 |--------------------------------------------------------------------------------------------------------------------------------------|
819819                 |                                                                                                                                      |
820820                 |B1       B2       B3       B4       B5       B6       B7       B8       B10      B11      B12      B13      B14      B15      B16     |
r243410r243411
858858-----------------|--------------------------------------------------------------------------------------------------------------------------------------|
859859Tetris           |A1       A2       A3       A4       A5       A6       A7       A8       A10      A11      A12               A14      A15      A16     |
860860CPU  - 317-0092  |--------------------------------------------------------------------------------------------------------------------------------------|
8618751 -           |-        -        -        -        EPR12192 -        EPR12193 -        EPR12168 -        -                 EPR12165 EPR12166 EPR12167|
8618751 - n/a       |-        -        -        -        EPR12192 -        EPR12193 -        EPR12168 -        -                 EPR12165 EPR12166 EPR12167|
862862                 |--------------------------------------------------------------------------------------------------------------------------------------|
863863                 |                                                                                                                                      |
864864                 |B1       B2       B3       B4       B5       B6       B7       B8       B10      B11      B12      B13      B14      B15      B16     |
865                 |--------------------------------------------------------------------------------------------------------------------------------------|
866                 |EPR      -        -        -        EPR      -        -        -        -        -        -        -        -        -        -       |
865S2 S3 S6 S7 S9   |--------------------------------------------------------------------------------------------------------------------------------------|
866S11 S13 S15 S17  |EPR12194 -        -        -        EPR12195 -        -        -        -        -        -        -        -        -        -       |
867867-----------------|--------------------------------------------------------------------------------------------------------------------------------------|
868                  Sega part number for B1 & B5 unknown
869868
870869***************************************************************************/
871870
r243410r243411
36463645   ROM_LOAD( "opr-11673.a12", 0x30000, 0x20000, CRC(400c4a36) SHA1(de4bdfa91734410e0a7f6a16bf8336db172f458a) )
36473646
36483647   ROM_REGION( 0x1000, "mcu", 0 )  // Intel i8751 protection MCU
3649   ROM_LOAD( "317-0078.mcu", 0x00000, 0x1000, NO_DUMP )
3648   ROM_LOAD( "317-0078.c2", 0x00000, 0x1000, NO_DUMP )
36503649ROM_END
36513650
36523651//*************************************************************************************************************************
r243410r243411
36893688   ROM_LOAD( "opr-11673.a12", 0x30000, 0x20000, CRC(400c4a36) SHA1(de4bdfa91734410e0a7f6a16bf8336db172f458a) )
36903689
36913690   ROM_REGION( 0x1000, "mcu", 0 )  // Intel i8751 protection MCU
3692   ROM_LOAD( "317-0077.mcu", 0x00000, 0x1000, NO_DUMP )
3691   ROM_LOAD( "317-0077.c2", 0x00000, 0x1000, NO_DUMP )
36933692ROM_END
36943693
36953694//*************************************************************************************************************************
r243410r243411
37323731   ROM_LOAD( "opr-11673.a12", 0x30000, 0x20000, CRC(400c4a36) SHA1(de4bdfa91734410e0a7f6a16bf8336db172f458a) )
37333732
37343733   ROM_REGION( 0x1000, "mcu", 0 )  // Intel i8751 protection MCU
3735   ROM_LOAD( "317-0076.mcu", 0x00000, 0x1000, NO_DUMP )
3734   ROM_LOAD( "317-0076.c2", 0x00000, 0x1000, NO_DUMP )
37363735ROM_END
37373736
37383737//*************************************************************************************************************************
r243410r243411
46954694   ROM_REGION( 0x10000, "soundcpu", 0 ) // sound CPU
46964695   ROM_LOAD( "epr-11916.a10", 0x0000, 0x8000, CRC(7ab541cf) SHA1(feb88022ca1796d020e53e95ad345159bd415530) )
46974696
4698   ROM_REGION( 0x1000, "mcu", 0 )  // protection MCU
4699   ROM_LOAD( "317-0095.bin", 0x00000, 0x1000, NO_DUMP )
4697   ROM_REGION( 0x1000, "mcu", 0 )  // Intel i8751 protection MCU
4698   ROM_LOAD( "317-0095.c2", 0x00000, 0x1000, NO_DUMP )
47004699ROM_END
47014700
47024701
r243410r243411
48544853   ROM_LOAD16_BYTE( "epr-12680.a3", 0x180001, 0x20000, CRC(f321452c) SHA1(cdccd8facc2941745f05fba25ad7d76b445eb873) )
48554854   ROM_LOAD16_BYTE( "epr-12699.b12",0x180000, 0x20000, CRC(ac329586) SHA1(98994f41ee2f0fa5cd800f565b277ba21f2bb0c3) )
48564855
4857
48584856   ROM_REGION( 0x90000, "soundcpu", 0 ) // sound CPU
48594857   ROM_LOAD( "epr-12685.a10", 0x00000, 0x08000, CRC(5d0c16d7) SHA1(7ab13376c2a1da0566689ccbc258f94d1f4de487) )
48604858   ROM_LOAD( "mpr-12686.a11", 0x10000, 0x20000, CRC(f451705e) SHA1(2b3d1b3ffbc6ba2285c4141e6fd3447252a31c8b) )
r243410r243411
48714869//
48724870ROM_START( exctleag )
48734871   ROM_REGION( 0x60000, "maincpu", 0 ) // 68000 code
4874   ROM_LOAD16_BYTE( "epr-11939.a04", 0x00000, 0x10000, CRC(117dd98f) SHA1(0234c2cf3421849854bec3711ab64f50f12cc5dd) )
4875   ROM_LOAD16_BYTE( "epr-11936.a01", 0x00001, 0x10000, CRC(0863de60) SHA1(540a5cae2623bce296c07603239f737a782e3b0b) )
4876   ROM_LOAD16_BYTE( "epr-11940.a05", 0x20000, 0x10000, CRC(dec83274) SHA1(85919bcd372fbfb9f06c34897b4d28d08ef3c9d1) )
4877   ROM_LOAD16_BYTE( "epr-11937.a02", 0x20001, 0x10000, CRC(4ebda367) SHA1(ab4db50eb0d2e10a3b4b7fc0f4bdc82412379809) )
4878   ROM_LOAD16_BYTE( "epr-11941.a06", 0x40000, 0x10000, CRC(4df2d451) SHA1(644541b20e034a0149117874021c158bd3759e35) )
4879   ROM_LOAD16_BYTE( "epr-11938.a03", 0x40001, 0x10000, CRC(07c08d47) SHA1(47d3445cfa2514918206cd29a203837a9f434b42) )
4872   ROM_LOAD16_BYTE( "epr-11939.a4", 0x00000, 0x10000, CRC(117dd98f) SHA1(0234c2cf3421849854bec3711ab64f50f12cc5dd) )
4873   ROM_LOAD16_BYTE( "epr-11936.a1", 0x00001, 0x10000, CRC(0863de60) SHA1(540a5cae2623bce296c07603239f737a782e3b0b) )
4874   ROM_LOAD16_BYTE( "epr-11940.a5", 0x20000, 0x10000, CRC(dec83274) SHA1(85919bcd372fbfb9f06c34897b4d28d08ef3c9d1) )
4875   ROM_LOAD16_BYTE( "epr-11937.a2", 0x20001, 0x10000, CRC(4ebda367) SHA1(ab4db50eb0d2e10a3b4b7fc0f4bdc82412379809) )
4876   ROM_LOAD16_BYTE( "epr-11941.a6", 0x40000, 0x10000, CRC(4df2d451) SHA1(644541b20e034a0149117874021c158bd3759e35) )
4877   ROM_LOAD16_BYTE( "epr-11938.a3", 0x40001, 0x10000, CRC(07c08d47) SHA1(47d3445cfa2514918206cd29a203837a9f434b42) )
48804878
48814879   ROM_REGION( 0x2000, "maincpu:key", 0 ) // decryption key
48824880   ROM_LOAD( "317-0079.key", 0x0000, 0x2000, CRC(effefa1c) SHA1(f42e87f60c9589862ea2c05a29b1b15dc7194051) )
r243410r243411
48874885   ROM_LOAD( "epr-11944.b11", 0x20000, 0x10000, CRC(a75cae80) SHA1(17c148a33b09b5403e68f5d96e506545c2ced206) )
48884886
48894887   ROM_REGION16_BE( 0x80000, "sprites", 0 ) // sprites
4890   ROM_LOAD16_BYTE( "epr-11950.b01", 0x00001, 0x10000, CRC(af497849) SHA1(c5fdca8d3b1d83e3d377a49ecdc0fc53714afc09) )
4891   ROM_LOAD16_BYTE( "epr-11954.b05", 0x00000, 0x10000, CRC(5fa2106c) SHA1(2f2620fa52d07667dff4720fea32a6615d99e522) )
4892   ROM_LOAD16_BYTE( "epr-11951.b02", 0x20001, 0x10000, CRC(c04fa974) SHA1(b1a4fb8522126113d7857d559f169f09c5f51a13) )
4893   ROM_LOAD16_BYTE( "epr-11955.b06", 0x20000, 0x10000, CRC(86a0c368) SHA1(ab8d6ab5c571121bf9c5d40727b1ef385a033845) )
4894   ROM_LOAD16_BYTE( "epr-11952.b03", 0x40001, 0x10000, CRC(e64a9761) SHA1(e16b3a30165710abc11ab0f358cb7ef875cc672c) )
4895   ROM_LOAD16_BYTE( "epr-11956.b07", 0x40000, 0x10000, CRC(aff5c2fa) SHA1(1ec76193f2abf3547fa610761147436548beccbc) )
4896   ROM_LOAD16_BYTE( "epr-11953.b04", 0x60001, 0x10000, CRC(4cae3999) SHA1(22089e43a5e2e4fe672015366154e24ad38d3c19) )
4897   ROM_LOAD16_BYTE( "epr-11957.b08", 0x60000, 0x10000, CRC(218f835b) SHA1(bfef3ec45665a5921c095da34701528d4d4e0e3a) )
4888   ROM_LOAD16_BYTE( "epr-11950.b1", 0x00001, 0x10000, CRC(af497849) SHA1(c5fdca8d3b1d83e3d377a49ecdc0fc53714afc09) )
4889   ROM_LOAD16_BYTE( "epr-11954.b5", 0x00000, 0x10000, CRC(5fa2106c) SHA1(2f2620fa52d07667dff4720fea32a6615d99e522) )
4890   ROM_LOAD16_BYTE( "epr-11951.b2", 0x20001, 0x10000, CRC(c04fa974) SHA1(b1a4fb8522126113d7857d559f169f09c5f51a13) )
4891   ROM_LOAD16_BYTE( "epr-11955.b6", 0x20000, 0x10000, CRC(86a0c368) SHA1(ab8d6ab5c571121bf9c5d40727b1ef385a033845) )
4892   ROM_LOAD16_BYTE( "epr-11952.b3", 0x40001, 0x10000, CRC(e64a9761) SHA1(e16b3a30165710abc11ab0f358cb7ef875cc672c) )
4893   ROM_LOAD16_BYTE( "epr-11956.b7", 0x40000, 0x10000, CRC(aff5c2fa) SHA1(1ec76193f2abf3547fa610761147436548beccbc) )
4894   ROM_LOAD16_BYTE( "epr-11953.b4", 0x60001, 0x10000, CRC(4cae3999) SHA1(22089e43a5e2e4fe672015366154e24ad38d3c19) )
4895   ROM_LOAD16_BYTE( "epr-11957.b8", 0x60000, 0x10000, CRC(218f835b) SHA1(bfef3ec45665a5921c095da34701528d4d4e0e3a) )
48984896
48994897   ROM_REGION( 0x50000, "soundcpu", 0 ) // sound CPU
4900   ROM_LOAD( "epr-11945.a07", 0x00000, 0x8000, CRC(c2a83012) SHA1(b3de8af803497438aa3e110a9c608ac290f7d1e8) )
4901   ROM_LOAD( "epr-11140.a08", 0x10000, 0x8000, CRC(b297371b) SHA1(4e787aa9ee2aeab4da30237644421df407b684a5) )
4902   ROM_LOAD( "epr-11141.a09", 0x20000, 0x8000, CRC(19756aa6) SHA1(81597e17b848f6a41f5fb117296e7508297815e4) )
4898   ROM_LOAD( "epr-11945.a7", 0x00000, 0x8000, CRC(c2a83012) SHA1(b3de8af803497438aa3e110a9c608ac290f7d1e8) )
4899   ROM_LOAD( "epr-11140.a8", 0x10000, 0x8000, CRC(b297371b) SHA1(4e787aa9ee2aeab4da30237644421df407b684a5) )
4900   ROM_LOAD( "epr-11141.a9", 0x20000, 0x8000, CRC(19756aa6) SHA1(81597e17b848f6a41f5fb117296e7508297815e4) )
49034901   ROM_LOAD( "epr-11142.a10", 0x30000, 0x8000, CRC(25d26c66) SHA1(2485afb859f84a9cc90b2091e9ae4eef263f42b3) )
49044902   ROM_LOAD( "epr-11143.a11", 0x40000, 0x8000, CRC(848b7b77) SHA1(8903a39f8f0ffb4ce32117d33282876196516c30) )
49054903ROM_END
r243410r243411
50415039   ROM_LOAD( "epr-12390.ic8", 0x00000, 0x08000, CRC(399fc5f5) SHA1(6f290b36dc71ff4759598e2a9c185a8945a3c9e7) )
50425040   ROM_LOAD( "mpr-12384.ic6", 0x10000, 0x20000, CRC(6218d8e7) SHA1(5a745c750efb4a61716f99befb7ed14cc84e9973) )
50435041
5044   ROM_REGION( 0x1000, "mcu", 0 )  // protection MCU
5045   ROM_LOAD( "317-0123a.bin", 0x00000, 0x1000, NO_DUMP )
5042   ROM_REGION( 0x1000, "mcu", 0 )  // Intel i8751 protection MCU
5043   ROM_LOAD( "317-0123a.c2", 0x00000, 0x1000, NO_DUMP )
50465044ROM_END
50475045
50485046//*************************************************************************************************************************
r243410r243411
52015199   ROM_LOAD( "epr-12390.a10", 0x00000, 0x08000, CRC(399fc5f5) SHA1(6f290b36dc71ff4759598e2a9c185a8945a3c9e7) )
52025200   ROM_LOAD( "mpr-12384.a11", 0x10000, 0x20000, CRC(6218d8e7) SHA1(5a745c750efb4a61716f99befb7ed14cc84e9973) )
52035201
5204   ROM_REGION( 0x1000, "mcu", 0 )  // protection MCU
5205   ROM_LOAD( "317-0112.bin", 0x00000, 0x1000, NO_DUMP )
5202   ROM_REGION( 0x1000, "mcu", 0 )  // Intel i8751 protection MCU
5203   ROM_LOAD( "317-0112.c2", 0x00000, 0x1000, NO_DUMP )
52065204ROM_END
52075205
52085206//*************************************************************************************************************************
r243410r243411
60166014//
60176015ROM_START( suprleag )
60186016   ROM_REGION( 0x60000, "maincpu", 0 ) // 68000 code
6019   ROM_LOAD16_BYTE( "epr-11133.a04", 0x00000, 0x10000, CRC(eed72f37) SHA1(80b68abdb90a63b30754dd031e85b1020dcc0cc4) )
6020   ROM_LOAD16_BYTE( "epr-11130.a01", 0x00001, 0x10000, CRC(e2451676) SHA1(d2f71d9fca933e63e2bd5ee48217801ab0cb049c) )
6021   ROM_LOAD16_BYTE( "epr-11134.a05", 0x20000, 0x10000, CRC(ccd857f5) SHA1(2566bb458bdd365db403e8229ecdad79e23076a1) )
6022   ROM_LOAD16_BYTE( "epr-11131.a02", 0x20001, 0x10000, CRC(9b78c2cc) SHA1(9a453dd999120590c52b17f8ff2b49fd2fde0b35) )
6023   ROM_LOAD16_BYTE( "epr-11135.a06", 0x40000, 0x10000, CRC(3735e0e1) SHA1(ae2910099909245993ee29e5a03a5591f20962c7) )
6024   ROM_LOAD16_BYTE( "epr-11132.a03", 0x40001, 0x10000, CRC(ff199325) SHA1(2ece15b6b79ec3f948f7bec623e1df281cf89382) )
6017   ROM_LOAD16_BYTE( "epr-11133.a4", 0x00000, 0x10000, CRC(eed72f37) SHA1(80b68abdb90a63b30754dd031e85b1020dcc0cc4) )
6018   ROM_LOAD16_BYTE( "epr-11130.a1", 0x00001, 0x10000, CRC(e2451676) SHA1(d2f71d9fca933e63e2bd5ee48217801ab0cb049c) )
6019   ROM_LOAD16_BYTE( "epr-11134.a5", 0x20000, 0x10000, CRC(ccd857f5) SHA1(2566bb458bdd365db403e8229ecdad79e23076a1) )
6020   ROM_LOAD16_BYTE( "epr-11131.a2", 0x20001, 0x10000, CRC(9b78c2cc) SHA1(9a453dd999120590c52b17f8ff2b49fd2fde0b35) )
6021   ROM_LOAD16_BYTE( "epr-11135.a6", 0x40000, 0x10000, CRC(3735e0e1) SHA1(ae2910099909245993ee29e5a03a5591f20962c7) )
6022   ROM_LOAD16_BYTE( "epr-11132.a3", 0x40001, 0x10000, CRC(ff199325) SHA1(2ece15b6b79ec3f948f7bec623e1df281cf89382) )
60256023
60266024   ROM_REGION( 0x2000, "maincpu:key", 0 ) // decryption key
60276025   ROM_LOAD( "317-0045.key", 0x0000, 0x2000, CRC(0594cc2e) SHA1(8aec3fffd00cbfd50d7cfb92e4748e2653fbb504) )
60286026
60296027   ROM_REGION( 0x30000, "gfx1", 0 ) // tiles
6030   ROM_LOAD( "epr-11136.b09", 0x00000, 0x10000, CRC(c3860ce4) SHA1(af7618f3b5a0e8d6374877c7815ba69fff218a45) )
6028   ROM_LOAD( "epr-11136.b9", 0x00000, 0x10000, CRC(c3860ce4) SHA1(af7618f3b5a0e8d6374877c7815ba69fff218a45) )
60316029   ROM_LOAD( "epr-11137.b10", 0x10000, 0x10000, CRC(92d96187) SHA1(45138795992b9842d5b0c86a96b300445bf12060) )
60326030   ROM_LOAD( "epr-11138.b11", 0x20000, 0x10000, CRC(c01dc773) SHA1(b27da906186e1272cdd6f8d5e5a979f6623255ac) )
60336031
60346032   ROM_REGION16_BE( 0x80000, "sprites", 0 ) // sprites
6035   ROM_LOAD16_BYTE( "epr-11144.b01", 0x00001, 0x10000, CRC(b31de51c) SHA1(011a79a37d32ab4545187e28e61f27aa0601f686) )
6036   ROM_LOAD16_BYTE( "epr-11148.b05", 0x00000, 0x10000, CRC(126e1309) SHA1(7386ac5ac57325d8f661caf8cab0b19a42c0309d) )
6037   ROM_LOAD16_BYTE( "epr-11145.b02", 0x20001, 0x10000, CRC(4223d2c3) SHA1(310d5c411eeaf69fe0dc9350e6bfe6dfe950b373) )
6038   ROM_LOAD16_BYTE( "epr-11149.b06", 0x20000, 0x10000, CRC(694d3765) SHA1(4aa8590648d5b8eb5db489edefb1326ecd01ea2c) )
6039   ROM_LOAD16_BYTE( "epr-11146.b03", 0x40001, 0x10000, CRC(bf0359b6) SHA1(6cd5e6b685e53f062d5b04888f225c808aab3c4c) )
6040   ROM_LOAD16_BYTE( "epr-11150.b07", 0x40000, 0x10000, CRC(9fc0aded) SHA1(7ad9e8fe79a0a07c748b0c20ad46c0e00de8a23a) )
6041   ROM_LOAD16_BYTE( "epr-11147.b04", 0x60001, 0x10000, CRC(3e592772) SHA1(b0fe2c680871dcdbe655c0b1b98bcf8118fb3a50) )
6042   ROM_LOAD16_BYTE( "epr-11151.b08", 0x60000, 0x10000, CRC(9de95169) SHA1(1a2801ecd9dece3dae7ceab3b793d5005caa4614) )
6033   ROM_LOAD16_BYTE( "epr-11144.b1", 0x00001, 0x10000, CRC(b31de51c) SHA1(011a79a37d32ab4545187e28e61f27aa0601f686) )
6034   ROM_LOAD16_BYTE( "epr-11148.b5", 0x00000, 0x10000, CRC(126e1309) SHA1(7386ac5ac57325d8f661caf8cab0b19a42c0309d) )
6035   ROM_LOAD16_BYTE( "epr-11145.b2", 0x20001, 0x10000, CRC(4223d2c3) SHA1(310d5c411eeaf69fe0dc9350e6bfe6dfe950b373) )
6036   ROM_LOAD16_BYTE( "epr-11149.b6", 0x20000, 0x10000, CRC(694d3765) SHA1(4aa8590648d5b8eb5db489edefb1326ecd01ea2c) )
6037   ROM_LOAD16_BYTE( "epr-11146.b3", 0x40001, 0x10000, CRC(bf0359b6) SHA1(6cd5e6b685e53f062d5b04888f225c808aab3c4c) )
6038   ROM_LOAD16_BYTE( "epr-11150.b7", 0x40000, 0x10000, CRC(9fc0aded) SHA1(7ad9e8fe79a0a07c748b0c20ad46c0e00de8a23a) )
6039   ROM_LOAD16_BYTE( "epr-11147.b4", 0x60001, 0x10000, CRC(3e592772) SHA1(b0fe2c680871dcdbe655c0b1b98bcf8118fb3a50) )
6040   ROM_LOAD16_BYTE( "epr-11151.b8", 0x60000, 0x10000, CRC(9de95169) SHA1(1a2801ecd9dece3dae7ceab3b793d5005caa4614) )
60436041
60446042   ROM_REGION( 0x50000, "soundcpu", 0 ) // sound CPU
6045   ROM_LOAD( "epr-11139.a07", 0x00000, 0x08000, CRC(9cbd99da) SHA1(55960b68b23a4f89ec810e1d31f22ba60cda0cfe) )
6046   ROM_LOAD( "epr-11140.a08", 0x10000, 0x08000, CRC(b297371b) SHA1(4e787aa9ee2aeab4da30237644421df407b684a5) )
6047   ROM_LOAD( "epr-11141.a09", 0x20000, 0x08000, CRC(19756aa6) SHA1(81597e17b848f6a41f5fb117296e7508297815e4) )
6043   ROM_LOAD( "epr-11139.a7", 0x00000, 0x08000, CRC(9cbd99da) SHA1(55960b68b23a4f89ec810e1d31f22ba60cda0cfe) )
6044   ROM_LOAD( "epr-11140.a8", 0x10000, 0x08000, CRC(b297371b) SHA1(4e787aa9ee2aeab4da30237644421df407b684a5) )
6045   ROM_LOAD( "epr-11141.a9", 0x20000, 0x08000, CRC(19756aa6) SHA1(81597e17b848f6a41f5fb117296e7508297815e4) )
60486046   ROM_LOAD( "epr-11142.a10", 0x30000, 0x08000, CRC(25d26c66) SHA1(2485afb859f84a9cc90b2091e9ae4eef263f42b3) )
60496047   ROM_LOAD( "epr-11143.a11", 0x40000, 0x08000, CRC(848b7b77) SHA1(8903a39f8f0ffb4ce32117d33282876196516c30) )
60506048ROM_END
r243410r243411
62226220   ROM_LOAD( "opr-12329.a11", 0x10000, 0x10000, CRC(ed9a686d) SHA1(da433033d501ee871429ee676b3972b14179df9f) )     // speech
62236221   ROM_LOAD( "opr-12330.a12", 0x20000, 0x10000, CRC(fb762bca) SHA1(ff9191c5ec38c711ebb7c2ad043f62b6d7e2203c) )
62246222
6225   ROM_REGION( 0x1000, "mcu", 0 )  // protection MCU
6226   ROM_LOAD( "317-0104.bin", 0x00000, 0x1000, NO_DUMP )
6223   ROM_REGION( 0x1000, "mcu", 0 )  // Intel i8751 protection MCU
6224   ROM_LOAD( "317-0104.c2", 0x00000, 0x1000, NO_DUMP )
62276225ROM_END
62286226
62296227//*************************************************************************************************************************
r243410r243411
62346232//
62356233ROM_START( tturfu )
62366234   ROM_REGION( 0x40000, "maincpu", 0 ) // 68000 code
6237   ROM_LOAD16_BYTE( "epr-12266.bin",  0x00000, 0x10000, CRC(f549def8) SHA1(9e913509d46274bd192455321904ec9884b5f629) )
6238   ROM_LOAD16_BYTE( "epr-12264.bin",  0x00001, 0x10000, CRC(f7cdb289) SHA1(9c386cf33a96a977c623c2f243db38fda2c41ba4) )
6239   ROM_LOAD16_BYTE( "epr-12267.bin",  0x20000, 0x10000, CRC(3c3ce191) SHA1(036ece2be585a85e05c047fe4a1ab3b6814c3490) )
6240   ROM_LOAD16_BYTE( "epr-12265.bin",  0x20001, 0x10000, CRC(8cdadd9a) SHA1(a17852f0eb8f63a82ff44cbeb100da72fe5890e0) )
6235   ROM_LOAD16_BYTE( "epr-12266.a1",  0x00000, 0x10000, CRC(f549def8) SHA1(9e913509d46274bd192455321904ec9884b5f629) )
6236   ROM_LOAD16_BYTE( "epr-12264.a4",  0x00001, 0x10000, CRC(f7cdb289) SHA1(9c386cf33a96a977c623c2f243db38fda2c41ba4) )
6237   ROM_LOAD16_BYTE( "epr-12267.a2",  0x20000, 0x10000, CRC(3c3ce191) SHA1(036ece2be585a85e05c047fe4a1ab3b6814c3490) )
6238   ROM_LOAD16_BYTE( "epr-12265.a5",  0x20001, 0x10000, CRC(8cdadd9a) SHA1(a17852f0eb8f63a82ff44cbeb100da72fe5890e0) )
62416239
62426240   ROM_REGION( 0x30000, "gfx1", 0 ) // tiles
62436241   ROM_LOAD( "epr-12268.a14", 0x00000, 0x10000, CRC(e0dac07f) SHA1(c7f6de42eb93a8f34afdc300628735b5f40a34c2) )
r243410r243411
62616259   ROM_LOAD( "epr-12274.a10", 0x30000, 0x8000, CRC(8207f0c4) SHA1(169914861a52fa731a305e1ee2d230aa0d0d97fe) )
62626260   ROM_LOAD( "epr-12275.a11", 0x40000, 0x8000, CRC(182f3c3d) SHA1(1482fe08a05a721e315b1a3aa5bef4dddc72e26e) )
62636261
6264   ROM_REGION( 0x1000, "mcu", 0 )  // protection MCU
6265   ROM_LOAD( "317-0099.bin", 0x00000, 0x1000, CRC(f676e3e4) SHA1(b71bad46c8b5f7328fd8d48f18624a620f0d34ce) )
6262   ROM_REGION( 0x1000, "mcu", 0 )  // Intel i8751 protection MCU
6263   ROM_LOAD( "317-0099.c2", 0x00000, 0x1000, CRC(f676e3e4) SHA1(b71bad46c8b5f7328fd8d48f18624a620f0d34ce) )
62666264ROM_END
62676265
62686266
r243410r243411
62966294   ROM_REGION( 0x10000, "soundcpu", 0 ) // sound CPU
62976295   ROM_LOAD( "epr-12127.a10", 0x0000, 0x8000, CRC(0bb901bb) SHA1(c81b198df8e3b0ec568032c76addf0d1a1711194) )
62986296
6299   ROM_REGION( 0x1000, "mcu", 0 )  // protection MCU
6300   ROM_LOAD( "317-0098.bin", 0x00000, 0x1000, NO_DUMP )
6297   ROM_REGION( 0x1000, "mcu", 0 )  // Intel i8751 protection MCU
6298   ROM_LOAD( "317-0098.c2", 0x00000, 0x1000, NO_DUMP )
63016299ROM_END
63026300
63036301
r243410r243411
63866384ROM_START( wb32 )
63876385   ROM_REGION( 0x40000, "maincpu", 0 ) // 68000 code
63886386   ROM_LOAD16_BYTE( "epr-12098.a1", 0x000001, 0x10000, CRC(d998e5e5) SHA1(a7398b7338a33451a650c2f1d382dad2e5130528) )
6389   ROM_LOAD16_BYTE( "epr-12100.a6", 0x000000, 0x10000, CRC(f5ca4abc) SHA1(1331db10cf99905fb13c1606a3f4d8bbf3d681b6) )
6387   ROM_LOAD16_BYTE( "epr-12100.a4", 0x000000, 0x10000, CRC(f5ca4abc) SHA1(1331db10cf99905fb13c1606a3f4d8bbf3d681b6) )
63906388   ROM_LOAD16_BYTE( "epr-12099.a2", 0x020001, 0x10000, CRC(3e243b45) SHA1(2a079553d1b61aaf18025847570003b79c8d6edf) )
63916389   ROM_LOAD16_BYTE( "epr-12101.a5", 0x020000, 0x10000, CRC(6146492b) SHA1(93515578a6ccf770944fea86d2f3200fa08f5075) )
63926390
r243410r243411
64706468   ROM_LOAD( "mpr-12148.a11", 0x10000, 0x20000, CRC(fb9a7f29) SHA1(7ba79c18ab4e586be2deccd78e4479d55eb75a7e) )
64716469   ROM_LOAD( "mpr-12149.a12", 0x30000, 0x20000, CRC(d6617b19) SHA1(aa36d257eaa52c8c871a39aaa2f29c203525dbaf) )
64726470
6473   ROM_REGION( 0x1000, "mcu", 0 )  // protection MCU
6474   ROM_LOAD( "317-0103.bin", 0x00000, 0x1000, CRC(aa0710f5) SHA1(61ba8d23d045806b0a7b75184766be00f872cc72) )
6471   ROM_REGION( 0x1000, "mcu", 0 )  // Intel i8751 protection MCU
6472   ROM_LOAD( "317-0103.c2", 0x00000, 0x1000, CRC(aa0710f5) SHA1(61ba8d23d045806b0a7b75184766be00f872cc72) )
64756473ROM_END
64766474
64776475//*************************************************************************************************************************
r243410r243411
65656563//  Sega operated this game on actual System 16 PCBs for various events,
65666564//  it was also included in the PS2 Sega Ages collection Vol 33.
65676565//  Various bootlegs were sourced from this version. The dump will have to
6568//  be verified if the official PCB ever gets into MAME friendly hands.
6566//  be verified if the official PCB ever gets into MAME-friendly hands.
65696567//
65706568//  There is also a demo version of the game available on the PC, but
65716569//  attempting to use those ROMs on a real PCB / emulator will result
trunk/src/mame/drivers/sidearms.c
r243410r243411
768768   ROM_LOAD( "63s081.3j",    0x0300, 0x0020, CRC(c5817816) SHA1(cc642daafa0bcb160ee04e74e2d168fd44087608) )    // unknown
769769ROM_END
770770
771ROM_START( sidearmsr )
771ROM_START( sidearmsu )
772772   ROM_REGION( 0x20000, "maincpu", 0 )     /* 64k for code + banked ROMs images */
773   ROM_LOAD( "SAA_03.15E",   0x00000, 0x08000, CRC(32ef2739) SHA1(15e0535a6e3508c0d1ed73157a052c3716571000) )        /* CODE */
774   ROM_LOAD( "a_14e.rom",    0x10000, 0x08000, CRC(4925ed03) SHA1(b11dbd9889db89cff008ca21beb6b1b70d983e16) )        /* 0+1 */
775   ROM_LOAD( "a_12e.rom",    0x18000, 0x08000, CRC(81d0ece7) SHA1(5c1d154f9c1de6b5f5d7abf5d413e9c493461e6f) )        /* 2+3 */
776
777   ROM_REGION( 0x10000, "audiocpu", 0 )
778   ROM_LOAD( "a_04k.rom",    0x0000, 0x8000, CRC(34efe2d2) SHA1(e1d8895c113e4dee1a132e2471d75dfa6c36b620) )
779
780   ROM_REGION( 0x08000, "user1", 0 )    /* starfield data */
781   ROM_LOAD( "b_11j.rom",    0x0000, 0x8000, CRC(134dc35b) SHA1(6360c1efa7c4e1d6d817a97ca43dd4af8ed6afe5) )
782
783   ROM_REGION( 0x04000, "gfx1", 0 )
784   ROM_LOAD( "a_10j.rom",    0x00000, 0x4000, CRC(651fef75) SHA1(9c821a2ee30c222987f0d4192133776490d6a4e0) ) /* characters */
785
786   ROM_REGION( 0x40000, "gfx2", 0 )
787   ROM_LOAD( "b_13d.rom",    0x00000, 0x8000, CRC(3c59afe1) SHA1(5459a5795cf13012674993aa55bbd39e9a5c2f1b) ) /* tiles */
788   ROM_LOAD( "b_13e.rom",    0x08000, 0x8000, CRC(64bc3b77) SHA1(54fe6f258fda509a92eb0f5aa238102efce729e0) )
789   ROM_LOAD( "b_13f.rom",    0x10000, 0x8000, CRC(e6bcea6f) SHA1(19477e284967beafc4e7cd0d0da3534eb6dec388) )
790   ROM_LOAD( "b_13g.rom",    0x18000, 0x8000, CRC(c71a3053) SHA1(963e105aa0b0174e8aa5e1f7676c5c604ca72d1c) )
791   ROM_LOAD( "b_14d.rom",    0x20000, 0x8000, CRC(826e8a97) SHA1(ad5ed9a81805dde54fb2703345b2ab7b56853ec6) )
792   ROM_LOAD( "b_14e.rom",    0x28000, 0x8000, CRC(6cfc02a4) SHA1(491e880e85d5256fa2eea6d0fb402f0a1176b675) )
793   ROM_LOAD( "b_14f.rom",    0x30000, 0x8000, CRC(9b9f6730) SHA1(0f8fe5dc32ee50ebb2051c0c0c4d635582416317) )
794   ROM_LOAD( "b_14g.rom",    0x38000, 0x8000, CRC(ef6af630) SHA1(499b17eeb5e7256ede477510b0547df520316996) )
795
796   ROM_REGION( 0x40000, "gfx3", 0 )
797   ROM_LOAD( "b_11b.rom",    0x00000, 0x8000, CRC(eb6f278c) SHA1(15e250aa98ee69ac3983d4511976c35833b37cab) ) /* sprites */
798   ROM_LOAD( "b_13b.rom",    0x08000, 0x8000, CRC(e91b4014) SHA1(6557344ce8bc05309ab8ebe846871ed554b256b8) )
799   ROM_LOAD( "b_11a.rom",    0x10000, 0x8000, CRC(2822c522) SHA1(00b3cab899e5ac1af6300f2ec2a54303df9ab014) )
800   ROM_LOAD( "b_13a.rom",    0x18000, 0x8000, CRC(3e8a9f75) SHA1(b1bfb7604791950aa0454b68b24f6ad3b9131be8) )
801   ROM_LOAD( "b_12b.rom",    0x20000, 0x8000, CRC(86e43eda) SHA1(c33b0ab6f7f0f886410a3943988b737d175635be) )
802   ROM_LOAD( "b_14b.rom",    0x28000, 0x8000, CRC(076e92d1) SHA1(27144834b5b2849be8c46e97aaaeaa8b304ea810) )
803   ROM_LOAD( "b_12a.rom",    0x30000, 0x8000, CRC(ce107f3c) SHA1(2235281449247cb2446b008b36077788c5b15026) )
804   ROM_LOAD( "b_14a.rom",    0x38000, 0x8000, CRC(dba06076) SHA1(87b3b3437bc4bd727ce7e34dd914e6fe23bcac3d) )
805
806   ROM_REGION( 0x08000, "gfx4", 0 )    /* background tilemaps */
807   ROM_LOAD( "b_03d.rom",    0x0000, 0x8000, CRC(6f348008) SHA1(b500bc32ba47e9cc9dcf2254b9455ac4d61992db) )
808
809   ROM_REGION( 0x0320, "proms", 0 )
810   ROM_LOAD( "63s141.16h",   0x0000, 0x0100, CRC(75af3553) SHA1(14da009592877a6097b34ea844fa897ceda7465e) )    // timing
811   ROM_LOAD( "63s141.11h",   0x0100, 0x0100, CRC(a6e4d68f) SHA1(b9367e0c959cdf0397d33a49d778a66a407572b7) )    // color mixing
812   ROM_LOAD( "63s141.15h",   0x0200, 0x0100, CRC(c47c182a) SHA1(47d6139256e6838f633a04084bd0a7a84912f7fb) )    // timing
813   ROM_LOAD( "63s081.3j",    0x0300, 0x0020, CRC(c5817816) SHA1(cc642daafa0bcb160ee04e74e2d168fd44087608) )    // unknown
814ROM_END
815
816ROM_START( sidearmsur1 )
817   ROM_REGION( 0x20000, "maincpu", 0 )     /* 64k for code + banked ROMs images */
773818   ROM_LOAD( "03",           0x00000, 0x08000, CRC(9a799c45) SHA1(cf6836108506929ee2449546a4867a7cbf00bcc8) )        /* CODE */
774819   ROM_LOAD( "a_14e.rom",    0x10000, 0x08000, CRC(4925ed03) SHA1(b11dbd9889db89cff008ca21beb6b1b70d983e16) )        /* 0+1 */
775820   ROM_LOAD( "a_12e.rom",    0x18000, 0x08000, CRC(81d0ece7) SHA1(5c1d154f9c1de6b5f5d7abf5d413e9c493461e6f) )        /* 2+3 */
r243410r243411
11061151   m_gameid = 3;
11071152}
11081153
1109GAME( 1986, sidearms, 0,        sidearms, sidearms, sidearms_state, sidearms, ROT0,   "Capcom", "Side Arms - Hyper Dyne (World)", GAME_IMPERFECT_GRAPHICS )
1110GAME( 1986, sidearmsr,sidearms, sidearms, sidearms, sidearms_state, sidearms, ROT0,   "Capcom (Romstar license)", "Side Arms - Hyper Dyne (US)", GAME_IMPERFECT_GRAPHICS )
1111GAME( 1986, sidearmsj,sidearms, sidearms, sidearms, sidearms_state, sidearms, ROT0,   "Capcom", "Side Arms - Hyper Dyne (Japan)", GAME_IMPERFECT_GRAPHICS )
1112GAME( 1988, turtship, 0,        turtship, turtship, sidearms_state, turtship, ROT0,   "Philko (Sharp Image license)", "Turtle Ship (North America)", 0 )
1154// date string is at 0xaa2 in 'rom 03' it does not appear to be displayed
1155
1156GAME( 1986, sidearms,   0,        sidearms, sidearms, sidearms_state, sidearms, ROT0,   "Capcom",                   "Side Arms - Hyper Dyne (World, 861129)", GAME_IMPERFECT_GRAPHICS )
1157GAME( 1986, sidearmsu,  sidearms, sidearms, sidearms, sidearms_state, sidearms, ROT0,   "Capcom (Romstar license)", "Side Arms - Hyper Dyne (US, 861202)", GAME_IMPERFECT_GRAPHICS )
1158GAME( 1986, sidearmsur1,sidearms, sidearms, sidearms, sidearms_state, sidearms, ROT0,   "Capcom (Romstar license)", "Side Arms - Hyper Dyne (US, 861128)", GAME_IMPERFECT_GRAPHICS )
1159GAME( 1986, sidearmsj,  sidearms, sidearms, sidearms, sidearms_state, sidearms, ROT0,   "Capcom",                   "Side Arms - Hyper Dyne (Japan, 861128)", GAME_IMPERFECT_GRAPHICS )
1160
1161GAME( 1988, turtship, 0,        turtship, turtship, sidearms_state, turtship, ROT0,   "Philko (Sharp Image license)",   "Turtle Ship (North America)", 0 )
11131162GAME( 1988, turtshipj,turtship, turtship, turtship, sidearms_state, turtship, ROT0,   "Philko (Pacific Games license)", "Turtle Ship (Japan)", 0 )
1114GAME( 1988, turtshipk,turtship, turtship, turtship, sidearms_state, turtship, ROT0,   "Philko", "Turtle Ship (Korea)", 0 )
1163GAME( 1988, turtshipk,turtship, turtship, turtship, sidearms_state, turtship, ROT0,   "Philko",                         "Turtle Ship (Korea)", 0 )
1164
11151165GAME( 1989, dyger,    0,        turtship, dyger, sidearms_state,    dyger,    ROT270, "Philko", "Dyger (Korea set 1)", 0 )
11161166GAME( 1989, dygera,   dyger,    turtship, dyger, sidearms_state,    dyger,    ROT270, "Philko", "Dyger (Korea set 2)", 0 )
1167
11171168GAME( 1989, twinfalc, 0,        whizz,    whizz, sidearms_state,    whizz,    ROT0,   "Philko (Poara Enterprises license)", "Twin Falcons", 0 )
1118GAME( 1989, whizz,    twinfalc, whizz,    whizz, sidearms_state,    whizz,    ROT0,   "Philko", "Whizz", 0 )
1169GAME( 1989, whizz,    twinfalc, whizz,    whizz, sidearms_state,    whizz,    ROT0,   "Philko",                             "Whizz", 0 )
trunk/src/mame/drivers/silvmil.c
r243410r243411
287287   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_COIN2 )
288288   PORT_BIT( 0xfc00, IP_ACTIVE_LOW, IPT_UNKNOWN )
289289
290   PORT_START("DSW")
291   PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW2:1")
292   PORT_DIPSETTING(      0x0001, DEF_STR( Off ) )
293   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
294   PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW2:2")
295   PORT_DIPSETTING(      0x0002, DEF_STR( Off ) )
296   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
297   PORT_DIPNAME( 0x0004, 0x0004, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW2:3")
298   PORT_DIPSETTING(      0x0004, DEF_STR( Off ) )
299   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
300   PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW2:4")
301   PORT_DIPSETTING(      0x0008, DEF_STR( Off ) )
302   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
303   PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW2:5")
304   PORT_DIPSETTING(      0x0010, DEF_STR( Off ) )
305   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
306   PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW2:6")
307   PORT_DIPSETTING(      0x0020, DEF_STR( Off ) )
308   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
309   PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW2:7")
310   PORT_DIPSETTING(      0x0040, DEF_STR( Off ) )
311   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
312   PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW2:8")
313   PORT_DIPSETTING(      0x0080, DEF_STR( Off ) )
314   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
315   PORT_DIPNAME( 0x0300, 0x0300, "Game Level" )      PORT_DIPLOCATION("SW1:1,2") /* Difficulty?? - Not sure how this works for Easy --> Very Hard */
316   PORT_DIPSETTING(      0x0300, "1" ) /* Initial start time 40 secs */
317   PORT_DIPSETTING(      0x0200, "2" ) /* Initial start time 30 secs - Other in game effects?? */
318   PORT_DIPSETTING(      0x0100, "3" ) /* Initial start time 30 secs - Other in game effects?? */
319   PORT_DIPSETTING(      0x0000, "4" ) /* Initial start time 30 secs - Other in game effects?? */
320   PORT_DIPNAME( 0x1c00, 0x1c00, DEF_STR( Coinage ) )      PORT_DIPLOCATION("SW1:3,4,5")
290   PORT_START("DSW") /* NOTE: In the service mode, the game reports the dipswitch banks in reverse. IE: SW1 is actually SW2 & SW2 is actually SW1 */
291   PORT_DIPUNUSED_DIPLOC( 0x0001, 0x0001, "SW1:1" ) /* Listed as "Unused" */
292   PORT_DIPUNUSED_DIPLOC( 0x0002, 0x0002, "SW1:2" ) /* Listed as "Unused" */
293   PORT_DIPUNUSED_DIPLOC( 0x0004, 0x0004, "SW1:3" ) /* Listed as "Unused" */
294   PORT_DIPUNUSED_DIPLOC( 0x0008, 0x0008, "SW1:4" ) /* Listed as "Unused" */
295   PORT_DIPUNUSED_DIPLOC( 0x0010, 0x0010, "SW1:5" ) /* Listed as "Unused" */
296   PORT_DIPUNUSED_DIPLOC( 0x0020, 0x0020, "SW1:6" ) /* Listed as "Unused" */
297   PORT_DIPUNUSED_DIPLOC( 0x0040, 0x0040, "SW1:7" ) /* Listed as "Unused" */
298   PORT_DIPUNUSED_DIPLOC( 0x0080, 0x0080, "SW1:8" ) /* Listed as "Unused" */
299   PORT_DIPNAME( 0x0300, 0x0100, DEF_STR( Difficulty ) )   PORT_DIPLOCATION("SW2:1,2")
300   PORT_DIPSETTING(      0x0300, DEF_STR( Very_Easy ) )       /* Initial start time 40 secs */
301   PORT_DIPSETTING(      0x0200, DEF_STR( Easy ) )            /* Initial start time 30 secs - Other in game effects?? */
302   PORT_DIPSETTING(      0x0100, DEF_STR( Hard ) )            /* Initial start time 30 secs - Other in game effects?? */
303   PORT_DIPSETTING(      0x0000, DEF_STR( Very_Hard ) )       /* Initial start time 30 secs - Other in game effects?? */
304   PORT_DIPNAME( 0x1c00, 0x1c00, DEF_STR( Coinage ) )   PORT_DIPLOCATION("SW2:3,4,5")
321305   PORT_DIPSETTING(      0x1000, DEF_STR( 4C_1C ) )
322306   PORT_DIPSETTING(      0x1400, DEF_STR( 3C_1C ) )
323307   PORT_DIPSETTING(      0x0000, DEF_STR( 4C_2C ) ) /* Works the same as 2C/1C */
r243410r243411
326310   PORT_DIPSETTING(      0x0800, DEF_STR( 2C_2C ) ) /* Works the same as 1C/1C */
327311   PORT_DIPSETTING(      0x1c00, DEF_STR( 1C_1C ) )
328312   PORT_DIPSETTING(      0x0c00, DEF_STR( 1C_2C ) )
329   PORT_DIPNAME( 0x2000, 0x2000, "Coin Box" )      PORT_DIPLOCATION("SW1:6") /* Always displays total credits - No separate Credit display per player */
313   PORT_DIPNAME( 0x2000, 0x2000, "Coin Box" )      PORT_DIPLOCATION("SW2:6") /* Always displays total credits - No separate Credit display per player */
330314   PORT_DIPSETTING(      0x2000, "1" ) /* Both players use coins from either Coin 1 or Coin 2 */
331315   PORT_DIPSETTING(      0x0000, "2" ) /* Players use coins from own coin chute. IE: Player 1 -> Coin 1, Player 2 -> Coin 2 but shows only total credits */
332   PORT_DIPNAME( 0x4000, 0x4000, DEF_STR( Lives ) )      PORT_DIPLOCATION("SW1:7")
316   PORT_DIPNAME( 0x4000, 0x4000, DEF_STR( Lives ) )      PORT_DIPLOCATION("SW2:7")
333317   PORT_DIPSETTING(      0x0000, "2" )
334318   PORT_DIPSETTING(      0x4000, "3" )
335   PORT_SERVICE_DIPLOC(  0x8000, IP_ACTIVE_LOW, "SW1:8" ) /* Verified */
319   PORT_SERVICE_DIPLOC(  0x8000, IP_ACTIVE_LOW, "SW2:8" ) /* Verified */
336320INPUT_PORTS_END
337321
338322
trunk/src/mame/drivers/toki.c
r243410r243411
4242#include "sound/3812intf.h"
4343#include "includes/toki.h"
4444
45WRITE16_MEMBER(toki_state::tokib_soundcommand16_w)
45WRITE16_MEMBER(toki_state::tokib_soundcommand_w)
4646{
4747   soundlatch_byte_w(space, 0, data & 0xff);
4848   m_audiocpu->set_input_line(0, HOLD_LINE);
4949}
5050
51READ16_MEMBER(toki_state::pip16_r)
51READ16_MEMBER(toki_state::pip_r)
5252{
5353   return ~0;
5454}
5555
5656
5757
58WRITE_LINE_MEMBER(toki_state::toki_adpcm_int)
58WRITE_LINE_MEMBER(toki_state::tokib_adpcm_int)
5959{
6060   m_msm->data_w(m_msm5205next);
6161   m_msm5205next >>= 4;
r243410r243411
6565      m_audiocpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE);
6666}
6767
68WRITE8_MEMBER(toki_state::toki_adpcm_control_w)
68WRITE8_MEMBER(toki_state::tokib_adpcm_control_w)
6969{
7070   int bankaddress;
7171   UINT8 *RAM = memregion("audiocpu")->base();
r243410r243411
7878   m_msm->reset_w(data & 0x08);
7979}
8080
81WRITE8_MEMBER(toki_state::toki_adpcm_data_w)
81WRITE8_MEMBER(toki_state::tokib_adpcm_data_w)
8282{
8383   m_msm5205next = data;
8484}
r243410r243411
114114   AM_RANGE(0x071804, 0x071807) AM_WRITENOP    /* sprite related, always 01be0100 */
115115   AM_RANGE(0x07180e, 0x071e45) AM_WRITEONLY AM_SHARE("spriteram")
116116   AM_RANGE(0x072000, 0x072001) AM_READ(watchdog_reset16_r)   /* probably */
117   AM_RANGE(0x075000, 0x075001) AM_WRITE(tokib_soundcommand16_w)
117   AM_RANGE(0x075000, 0x075001) AM_WRITE(tokib_soundcommand_w)
118118   AM_RANGE(0x075004, 0x07500b) AM_WRITEONLY AM_SHARE("scrollram")
119119   AM_RANGE(0x0c0000, 0x0c0001) AM_READ_PORT("DSW")
120120   AM_RANGE(0x0c0002, 0x0c0003) AM_READ_PORT("INPUTS")
121121   AM_RANGE(0x0c0004, 0x0c0005) AM_READ_PORT("SYSTEM")
122   AM_RANGE(0x0c000e, 0x0c000f) AM_READ(pip16_r)  /* sound related, if we return 0 the code writes */
122   AM_RANGE(0x0c000e, 0x0c000f) AM_READ(pip_r)  /* sound related, if we return 0 the code writes */
123123            /* the sound command quickly followed by 0 and the */
124124            /* sound CPU often misses the command. */
125125ADDRESS_MAP_END
r243410r243411
129129static ADDRESS_MAP_START( tokib_audio_map, AS_PROGRAM, 8, toki_state )
130130   AM_RANGE(0x0000, 0x7fff) AM_ROM
131131   AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1")
132   AM_RANGE(0xe000, 0xe000) AM_WRITE(toki_adpcm_control_w) /* MSM5205 + ROM bank */
133   AM_RANGE(0xe400, 0xe400) AM_WRITE(toki_adpcm_data_w)
132   AM_RANGE(0xe000, 0xe000) AM_WRITE(tokib_adpcm_control_w) /* MSM5205 + ROM bank */
133   AM_RANGE(0xe400, 0xe400) AM_WRITE(tokib_adpcm_data_w)
134134   AM_RANGE(0xec00, 0xec01) AM_MIRROR(0x0008) AM_DEVREADWRITE("ymsnd", ym3812_device, read, write)
135135   AM_RANGE(0xf000, 0xf7ff) AM_RAM
136136   AM_RANGE(0xf800, 0xf800) AM_READ(soundlatch_byte_r)
r243410r243411
463463   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
464464
465465   MCFG_SOUND_ADD("msm", MSM5205, 384000)
466   MCFG_MSM5205_VCLK_CB(WRITELINE(toki_state, toki_adpcm_int)) /* interrupt function */
466   MCFG_MSM5205_VCLK_CB(WRITELINE(toki_state, tokib_adpcm_int)) /* interrupt function */
467467   MCFG_MSM5205_PRESCALER_SELECTOR(MSM5205_S96_4B)  /* 4KHz               */
468468   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.60)
469469MACHINE_CONFIG_END
trunk/src/mame/includes/toki.h
r243410r243411
4141   tilemap_t *m_foreground_layer;
4242   tilemap_t *m_text_layer;
4343
44   DECLARE_WRITE16_MEMBER(tokib_soundcommand16_w);
45   DECLARE_READ16_MEMBER(pip16_r);
44   DECLARE_WRITE16_MEMBER(tokib_soundcommand_w);
45   DECLARE_READ16_MEMBER(pip_r);
4646   DECLARE_WRITE16_MEMBER(toki_control_w);
4747   DECLARE_WRITE16_MEMBER(foreground_videoram_w);
4848   DECLARE_WRITE16_MEMBER(background1_videoram_w);
4949   DECLARE_WRITE16_MEMBER(background2_videoram_w);
50   DECLARE_WRITE8_MEMBER(toki_adpcm_control_w);
51   DECLARE_WRITE8_MEMBER(toki_adpcm_data_w);
52   DECLARE_WRITE_LINE_MEMBER(toki_adpcm_int);
50   DECLARE_WRITE8_MEMBER(tokib_adpcm_control_w);
51   DECLARE_WRITE8_MEMBER(tokib_adpcm_data_w);
52   DECLARE_WRITE_LINE_MEMBER(tokib_adpcm_int);
5353
5454   DECLARE_DRIVER_INIT(tokib);
5555   DECLARE_DRIVER_INIT(jujuba);
trunk/src/mame/machine/315-5838_317-0229_comp.c
r243410r243411
3939//#define DEBUG_DATA_DUMP
4040
4141sega_315_5838_comp_device::sega_315_5838_comp_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
42   : device_t(mconfig, SEGA315_5838_COMP, "Sega 315-5838 / 317-0029 Compression (Encryption?)", tag, owner, clock, "SEGA315_5838", __FILE__)
42   : device_t(mconfig, SEGA315_5838_COMP, "Sega 315-5838 / 317-0029 Compression (Encryption?)", tag, owner, clock, "sega315_5838", __FILE__)
4343{
4444}
4545
trunk/src/mame/machine/315-5881_crypt.c
r243410r243411
1919
2020
2121sega_315_5881_crypt_device::sega_315_5881_crypt_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
22   : device_t(mconfig, SEGA315_5881_CRYPT, "Sega 315-5881 Encryption", tag, owner, clock, "SEGA315_5881", __FILE__)
22   : device_t(mconfig, SEGA315_5881_CRYPT, "Sega 315-5881 Encryption", tag, owner, clock, "sega315_5881", __FILE__)
2323{
2424}
2525
trunk/src/mame/machine/315_5296.c
r243410r243411
3030//-------------------------------------------------
3131
3232sega_315_5296_device::sega_315_5296_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
33   : device_t(mconfig, SEGA_315_5296, "Sega 315-5296 I/O", tag, owner, clock, "315-5296", __FILE__),
33   : device_t(mconfig, SEGA_315_5296, "Sega 315-5296 I/O", tag, owner, clock, "315_5296", __FILE__),
3434   m_in_pa_cb(*this),
3535   m_in_pb_cb(*this),
3636   m_in_pc_cb(*this),
trunk/src/mame/mame.lst
r243410r243411
30223022lwingsj         // 11/1986 (c) 1986
30233023lwingsb         // 11/1986 (c) 1986 (bootleg)
30243024sidearms        // 12/1986 (c) 1986 (World)
3025sidearmsr       // 12/1986 (c) 1986 + Romstar license (US)
3025sidearmsu       // 12/1986 (c) 1986 + Romstar license (US)
3026sidearmsur1     // 12/1986 (c) 1986 + Romstar license (US)
30263027sidearmsj       // 12/1986 (c) 1986 (Japan)
30273028turtship        // (c) 1988 Philco (NOT A CAPCOM GAME but runs on modified Sidearms hardware)
30283029turtshipj       // (c) 1988 Philco (NOT A CAPCOM GAME but runs on modified Sidearms hardware)
r243410r243411
1121111212peps0043        // (c) 1996 IGT - International Game Technology
1121211213peps0045        // (c) 1996 IGT - International Game Technology
1121311214peps0047        // (c) 1996 IGT - International Game Technology
11215peps0090        // (c) 1996 IGT - International Game Technology
1121411216peps0092        // (c) 1996 IGT - International Game Technology
1121511217peps0206        // (c) 1996 IGT - International Game Technology
1121611218peps0207        // (c) 1996 IGT - International Game Technology
trunk/src/mess/drivers/atm.c
r243410r243411
141141   if (m_beta->started())
142142   {
143143      m_beta->enable();
144      m_beta->clear_status();
145144   }
146145   space.set_direct_update_handler(direct_update_delegate(FUNC(atm_state::atm_direct), this));
147146
trunk/src/mess/drivers/hx20.c
r243410r243411
670670   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD )  PORT_CHAR('[') PORT_CHAR('{')
671671   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD )  PORT_CHAR(']') PORT_CHAR('}')
672672   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD )  PORT_CHAR('\\') PORT_CHAR('|')
673   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_LEFT" "UTF8_UP) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT))
674   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_RIGHT" "UTF8_DOWN) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT))
673   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_LEFT" " UTF8_UP) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT))
674   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_RIGHT" " UTF8_DOWN) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT))
675675   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PAPER FEED")
676676   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1)
677677   PORT_BIT( 0xfc00, IP_ACTIVE_LOW, IPT_UNUSED )
trunk/src/mess/drivers/indiana.c
r243410r243411
8585   MCFG_CPU_PROGRAM_MAP(indiana_mem)
8686
8787   MCFG_DEVICE_ADD(ISABUS_TAG, ISA16, 0)
88   MCFG_ISA16_CPU(":"M68K_TAG)
88   MCFG_ISA16_CPU(":" M68K_TAG)
8989   MCFG_ISA16_BUS_CUSTOM_SPACES()
9090   MCFG_ISA16_SLOT_ADD(ISABUS_TAG, "isa1", indiana_isa_cards, "vga", false)
9191   MCFG_ISA16_SLOT_ADD(ISABUS_TAG, "isa2", indiana_isa_cards, "fdc_at", false)
trunk/src/mess/drivers/kaypro.c
r243410r243411
99    telephone cord, complete with modular plug on each end. The keyboard carries
1010    its own Intel 87C51 processor and is an intelligent device.
1111
12    Things that need doing:
12    ToDo:
1313
1414    - See about getting keyboard to work as a serial device.
1515    - Need dump of 87C51 cpu in the keyboard.
1616
17    - Only kayproii boots up, the remainder have floppy-disk problems.
17    - Kaypro 2x, 4a: floppy not working "No operating system present on this disk"
18    - Kaypro 10: Boots from floppy, but B drive not working "Bdos Err on B: Bad Sector"
19    - Kaypro 4p88: works as a normal Kaypro 4, extra hardware not done
20    - Kaypro Robie: has twin 2.6MB 5.25 floppy drives which we don't support, no software available
1821
19    - The DSK format needs to be supported. It is commented out until the code gets written.
20
2122    - Hard Disk not emulated.
2223      The controller is a WD1002 (original version, for Winchester drives).
2324
r243410r243411
162163
163164************************************************************/
164165
165//FLOPPY_FORMATS_MEMBER( kaypro_state::kayproii_floppy_formats )
166//  FLOPPY_KAYPROII_FORMAT
167//FLOPPY_FORMATS_END
166FLOPPY_FORMATS_MEMBER( kaypro_state::kayproii_floppy_formats )
167   FLOPPY_KAYPROII_FORMAT
168FLOPPY_FORMATS_END
168169
169//FLOPPY_FORMATS_MEMBER( kaypro_state::kaypro2x_floppy_formats )
170//  FLOPPY_KAYPRO2X_FORMAT
171//FLOPPY_FORMATS_END
170FLOPPY_FORMATS_MEMBER( kaypro_state::kaypro2x_floppy_formats )
171   FLOPPY_KAYPRO2X_FORMAT
172FLOPPY_FORMATS_END
172173
173174static SLOT_INTERFACE_START( kaypro_floppies )
174   SLOT_INTERFACE( "525dd", FLOPPY_525_DD )
175   SLOT_INTERFACE( "drive0", FLOPPY_525_DD )
176   SLOT_INTERFACE( "drive1", FLOPPY_525_DD )
175177SLOT_INTERFACE_END
176178
177179
r243410r243411
180182   MCFG_CPU_ADD("maincpu", Z80, XTAL_20MHz / 8)
181183   MCFG_CPU_PROGRAM_MAP(kaypro_map)
182184   MCFG_CPU_IO_MAP(kayproii_io)
183   MCFG_CPU_VBLANK_INT_DRIVER("screen", kaypro_state, kay_kbd_interrupt)  /* this doesn't actually exist, it is to run the keyboard */
185   MCFG_CPU_VBLANK_INT_DRIVER("screen", kaypro_state, kay_kbd_interrupt)  /* this doesn't actually exist, it is to run the keyboard */
184186   MCFG_CPU_CONFIG(kayproii_daisy_chain)
185187
186188   MCFG_MACHINE_START_OVERRIDE(kaypro_state, kayproii )
r243410r243411
230232   MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(kaypro_state, fdc_intrq_w))
231233   MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(kaypro_state, fdc_drq_w))
232234   MCFG_WD_FDC_FORCE_READY
233   //MCFG_FLOPPY_DRIVE_ADD("fdc:0", kaypro_floppies, "525dd", kaypro_state::kayproii_floppy_formats)
234   //MCFG_FLOPPY_DRIVE_ADD("fdc:1", kaypro_floppies, "525dd", kaypro_state::kayproii_floppy_formats)
235   MCFG_FLOPPY_DRIVE_ADD("fdc:0", kaypro_floppies, "525dd", floppy_image_device::default_floppy_formats)
236   MCFG_FLOPPY_DRIVE_ADD("fdc:1", kaypro_floppies, "525dd", floppy_image_device::default_floppy_formats)
235   MCFG_FLOPPY_DRIVE_ADD("fdc:0", kaypro_floppies, "drive0", kaypro_state::kayproii_floppy_formats)
236   MCFG_FLOPPY_DRIVE_ADD("fdc:1", kaypro_floppies, "drive1", kaypro_state::kayproii_floppy_formats)
237237   MCFG_SOFTWARE_LIST_ADD("flop_list","kayproii")
238238MACHINE_CONFIG_END
239239
r243410r243411
250250   MCFG_CPU_ADD("maincpu", Z80, XTAL_16MHz / 4)
251251   MCFG_CPU_PROGRAM_MAP(kaypro_map)
252252   MCFG_CPU_IO_MAP(kaypro2x_io)
253   MCFG_CPU_VBLANK_INT_DRIVER("screen", kaypro_state, kay_kbd_interrupt)
253   MCFG_CPU_VBLANK_INT_DRIVER("screen", kaypro_state, kay_kbd_interrupt)
254254   MCFG_CPU_CONFIG(kaypro2x_daisy_chain)
255255
256256   MCFG_MACHINE_RESET_OVERRIDE(kaypro_state, kaypro )
r243410r243411
266266
267267   MCFG_GFXDECODE_ADD("gfxdecode", "palette", kaypro2x)
268268   MCFG_PALETTE_ADD("palette", 3)
269   MCFG_PALETTE_INIT_OWNER(kaypro_state,kaypro)
269   MCFG_PALETTE_INIT_OWNER(kaypro_state, kaypro)
270270
271271   /* sound hardware */
272272   MCFG_SPEAKER_STANDARD_MONO("mono")
r243410r243411
295295   MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(kaypro_state, fdc_intrq_w))
296296   MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(kaypro_state, fdc_drq_w))
297297   MCFG_WD_FDC_FORCE_READY
298   //MCFG_FLOPPY_DRIVE_ADD("fdc:0", kaypro_floppies, "525dd", kaypro_state::kaypro2x_floppy_formats)
299   //MCFG_FLOPPY_DRIVE_ADD("fdc:1", kaypro_floppies, "525dd", kaypro_state::kaypro2x_floppy_formats)
300   MCFG_FLOPPY_DRIVE_ADD("fdc:0", kaypro_floppies, "525dd", floppy_image_device::default_floppy_formats)
301   MCFG_FLOPPY_DRIVE_ADD("fdc:1", kaypro_floppies, "525dd", floppy_image_device::default_floppy_formats)
298   MCFG_FLOPPY_DRIVE_ADD("fdc:0", kaypro_floppies, "drive0", kaypro_state::kaypro2x_floppy_formats)
299   MCFG_FLOPPY_DRIVE_ADD("fdc:1", kaypro_floppies, "drive1", kaypro_state::kaypro2x_floppy_formats)
302300MACHINE_CONFIG_END
303301
304302static MACHINE_CONFIG_DERIVED( omni2, kaypro4 )
r243410r243411
431429
432430/*    YEAR  NAME      PARENT    COMPAT  MACHINE   INPUT    CLASS         INIT         COMPANY                 FULLNAME */
433431COMP( 1982, kayproii,   0,        0,    kayproii, kay_kbd, kaypro_state, kaypro, "Non Linear Systems",  "Kaypro II - 2/83" , 0 )
434COMP( 1983, kaypro4,    kayproii, 0,    kaypro4,  kay_kbd, kaypro_state, kaypro, "Non Linear Systems",  "Kaypro 4 - 4/83" , GAME_NOT_WORKING ) // model 81-004
432COMP( 1983, kaypro4,    kayproii, 0,    kaypro4,  kay_kbd, kaypro_state, kaypro, "Non Linear Systems",  "Kaypro 4 - 4/83" , 0 ) // model 81-004
435433COMP( 1983, kaypro4p88, kayproii, 0,    kaypro4,  kay_kbd, kaypro_state, kaypro, "Non Linear Systems",  "Kaypro 4 plus88 - 4/83" , GAME_NOT_WORKING ) // model 81-004 with an added 8088 daughterboard and rom
436COMP( 198?, omni2,      kayproii, 0,    omni2,    kay_kbd, kaypro_state, kaypro, "Non Linear Systems",  "Omni II" , GAME_NOT_WORKING )
434COMP( 198?, omni2,      kayproii, 0,    omni2,    kay_kbd, kaypro_state, kaypro, "Non Linear Systems",  "Omni II Logic Analyzer" , 0 )
437435COMP( 1984, kaypro2x,   0,        0,    kaypro2x, kay_kbd, kaypro_state, kaypro, "Non Linear Systems",  "Kaypro 2x" , GAME_NOT_WORKING ) // model 81-025
438436COMP( 1984, kaypro4a,   kaypro2x, 0,    kaypro2x, kay_kbd, kaypro_state, kaypro, "Non Linear Systems",  "Kaypro 4 - 4/84" , GAME_NOT_WORKING ) // model 81-015
439437// Kaypro 4/84 plus 88 goes here, model 81-015 with an added 8088 daughterboard and rom
trunk/src/mess/drivers/pc9801.c
r243410r243411
1313    - Finish DIP-Switches support
1414    - text scrolling
1515    - GRCG+
16    - EGC
1716    - rewrite using slot devices
1817    - some later SWs put "Invalid command byte 05" (Absolutely Mahjong on Epson logo)
1918    - investigate on POR bit
r243410r243411
7877    - Armored Flagship Atragon: needs HDD install
7978    - Arquephos: needs extra sound board(s)?
8079    - Asoko no Koufuku: black screen with BGM, waits at 0x225f6;
81    - Aura Battler Dumbine: upd7220: unimplemented FIGD, has layer clearance bugs on gameplay;
8280    - Band-Kun: (how to run this without installing?)
8381    - Battle Chess: wants some dip-switches to be on in DSW4, too slow during IA thinking?
8482    - Bishoujo Audition: Moans with a "(program) ended. remove the floppy disk and turn off the poewr."
r243410r243411
106104    - Uchiyama Aki no Chou Bangai: keyboard irq is fussy (sometimes it doesn't register a key press);
107105    - Uno: uses EGC
108106    - Viper V16 Demo: moans with a JP message;
107    - Windows 2: EGC drawing issue (byte wide writes?)
109108
110109    per-game TODO (PC-9821):
111110    - Battle Skin Panic: gfx bugs at the Gainax logo, it crashes after it;
r243410r243411
115114    - Animahjong V3 makes advantage of the possibility of installing 2 sound boards, where SFX and BGMs are played on separate chips.
116115    - Apple Club 1/2 needs data disks to load properly;
117116    - Beast Lord: needs a titan.fnt, in MS-DOS
117    - To deprotect BASIC modules set 0xcd7 in ram to 0
118118
119119========================================================================================
120120
r243410r243411
550550      INT16 count;
551551      UINT16 leftover[4];
552552      bool first;
553      bool init;
553554   } m_egc;
554555
555556   /* PC9821 specific */
r243410r243411
588589   DECLARE_WRITE16_MEMBER(upd7220_grcg_w);
589590   void egc_blit_w(UINT32 offset, UINT16 data, UINT16 mem_mask);
590591   UINT16 egc_blit_r(UINT32 offset, UINT16 mem_mask);
591   inline UINT16 egc_do_partial_op(int plane, UINT16 src, UINT16 pat, UINT16 dst);
592592   UINT32 pc9801_286_a20(bool state);
593593
594594   DECLARE_READ8_MEMBER(ide_hack_r);
r243410r243411
670670private:
671671   UINT8 m_sdip_read(UINT16 port, UINT8 sdip_offset);
672672   void m_sdip_write(UINT16 port, UINT8 sdip_offset,UINT8 data);
673   UINT16 egc_do_partial_op(int plane, UINT16 src, UINT16 pat, UINT16 dst);
674   UINT16 egc_shift(int plane, UINT16 val);
673675public:
674676   DECLARE_MACHINE_START(pc9801_common);
675677   DECLARE_MACHINE_START(pc9801f);
r243410r243411
13301332   m_video_ram_2[(offset>>1)+0x04000+m_vram_bank*0x10000] = (ram & (0xff00 >> mask)) | (data << mask);
13311333}
13321334
1333inline UINT16 pc9801_state::egc_do_partial_op(int plane, UINT16 src, UINT16 pat, UINT16 dst)
1335UINT16 pc9801_state::egc_shift(int plane, UINT16 val)
13341336{
1335   UINT16 out = 0;
1336   int src_off, dst_off;
1337   UINT16 src_tmp = src;
1338
1337   int src_off = m_egc.regs[6] & 0xf, dst_off = (m_egc.regs[6] >> 4) & 0xf;
1338   int left = src_off - dst_off, right = dst_off - src_off;
1339   UINT16 out;
13391340   if(m_egc.regs[6] & 0x1000)
13401341   {
1341      src_off = 15 - (m_egc.regs[6] & 0xf);
1342      dst_off = 15 - ((m_egc.regs[6] >> 4) & 0xf);
1342      if(right >= 0)
1343      {
1344         out = (val >> right) | m_egc.leftover[plane];
1345         m_egc.leftover[plane] = val << (16 - right);
1346      }
1347      else
1348      {
1349         out = (val >> (16 - left)) | m_egc.leftover[plane];
1350         m_egc.leftover[plane] = val << left;
1351      }
13431352   }
13441353   else
13451354   {
1346      src_off = m_egc.regs[6] & 0xf;
1347      dst_off = (m_egc.regs[6] >> 4) & 0xf;
1355      if(right >= 0)
1356      {
1357         out = (val << right) | m_egc.leftover[plane];
1358         m_egc.leftover[plane] = val >> (16 - right);
1359      }
1360      else
1361      {
1362         out = (val << (16 - left)) | m_egc.leftover[plane];
1363         m_egc.leftover[plane] = val >> left;
1364      }
13481365   }
1366   return out;
1367}
13491368
1350   if(src_off < dst_off)
1351   {
1352      src = src_tmp << (dst_off - src_off);
1353      src |= m_egc.leftover[plane];
1354      m_egc.leftover[plane] = src_tmp >> (16 - (dst_off - src_off));
1355   }
1356   else
1357   {
1358      src = src_tmp >> (src_off - dst_off);
1359      src |= m_egc.leftover[plane];
1360      m_egc.leftover[plane] = src_tmp << (16 - (src_off - dst_off));
1361   }
1369UINT16 pc9801_state::egc_do_partial_op(int plane, UINT16 src, UINT16 pat, UINT16 dst)
1370{
1371   UINT16 out = 0;
13621372
13631373   for(int i = 7; i >= 0; i--)
13641374   {
r243410r243411
13751385{
13761386   UINT16 mask = m_egc.regs[4] & mem_mask, out = 0;
13771387   bool dir = !(m_egc.regs[6] & 0x1000);
1378   int dst_off = (m_egc.regs[6] >> 4) & 0xf;
1388   int dst_off = (m_egc.regs[6] >> 4) & 0xf, src_off = m_egc.regs[6] & 0xf;
13791389   offset &= 0x13fff;
13801390
1381   if((((m_egc.regs[2] >> 11) & 3) == 1) || ((((m_egc.regs[2] >> 11) & 3) == 2) && !BIT(m_egc.regs[2], 10)))
1391   if(!m_egc.init && (src_off > dst_off))
13821392   {
1383      UINT16 end_mask = 0xffff, start_mask = 0xffff;
1384      // mask off the bits before the start
1385      if(m_egc.first)
1393      if(BIT(m_egc.regs[2], 10))
13861394      {
13871395         m_egc.leftover[0] = m_egc.leftover[1] = m_egc.leftover[2] = m_egc.leftover[3] = 0;
1388         start_mask = dir ? ~((1 << dst_off) - 1) : ((1 << (15 - dst_off)) - 1);
1396         egc_shift(0, data);
1397         // leftover[0] is inited above, set others to same
1398         m_egc.leftover[1] = m_egc.leftover[2] = m_egc.leftover[3] = m_egc.leftover[0];
13891399      }
1400      m_egc.init = true;
1401      return;
1402   }
13901403
1391      // mask off the bits past the end of the blit
1392      if(m_egc.count < 16)
1404   // mask off the bits before the start
1405   if(m_egc.first)
1406   {
1407      mask &= dir ? ~((1 << dst_off) - 1) : ((1 << (dst_off + 1)) - 1);
1408      if(!m_egc.init)
1409         m_egc.leftover[0] = m_egc.leftover[1] = m_egc.leftover[2] = m_egc.leftover[3] = 0;
1410   }
1411
1412   // mask off the bits past the end of the blit
1413   if(m_egc.count < 16)
1414   {
1415      UINT16 end_mask = dir ? ((1 << m_egc.count) - 1) : ~((1 << (16 - m_egc.count)) - 1);
1416      // if the blit is less than 16 bits, adjust the masks
1417      if(m_egc.first)
13931418      {
1394         end_mask = dir ? ((1 << m_egc.count) - 1) : ~((1 << (16 - m_egc.count)) - 1);
1395         // if the blit is less than 16 bits, adjust the masks
1396         if(start_mask != 0xffff)
1397         {
1398            if(dir)
1399               end_mask <<= dst_off;
1400            else
1401               end_mask >>= (15 - dst_off);
1402         }
1419         if(dir)
1420            end_mask <<= dst_off;
1421         else
1422            end_mask >>= dst_off;
14031423      }
1404      mask &= end_mask & start_mask;
1424      mask &= end_mask;
14051425   }
14061426
14071427   for(int i = 0; i < 4; i++)
r243410r243411
14101430      {
14111431         UINT16 src = m_egc.src[i] & mem_mask, pat = m_egc.pat[i];
14121432         if(BIT(m_egc.regs[2], 10))
1413            src = data;
1433            src = egc_shift(i, data);
14141434
14151435         if((m_egc.regs[2] & 0x300) == 0x200)
14161436            pat = m_video_ram_2[offset + (((i + 1) & 3) * 0x4000)];
r243410r243411
14421462   }
14431463   if(mem_mask != 0xffff)
14441464   {
1445      dst_off &= 7;
14461465      if(m_egc.first)
1447         m_egc.count -= dir ? 8 - dst_off : (dst_off + 1);
1466         m_egc.count -= 8 - (dst_off & 7);
14481467      else
14491468         m_egc.count -= 8;
14501469   }
14511470   else
14521471   {
14531472      if(m_egc.first)
1454         m_egc.count -= dir ? 16 - dst_off : (dst_off + 1);
1473         m_egc.count -= 16 - dst_off;
14551474      else
14561475         m_egc.count -= 16;
14571476   }
r243410r243411
14611480   if(m_egc.count <= 0)
14621481   {
14631482      m_egc.first = true;
1483      m_egc.init = false;
14641484      m_egc.count = (m_egc.regs[7] & 0xfff) + 1;
14651485   }
14661486}
r243410r243411
14751495      m_egc.pat[2] = m_video_ram_2[plane_off + (0x4000 * 3)];
14761496      m_egc.pat[3] = m_video_ram_2[plane_off];
14771497   }
1478   if(!BIT(m_egc.regs[2], 10))
1479   {
1480      m_egc.src[0] = m_video_ram_2[plane_off + 0x4000];
1481      m_egc.src[1] = m_video_ram_2[plane_off + (0x4000 * 2)];
1482      m_egc.src[2] = m_video_ram_2[plane_off + (0x4000 * 3)];
1483      m_egc.src[3] = m_video_ram_2[plane_off];
1484   }
1498   for(int i = 0; i < 4; i++)
1499      m_egc.src[i] = egc_shift(i, m_video_ram_2[plane_off + (((i + 1) & 3) * 0x4000)]);
1500
14851501   if(BIT(m_egc.regs[2], 13))
14861502      return m_video_ram_2[offset];
14871503   else
1488      return m_video_ram_2[plane_off + (((m_egc.regs[1] >> 8) + 1) & 3) * 0x4000];
1504      return m_egc.src[(m_egc.regs[1] >> 8) & 3];
14891505}
14901506
14911507READ16_MEMBER(pc9801_state::upd7220_grcg_r)
r243410r243411
19061922      case 7:
19071923         m_egc.count = (m_egc.regs[7] & 0xfff) + 1;
19081924         m_egc.first = true;
1925         m_egc.init = false;
19091926         break;
19101927   }
19111928}
r243410r243411
29692986   save_item(NAME(m_sasi_data));
29702987   save_item(NAME(m_sasi_data_enable));
29712988   save_item(NAME(m_sasi_ctrl));
2989   save_item(NAME(m_vrtc_irq_mask));
29722990}
29732991
29742992MACHINE_START_MEMBER(pc9801_state,pc9801f)
trunk/src/mess/drivers/pentagon.c
r243410r243411
186186   {
187187      if (strcmp(machine().system().name, "pent1024")==0)
188188         m_beta->enable();
189      m_beta->clear_status();
190189   }
191190   space.set_direct_update_handler(direct_update_delegate(FUNC(pentagon_state::pentagon_direct), this));
192191
trunk/src/mess/drivers/pt68k4.c
r243410r243411
402402   MCFG_FLOPPY_DRIVE_ADD(WDFDC_TAG":1", pt68k_floppies, "525dd", pt68k4_state::floppy_formats)
403403
404404   MCFG_DEVICE_ADD(ISABUS_TAG, ISA8, 0)
405   MCFG_ISA8_CPU(":"M68K_TAG)
405   MCFG_ISA8_CPU(":" M68K_TAG)
406406   MCFG_ISA8_BUS_CUSTOM_SPACES()
407407   MCFG_ISA_OUT_IRQ5_CB(WRITELINE(pt68k4_state, irq5_w))
408408   MCFG_ISA8_SLOT_ADD(ISABUS_TAG, "isa1", pt68k4_isa8_cards, "cga", false)
r243410r243411
439439   MCFG_M48T02_ADD(TIMEKEEPER_TAG)
440440
441441   MCFG_DEVICE_ADD(ISABUS_TAG, ISA8, 0)
442   MCFG_ISA8_CPU(":"M68K_TAG)
442   MCFG_ISA8_CPU(":" M68K_TAG)
443443   MCFG_ISA8_BUS_CUSTOM_SPACES()
444444   MCFG_ISA8_SLOT_ADD(ISABUS_TAG, "isa1", pt68k4_isa8_cards, "fdc_at", false)
445445   MCFG_ISA8_SLOT_ADD(ISABUS_TAG, "isa2", pt68k4_isa8_cards, "cga", false)
trunk/src/mess/drivers/scorpion.c
r243410r243411
336336   space.install_write_handler(0x0000, 0x3fff, write8_delegate(FUNC(scorpion_state::scorpion_0000_w),this));
337337
338338   m_beta->disable();
339   m_beta->clear_status();
340339   space.set_direct_update_handler(direct_update_delegate(FUNC(scorpion_state::scorpion_direct), this));
341340
342341   memset(messram,0,256*1024);
trunk/src/mess/drivers/ti74.c
r243410r243411
301301   PORT_START("IN.0")
302302   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') PORT_NAME("m  M  Frac")
303303   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') PORT_NAME("k  K  Frq")
304   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') PORT_NAME("i  I  "UTF8_SQUAREROOT"x")
305   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) PORT_NAME(UTF8_LEFT"     "UTF8_LEFT)
304   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') PORT_NAME("i  I  " UTF8_SQUAREROOT"x")
305   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) PORT_NAME(UTF8_LEFT"     " UTF8_LEFT)
306306   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED )
307   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') PORT_NAME("u  U  x"UTF8_POW_2)
307   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') PORT_NAME("u  U  x" UTF8_POW_2)
308308   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') PORT_NAME("j  J  nCr")
309309   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') PORT_NAME("n  N  Intg")
310310
r243410r243411
319319   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') PORT_NAME("b  B  EXC")
320320
321321   PORT_START("IN.2")
322   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') PORT_CHAR('\'') PORT_NAME("SPACE  '  "UTF8_CAPITAL_DELTA"%")
323   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') PORT_NAME(";  :  "UTF8_CAPITAL_SIGMA"+")
324   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') PORT_NAME("p  P  y"UTF8_POW_X)
322   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') PORT_CHAR('\'') PORT_NAME("SPACE  '  " UTF8_CAPITAL_DELTA"%")
323   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') PORT_NAME(";  :  " UTF8_CAPITAL_SIGMA"+")
324   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') PORT_NAME("p  P  y" UTF8_POW_X)
325325   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) PORT_CHAR('(') PORT_NAME(UTF8_UP"  (")
326326   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED )
327327   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') PORT_NAME("t  T  ln(x)")
r243410r243411
334334   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(END)) PORT_NAME("CLR  UCL  CE/C")
335335   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) PORT_CHAR(')') PORT_NAME(UTF8_DOWN"  )")
336336   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) PORT_NAME("RUN     x<>y")
337   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') PORT_NAME("r  R  "UTF8_SMALL_PI)
337   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') PORT_NAME("r  R  " UTF8_SMALL_PI)
338338   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') PORT_NAME("f  F  P>R")
339339   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') PORT_NAME("c  C  RCL")
340340
341341   PORT_START("IN.4")
342342   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('~') PORT_CHAR('?') PORT_NAME("+/-  ?  CSR")
343343   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1_PAD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') PORT_NAME("1  !  r")
344   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4_PAD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') PORT_NAME("4  $  "UTF8_CAPITAL_SIGMA"x")
345   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7_PAD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR(UCHAR_MAMEKEY(DEL)) PORT_NAME("7  DEL  "UTF8_CAPITAL_SIGMA"x"UTF8_POW_2)
344   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4_PAD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') PORT_NAME("4  $  " UTF8_CAPITAL_SIGMA"x")
345   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7_PAD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR(UCHAR_MAMEKEY(DEL)) PORT_NAME("7  DEL  " UTF8_CAPITAL_SIGMA"x" UTF8_POW_2)
346346   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(PAUSE)) PORT_NAME("BREAK")
347347   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') PORT_NAME("e  E  tan")
348348   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') PORT_NAME("d  D  DRG>")
349349   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') PORT_NAME("x  X  STO")
350350
351351   PORT_START("IN.5")
352   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0_PAD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('<') PORT_NAME("0  <  x"UTF8_PRIME)
352   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0_PAD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('<') PORT_NAME("0  <  x" UTF8_PRIME)
353353   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2_PAD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') PORT_NAME("2  \"  a")
354   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5_PAD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('&') PORT_NAME("5  &  "UTF8_CAPITAL_SIGMA"y")
355   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8_PAD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR(UCHAR_MAMEKEY(INSERT)) PORT_NAME("8  INS  "UTF8_CAPITAL_SIGMA"y"UTF8_POW_2)
354   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5_PAD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('&') PORT_NAME("5  &  " UTF8_CAPITAL_SIGMA"y")
355   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8_PAD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR(UCHAR_MAMEKEY(INSERT)) PORT_NAME("8  INS  " UTF8_CAPITAL_SIGMA"y" UTF8_POW_2)
356356   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGUP) PORT_CHAR(UCHAR_MAMEKEY(PGUP)) PORT_NAME("MODE")
357357   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') PORT_NAME("w  W  cos")
358358   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') PORT_NAME("s  S  DRG")
359359   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') PORT_NAME("z  Z  PRINT")
360360
361361   PORT_START("IN.6")
362   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR('.') PORT_CHAR('>') PORT_NAME(".  >  y"UTF8_PRIME) // 2 on the keyboard, same scancode
362   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR('.') PORT_CHAR('>') PORT_NAME(".  >  y" UTF8_PRIME) // 2 on the keyboard, same scancode
363363   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3_PAD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') PORT_NAME("3  #  b")
364364   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6_PAD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') PORT_NAME("6  ^  n")
365   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9_PAD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_NAME("9  PB  "UTF8_CAPITAL_SIGMA"xy")
365   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9_PAD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_NAME("9  PB  " UTF8_CAPITAL_SIGMA"xy")
366366   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGDN) PORT_CHAR(UCHAR_MAMEKEY(PGDN)) PORT_NAME("OFF")
367367   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') PORT_NAME("q  Q  sin")
368368   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') PORT_NAME("a  A  DMS>DD")
r243410r243411
371371   PORT_START("IN.7")
372372   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) PORT_NAME("+     s(y)")
373373   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS_PAD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_NAME("-     s(x)")
374   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR(UCHAR_MAMEKEY(ASTERISK)) PORT_NAME("*     y"UTF8_NONSPACE_MACRON)
375   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH_PAD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR(UCHAR_MAMEKEY(SLASH_PAD)) PORT_NAME("/     x"UTF8_NONSPACE_MACRON)
374   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR(UCHAR_MAMEKEY(ASTERISK)) PORT_NAME("*     y" UTF8_NONSPACE_MACRON)
375   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH_PAD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR(UCHAR_MAMEKEY(SLASH_PAD)) PORT_NAME("/     x" UTF8_NONSPACE_MACRON)
376376   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED )
377377   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_MAMEKEY(F1)) PORT_NAME("FN     hyp")
378378   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_SHIFT_2) PORT_NAME("CTL     STAT")
r243410r243411
425425   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_NAME("CONV  V")
426426   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_HOME) PORT_NAME("OLD  NOP")
427427   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9_PAD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_NAME("9  >  x!")
428   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR(UCHAR_MAMEKEY(ASTERISK)) PORT_NAME(UTF8_MULTIPLY"  ^  "UTF8_SMALL_PI)
428   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR(UCHAR_MAMEKEY(ASTERISK)) PORT_NAME(UTF8_MULTIPLY"  ^  " UTF8_SMALL_PI)
429429   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8_PAD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_NAME("8  <  nCr")
430430
431431   PORT_START("IN.4")
r243410r243411
441441   PORT_START("IN.5")
442442   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F4) PORT_NAME("F4")
443443   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_NAME("INCR  Y  CH")
444   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_NAME("x"UTF8_POW_2"  H")
444   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_NAME("x" UTF8_POW_2"  H")
445445   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_NAME("FLAGS  N")
446446   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LEFT) PORT_NAME(UTF8_LEFT"  DEL")
447447   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_NAME("RCL  O  FH")
r243410r243411
454454   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_NAME(UTF8_SQUAREROOT"x  J")
455455   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_NAME("TESTS  M")
456456   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RIGHT) PORT_NAME(UTF8_RIGHT"  INS")
457   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_NAME("y"UTF8_POW_X"  L")
457   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_NAME("y" UTF8_POW_X"  L")
458458   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_NAME("2nd")
459459   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4_PAD) PORT_CODE(KEYCODE_4) PORT_CHAR('4' )PORT_NAME("4     IND")
460460
trunk/src/mess/drivers/ticalc1x.c
r243410r243411
340340   PORT_START("IN.6") // R6
341341   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED )
342342   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_NAME("1/x")
343   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_NAME("y"UTF8_POW_X)
343   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_NAME("y" UTF8_POW_X)
344344   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("6")
345345
346346   PORT_START("IN.7") // R7
347347   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED )
348   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_NAME("x"UTF8_POW_2)
348   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_NAME("x" UTF8_POW_2)
349349   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED )
350350   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("7")
351351
352352   PORT_START("IN.8") // R8
353353   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED )
354   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_NAME("10"UTF8_POW_X)
355   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_NAME("e"UTF8_POW_X)
354   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_NAME("10" UTF8_POW_X)
355   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_NAME("e" UTF8_POW_X)
356356   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_8_PAD) PORT_NAME("8")
357357
358358   PORT_START("IN.9") // R9
r243410r243411
405405
406406   PORT_START("IN.6") // O7
407407   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_NAME("1/x")
408   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_NAME("x"UTF8_POW_2)
408   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_NAME("x" UTF8_POW_2)
409409   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_NAME(UTF8_SQUAREROOT"x")
410410   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_NAME("+/-")
411411INPUT_PORTS_END
r243410r243411
440440
441441static INPUT_PORTS_START( ti30 )
442442   PORT_START("IN.0") // O0
443   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_NAME("y"UTF8_POW_X)
443   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_NAME("y" UTF8_POW_X)
444444   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_NAME("K")
445445   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_NAME("log")
446   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TILDE) PORT_NAME("EE"UTF8_DOWN)
446   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TILDE) PORT_NAME("EE" UTF8_DOWN)
447447   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_NAME("ln(x)")
448448
449449   PORT_START("IN.1") // O1
r243410r243411
496496   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGUP) PORT_CODE(KEYCODE_DEL) PORT_NAME("ON/C") PORT_CHANGED_MEMBER(DEVICE_SELF, ticalc1x_state, power_button, (void *)true)
497497   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_NAME("1/x")
498498   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_NAME(UTF8_SQUAREROOT"x")
499   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_NAME("x"UTF8_POW_2)
499   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_NAME("x" UTF8_POW_2)
500500   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGDN) PORT_NAME("OFF") PORT_CHANGED_MEMBER(DEVICE_SELF, ticalc1x_state, power_button, (void *)false)
501501INPUT_PORTS_END
502502
r243410r243411
567567static INPUT_PORTS_START( tibusan1 )
568568   // PORT_NAME lists functions under [2nd] as secondaries.
569569   PORT_START("IN.0") // O0
570   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_NAME("y"UTF8_POW_X"  "UTF8_POW_X""UTF8_SQUAREROOT"y") // 2nd one implies xth root of y
571   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_NAME("%  "UTF8_CAPITAL_DELTA"%")
570   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_NAME("y" UTF8_POW_X"  " UTF8_POW_X"" UTF8_SQUAREROOT"y") // 2nd one implies xth root of y
571   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_NAME("%  " UTF8_CAPITAL_DELTA"%")
572572   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_NAME("SEL")
573573   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_NAME("CST")
574574   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_NAME("MAR")
r243410r243411
592592
593593   PORT_START("IN.4") // O4
594594   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH_PAD) PORT_NAME(UTF8_DIVIDE)
595   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_NAME(UTF8_CAPITAL_SIGMA"+  "UTF8_CAPITAL_SIGMA"-")
595   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_NAME(UTF8_CAPITAL_SIGMA"+  " UTF8_CAPITAL_SIGMA"-")
596596   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_NAME("(  AN-CI\"")
597597   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_NAME("x<>y  L.R.")
598598   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_NAME(")  1/x")
599599
600600   PORT_START("IN.5") // O5
601601   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PLUS_PAD) PORT_NAME("+")
602   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_NAME("SUM  x"UTF8_PRIME)
602   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_NAME("SUM  x" UTF8_PRIME)
603603   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("2")
604604   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("1")
605605   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("3")
r243410r243411
613613
614614   PORT_START("IN.7") // O7
615615   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_ENTER_PAD) PORT_NAME("=")
616   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_NAME("EXC  x"UTF8_PRIME)
616   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_NAME("EXC  x" UTF8_PRIME)
617617   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CODE(KEYCODE_DEL_PAD) PORT_NAME(".")
618618   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_0_PAD) PORT_NAME("0")
619619   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_NAME("+/-")
r243410r243411
622622   PORT_START("IN.8") // Vss!
623623   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGUP) PORT_CODE(KEYCODE_DEL) PORT_NAME("ON/C") PORT_CHANGED_MEMBER(DEVICE_SELF, ticalc1x_state, power_button, (void *)true)
624624   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_NAME("2nd")
625   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_NAME("x"UTF8_POW_2"  "UTF8_SQUAREROOT"x")
626   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_NAME("ln(x)  e"UTF8_POW_X)
625   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_NAME("x" UTF8_POW_2"  " UTF8_SQUAREROOT"x")
626   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_NAME("ln(x)  e" UTF8_POW_X)
627627   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGDN) PORT_NAME("OFF") PORT_CHANGED_MEMBER(DEVICE_SELF, ticalc1x_state, power_button, (void *)false)
628628INPUT_PORTS_END
629629
trunk/src/mess/includes/kaypro.h
r243410r243411
2121   };
2222
2323   kaypro_state(const machine_config &mconfig, device_type type, const char *tag)
24      : driver_device(mconfig, type, tag),
25      m_maincpu(*this, "maincpu"),
26      m_pio_g(*this, "z80pio_g"),
27      m_pio_s(*this, "z80pio_s"),
28      m_sio(*this, "z80sio"),
29      m_sio2x(*this, "z80sio_2x"),
30      m_centronics(*this, "centronics"),
31      m_fdc(*this, "fdc"),
32      m_floppy0(*this, "fdc:0"),
33      m_floppy1(*this, "fdc:1"),
34      m_crtc(*this, "crtc"),
35      m_beep(*this, "beeper"),
36      m_palette(*this, "palette")
24      : driver_device(mconfig, type, tag)
25      , m_palette(*this, "palette")
26      , m_maincpu(*this, "maincpu")
27      , m_pio_g(*this, "z80pio_g")
28      , m_pio_s(*this, "z80pio_s")
29      , m_sio(*this, "z80sio")
30      , m_sio2x(*this, "z80sio_2x")
31      , m_centronics(*this, "centronics")
32      , m_fdc(*this, "fdc")
33      , m_floppy0(*this, "fdc:0")
34      , m_floppy1(*this, "fdc:1")
35      , m_crtc(*this, "crtc")
36      , m_beep(*this, "beeper")
3737   {}
3838
3939   DECLARE_WRITE_LINE_MEMBER(write_centronics_busy);
r243410r243411
6565   UINT32 screen_update_kaypro2x(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
6666   UINT32 screen_update_omni2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
6767   INTERRUPT_GEN_MEMBER(kay_kbd_interrupt);
68   DECLARE_WRITE_LINE_MEMBER(kaypro_interrupt);
6968   DECLARE_READ8_MEMBER(kaypro_sio_r);
7069   DECLARE_WRITE8_MEMBER(kaypro_sio_w);
7170   MC6845_UPDATE_ROW(kaypro2x_update_row);
r243410r243411
7877   UINT8 *m_p_videoram;
7978   kay_kbd_t *m_kbd;
8079   int m_centronics_busy;
80   required_device<palette_device> m_palette;
8181
82protected:
83   virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
84
8582private:
83   bool m_is_motor_off;
84   UINT8 m_fdc_rq;
8685   UINT8 m_system_port;
8786   UINT16 m_mc6845_video_address;
8887   floppy_image_device *m_floppy;
8988   void mc6845_cursor_configure();
9089   void mc6845_screen_configure();
90   virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
9191   required_device<cpu_device> m_maincpu;
9292   optional_device<z80pio_device> m_pio_g;
9393   optional_device<z80pio_device> m_pio_s;
r243410r243411
9999   required_device<floppy_connector> m_floppy1;
100100   optional_device<mc6845_device> m_crtc;
101101   required_device<beep_device> m_beep;
102public:
103   required_device<palette_device> m_palette;
104102};
105103
106104
trunk/src/mess/machine/apollo.c
r243410r243411
922922   MCFG_APOLLO_SIO_IRQ_CALLBACK(WRITELINE(apollo_state, sio2_irq_handler))
923923
924924   MCFG_DEVICE_ADD(APOLLO_ISA_TAG, ISA16, 0)
925   MCFG_ISA16_CPU(":"MAINCPU)
925   MCFG_ISA16_CPU(":" MAINCPU)
926926   MCFG_ISA16_BUS_CUSTOM_SPACES()
927927   MCFG_ISA_OUT_IRQ2_CB(DEVWRITELINE(APOLLO_PIC2_TAG, pic8259_device, ir2_w)) // in place of irq 2 on at irq 9 is used
928928   MCFG_ISA_OUT_IRQ3_CB(DEVWRITELINE(APOLLO_PIC1_TAG, pic8259_device, ir3_w))
trunk/src/mess/machine/beta.c
r243410r243411
1414
1515*/
1616#include "emu.h"
17#include "imagedev/flopdrv.h"
1817#include "formats/trd_dsk.h"
1918#include "machine/beta.h"
2019
r243410r243411
2726const device_type BETA_DISK = &device_creator<beta_disk_device>;
2827
2928beta_disk_device::beta_disk_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
30   : device_t(mconfig, BETA_DISK, "Beta Disk Interface", tag, owner, clock, "betadisk", __FILE__),
31   m_betadisk_status(0),
32   m_betadisk_active(0)
29   : device_t(mconfig, BETA_DISK, "Beta Disk Interface", tag, owner, clock, "betadisk", __FILE__)
30   , m_betadisk_active(0)
31   , m_wd179x(*this, "wd179x")
32   , m_floppy0(*this, "wd179x:0")
33   , m_floppy1(*this, "wd179x:1")
34   , m_floppy2(*this, "wd179x:2")
35   , m_floppy3(*this, "wd179x:3")
3336{
3437}
3538
r243410r243411
3942
4043void beta_disk_device::device_start()
4144{
42   astring tempstring;
43
44   /* validate arguments */
45   assert(tag() != NULL);
46
47   /* find our WD179x */
48   tempstring.printf("%s:%s", tag(), "wd179x");
49   m_wd179x = machine().device<wd2793_device>(tempstring);
5045}
5146
5247//-------------------------------------------------
r243410r243411
7267   m_betadisk_active = 0;
7368}
7469
75void beta_disk_device::clear_status()
76{
77   m_betadisk_status = 0;
78}
79
80WRITE_LINE_MEMBER(beta_disk_device::wd179x_intrq_w)
81{
82   if (state)
83      m_betadisk_status |= (1<<7);
84   else
85      m_betadisk_status &=~(1<<7);
86}
87
88WRITE_LINE_MEMBER(beta_disk_device::wd179x_drq_w)
89{
90   if (state)
91      m_betadisk_status |= (1<<6);
92   else
93      m_betadisk_status &=~(1<<6);
94}
95
9670READ8_MEMBER(beta_disk_device::status_r)
9771{
9872   if (m_betadisk_active==1) {
99      return m_wd179x->status_r(space, offset);
73      return m_wd179x->status_r(space, 0);
10074   } else {
10175      return 0xff;
10276   }
r243410r243411
10579READ8_MEMBER(beta_disk_device::track_r)
10680{
10781   if (m_betadisk_active==1) {
108      return m_wd179x->track_r(space, offset);
82      return m_wd179x->track_r(space, 0);
10983   } else {
11084      return 0xff;
11185   }
r243410r243411
11488READ8_MEMBER(beta_disk_device::sector_r)
11589{
11690   if (m_betadisk_active==1) {
117      return m_wd179x->sector_r(space, offset);
91      return m_wd179x->sector_r(space, 0);
11892   } else {
11993      return 0xff;
12094   }
r243410r243411
12397READ8_MEMBER(beta_disk_device::data_r)
12498{
12599   if (m_betadisk_active==1) {
126      return m_wd179x->data_r(space, offset);
100      return m_wd179x->data_r(space, 0);
127101   } else {
128102      return 0xff;
129103   }
r243410r243411
132106READ8_MEMBER(beta_disk_device::state_r)
133107{
134108   if (m_betadisk_active==1) {
135      return m_betadisk_status;
109      UINT8 result = 0x3F;      // actually open bus
110      result |= m_wd179x->drq_r() ? 0x40 : 0;
111      result |= m_wd179x->intrq_r() ? 0x80 : 0;
112      return result;
136113   } else {
137114      return 0xff;
138115   }
r243410r243411
140117
141118WRITE8_MEMBER(beta_disk_device::param_w)
142119{
143   const char *floppy_tags[4] = { FLOPPY_0, FLOPPY_1, FLOPPY_2, FLOPPY_3 };
144
145120   if (m_betadisk_active == 1)
146121   {
147      m_wd179x->set_drive(data & 3);
148      m_wd179x->set_side ((data & 0x10) ? 0 : 1 );
149      m_wd179x->dden_w(!BIT(data, 6));
150      if ((data & 0x04) == 0) // reset
151         m_wd179x->reset();
122      floppy_connector* connectors[] = { m_floppy0, m_floppy1, m_floppy2, m_floppy3 };
152123
153      // bit 3 connected to pin 23 "HRDY" of FDC
154      // TEMP HACK, FDD motor and RDY FDC pin controlled by HLD pin of FDC
155      legacy_floppy_image_device *flop = subdevice<legacy_floppy_image_device>(floppy_tags[data & 3]);
156      flop->floppy_mon_w(CLEAR_LINE);
157      flop->floppy_drive_set_ready_state(1, 0);
124      floppy_image_device* floppy = connectors[data & 3]->get_device();
125
126      m_wd179x->set_floppy(floppy);
127      floppy->ss_w(BIT(data, 4) ? 0 : 1);
128      m_wd179x->dden_w(BIT(data, 6));
129
130      // bit 3 connected to pin 23 "HLT" of FDC and via diode to INDEX
131      //m_wd179x->hlt_w(BIT(data, 3)); // not handled in current wd_fdc
132
133      if (BIT(data, 2) == 0) // reset
134      {
135         m_wd179x->reset();
136         floppy->mon_w(ASSERT_LINE);
137      } else {
138         // HACK, FDD motor and RDY FDC pin controlled by HLD pin of FDC
139         floppy->mon_w(CLEAR_LINE);
140      }
158141   }
159142}
160143
161144WRITE8_MEMBER(beta_disk_device::command_w)
162145{
163146   if (m_betadisk_active==1) {
164      m_wd179x->command_w(space, offset, data);
147      m_wd179x->cmd_w(space, 0, data);
165148   }
166149}
167150
168151WRITE8_MEMBER(beta_disk_device::track_w)
169152{
170153   if (m_betadisk_active==1) {
171      m_wd179x->track_w(space, offset, data);
154      m_wd179x->track_w(space, 0, data);
172155   }
173156}
174157
175158WRITE8_MEMBER(beta_disk_device::sector_w)
176159{
177160   if (m_betadisk_active==1) {
178      m_wd179x->sector_w(space, offset, data);
161      m_wd179x->sector_w(space, 0, data);
179162   }
180163}
181164
182165WRITE8_MEMBER(beta_disk_device::data_w)
183166{
184167   if (m_betadisk_active==1) {
185      m_wd179x->data_w(space, offset, data);
168      m_wd179x->data_w(space, 0, data);
186169   }
187170}
188171
189static const floppy_interface beta_floppy_interface =
190{
191   FLOPPY_STANDARD_5_25_DSDD,
192   LEGACY_FLOPPY_OPTIONS_NAME(trd),
193   NULL
194};
172FLOPPY_FORMATS_MEMBER(beta_disk_device::floppy_formats)
173   FLOPPY_TRD_FORMAT
174FLOPPY_FORMATS_END
195175
196static MACHINE_CONFIG_FRAGMENT( beta_disk )
197   MCFG_DEVICE_ADD("wd179x", WD2793, 0) // KR1818VG93 clone of WD1793
198   MCFG_WD17XX_DEFAULT_DRIVE4_TAGS
199   MCFG_WD17XX_INTRQ_CALLBACK(WRITELINE(beta_disk_device, wd179x_intrq_w))
200   MCFG_WD17XX_DRQ_CALLBACK(WRITELINE(beta_disk_device, wd179x_drq_w))
176static SLOT_INTERFACE_START( beta_disk_floppies )
177   SLOT_INTERFACE( "drive0", FLOPPY_525_QD )
178   SLOT_INTERFACE( "drive1", FLOPPY_525_QD )
179   SLOT_INTERFACE( "drive2", FLOPPY_525_QD )
180   SLOT_INTERFACE( "drive3", FLOPPY_525_QD )
181SLOT_INTERFACE_END
201182
202   MCFG_LEGACY_FLOPPY_4_DRIVES_ADD(beta_floppy_interface)
183static MACHINE_CONFIG_FRAGMENT( beta_disk )
184   MCFG_WD2793x_ADD("wd179x", XTAL_8MHz / 8)   // KR1818VG93 clone of WD1793
185   MCFG_FLOPPY_DRIVE_ADD("wd179x:0", beta_disk_floppies, "drive0", beta_disk_device::floppy_formats)
186   MCFG_FLOPPY_DRIVE_ADD("wd179x:1", beta_disk_floppies, "drive1", beta_disk_device::floppy_formats)
187   MCFG_FLOPPY_DRIVE_ADD("wd179x:2", beta_disk_floppies, "drive2", beta_disk_device::floppy_formats)
188   MCFG_FLOPPY_DRIVE_ADD("wd179x:3", beta_disk_floppies, "drive3", beta_disk_device::floppy_formats)
203189MACHINE_CONFIG_END
204190
205191ROM_START( beta_disk )
trunk/src/mess/machine/beta.h
r243410r243411
1010#ifndef __BETA_H__
1111#define __BETA_H__
1212
13#include "machine/wd17xx.h"
13#include "machine/wd_fdc.h"
1414
1515
1616#define BETA_DISK_TAG   "beta"
r243410r243411
3232   DECLARE_WRITE8_MEMBER(track_w);
3333   DECLARE_WRITE8_MEMBER(sector_w);
3434   DECLARE_WRITE8_MEMBER(data_w);
35   DECLARE_FLOPPY_FORMATS(floppy_formats);
3536
36   DECLARE_WRITE_LINE_MEMBER(wd179x_intrq_w);
37   DECLARE_WRITE_LINE_MEMBER(wd179x_drq_w);
38
3937   int is_active();
4038   void enable();
4139   void disable();
42   void clear_status();
4340
44   UINT8 m_betadisk_status;
4541   UINT8 m_betadisk_active;
4642
4743protected:
r243410r243411
5248   virtual machine_config_constructor device_mconfig_additions() const;
5349
5450private:
55   // internal state
56   wd2793_device *m_wd179x;
51   required_device<wd2793_t> m_wd179x;
52   required_device<floppy_connector> m_floppy0;
53   required_device<floppy_connector> m_floppy1;
54   required_device<floppy_connector> m_floppy2;
55   required_device<floppy_connector> m_floppy3;
5756};
5857
5958extern const device_type BETA_DISK;
trunk/src/mess/machine/kaypro.c
r243410r243411
1313
1414************************************************************/
1515
16WRITE_LINE_MEMBER(kaypro_state::kaypro_interrupt)
17{
18   m_maincpu->set_input_line(0, state);
19}
20
2116WRITE_LINE_MEMBER( kaypro_state::write_centronics_busy )
2217{
2318   m_centronics_busy = state;
r243410r243411
4843
4944   membank("bankr0")->set_entry(BIT(data, 7));
5045   membank("bank3")->set_entry(BIT(data, 7));
46   m_is_motor_off = BIT(data, 6);
5147
5248   m_floppy = NULL;
5349   if (BIT(data, 0))
r243410r243411
6258   if (m_floppy)
6359   {
6460      m_floppy->mon_w(BIT(data, 6)); // motor on
61      m_floppy->ss_w(!BIT(data, 2)); // signal exists even though drives are single sided
6562   }
6663
6764   output_set_value("ledA", BIT(data, 0));     /* LEDs in artwork */
r243410r243411
107104
108105   membank("bankr0")->set_entry(BIT(data, 7));
109106   membank("bank3")->set_entry(BIT(data, 7));
107   m_is_motor_off = !BIT(data, 4);
110108
111109   m_floppy = NULL;
112110   if (!BIT(data, 0))
r243410r243411
116114      m_floppy = m_floppy1->get_device();
117115
118116   m_fdc->set_floppy(m_floppy);
119   //m_fdc->dden_w(BIT(data, 5)); // not connected
117   m_fdc->dden_w(BIT(data, 5));
120118
121119   if (m_floppy)
122120   {
r243410r243411
195193
196194void kaypro_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
197195{
196   bool halt;
198197   switch (id)
199198   {
200199   case TIMER_FLOPPY:
201      if (m_maincpu->state_int(Z80_HALT))
200      halt = (bool)m_maincpu->state_int(Z80_HALT);
201      if (m_is_motor_off)
202      {
203         timer_set(attotime::from_hz(10), TIMER_FLOPPY);
204         break;
205      }
206      if ((halt) && (m_fdc_rq & 3) && (m_fdc_rq < 0x80))
207      {
202208         m_maincpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE);
209         m_fdc_rq |= 0x80;
210      }
211      else
212      if ((m_fdc_rq == 0x80) || ((!halt) && BIT(m_fdc_rq, 7)))
213      {
214         m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE);
215         m_fdc_rq &= 0x7f;
216      }
217      timer_set(attotime::from_hz(1e5), TIMER_FLOPPY);
218
203219      break;
204220   default:
205221      assert_always(FALSE, "Unknown id in kaypro_state::device_timer");
r243410r243411
208224
209225WRITE_LINE_MEMBER( kaypro_state::fdc_intrq_w )
210226{
211   if (state)
212      timer_set(attotime::zero, TIMER_FLOPPY);
213   else
214      m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE);
227   m_fdc_rq = (m_fdc_rq & 0x82) | state;
215228}
216229
217230WRITE_LINE_MEMBER( kaypro_state::fdc_drq_w )
218231{
219   if (state)
220      timer_set(attotime::zero, TIMER_FLOPPY);
221   else
222      m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE);
223
232   m_fdc_rq = (m_fdc_rq & 0x81) | (state << 1);
224233}
225234
226235
r243410r243411
241250   membank("bankw0")->set_entry(0); // always write to ram
242251   membank("bank3")->set_entry(1); // point at video ram
243252   m_system_port = 0x80;
253   m_fdc_rq = 0;
244254   m_maincpu->reset();
255   timer_set(attotime::from_hz(1), TIMER_FLOPPY);   /* kick-start the nmi timer */
245256}
246257
247258
trunk/src/mess/machine/pc1512kb.c
r243410r243411
170170   PORT_START("Y9")
171171   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Num Lock") PORT_CODE(KEYCODE_NUMLOCK) PORT_CHAR(UCHAR_MAMEKEY(NUMLOCK))
172172   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Break Scroll Lock") PORT_CODE(KEYCODE_SCRLOCK) PORT_CHAR(UCHAR_MAMEKEY(SCRLOCK))
173   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 8 "UTF8_UP) PORT_CODE(KEYCODE_8_PAD)
173   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 8 " UTF8_UP) PORT_CODE(KEYCODE_8_PAD)
174174   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 9 Pg Up") PORT_CODE(KEYCODE_9_PAD)
175   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 4 "UTF8_LEFT) PORT_CODE(KEYCODE_4_PAD)
175   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 4 " UTF8_LEFT) PORT_CODE(KEYCODE_4_PAD)
176176   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 5") PORT_CODE(KEYCODE_5_PAD)
177177   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 1 End") PORT_CODE(KEYCODE_1_PAD)
178   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 2 "UTF8_DOWN) PORT_CODE(KEYCODE_2_PAD)
178   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 2 " UTF8_DOWN) PORT_CODE(KEYCODE_2_PAD)
179179
180180   PORT_START("Y10")
181181   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad Enter") PORT_CODE(KEYCODE_ENTER_PAD)
182182   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )
183183   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad -") PORT_CODE(KEYCODE_MINUS_PAD)
184184   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED )
185   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 6 "UTF8_RIGHT) PORT_CODE(KEYCODE_6_PAD)
185   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 6 " UTF8_RIGHT) PORT_CODE(KEYCODE_6_PAD)
186186   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED )
187187   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 3 Pg Dn") PORT_CODE(KEYCODE_3_PAD)
188   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Del "UTF8_RIGHT) PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL))
188   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Del " UTF8_RIGHT) PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL))
189189
190190   PORT_START("Y11")
191191   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F9") PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F9))
trunk/src/mess/machine/victor9kb.c
r243410r243411
418418INPUT_PORTS_START( victor9k_keyboard )
419419   PORT_START("Y0")
420420   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CLR/HOME") PORT_CODE(KEYCODE_HOME) // S12
421   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_PLUSMINUS" "UTF8_DEGREES" "UTF8_SMALL_PI) PORT_CODE(KEYCODE_TILDE) // +-, degree, pi // S13
422   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_UP" SCRL "UTF8_DOWN) PORT_CODE(KEYCODE_SCRLOCK) // unicode arrows // S33
421   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_PLUSMINUS" " UTF8_DEGREES" " UTF8_SMALL_PI) PORT_CODE(KEYCODE_TILDE) // +-, degree, pi // S13
422   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_UP" SCRL " UTF8_DOWN) PORT_CODE(KEYCODE_SCRLOCK) // unicode arrows // S33
423423   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("TAB/BACK") PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) // S34
424424   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RVS On-Off/ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(27) // S54
425425   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LOCK/CAPSLOCK") PORT_CODE(KEYCODE_CAPSLOCK) // S55
r243410r243411
447447   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') // S80
448448
449449   PORT_START("Y3")
450   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("5 % "UTF8_UP) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') // S18
450   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("5 % " UTF8_UP) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') // S18
451451   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("6 \xc2\xa2 \xc2\xac") PORT_CODE(KEYCODE_6) PORT_CHAR('6') // cent U+00A2, logic not U+00AC // S19
452452   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') // S39
453453   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') // S40
r243410r243411
492492   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("UNUSED S47") // unused // S47
493493   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ERASE/EOL") PORT_CODE(KEYCODE_END) // should this be mapped to end or del? // S48
494494   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) // S68
495   //PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Word "UTF8_LEFT"/Volume Up \xf0\x9f\x94\x88\xe2\x96\xb4") PORT_CODE(KEYCODE_PGUP) // unicode U+2190/U+1F508 + U+25B4 // S69
496   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Word "UTF8_LEFT"/Volume Up") PORT_CODE(KEYCODE_PGUP) // unicode U+2190/U+1F508 + U+25B4 // S69
495   //PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Word " UTF8_LEFT"/Volume Up \xf0\x9f\x94\x88\xe2\x96\xb4") PORT_CODE(KEYCODE_PGUP) // unicode U+2190/U+1F508 + U+25B4 // S69
496   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Word " UTF8_LEFT"/Volume Up") PORT_CODE(KEYCODE_PGUP) // unicode U+2190/U+1F508 + U+25B4 // S69
497497   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_UP"/Brightness Up \xe2\x98\xbc\xe2\x96\xb4") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) // U+2191/U+263C + U+25B4 // S89
498498   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_DOWN"/Brightness Down \xe2\x98\xbc\xe2\x96\xbe") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) // U+2193/U+263C + U+25BE // S90
499499
r243410r243411
502502   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad MODE CALC/=") PORT_CODE(KEYCODE_NUMLOCK) // S29
503503   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("REQ/CAN") PORT_CODE(KEYCODE_BACKSLASH) // is this a good key for this? does sysrq make more sense? // S49
504504   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 7") PORT_CODE(KEYCODE_7_PAD) // S50
505   //PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Word "UTF8_RIGHT"/Volume Down \xf0\x9f\x94\x88\xe2\x96\xbe") PORT_CODE(KEYCODE_PGDN) // unicode U+2192/U+1F508 + U+25B4 // S70
506   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Word "UTF8_RIGHT"/Volume Down") PORT_CODE(KEYCODE_PGDN) // unicode U+2192/U+1F508 + U+25B4 // S70
505   //PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Word " UTF8_RIGHT"/Volume Down \xf0\x9f\x94\x88\xe2\x96\xbe") PORT_CODE(KEYCODE_PGDN) // unicode U+2192/U+1F508 + U+25B4 // S70
506   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Word " UTF8_RIGHT"/Volume Down") PORT_CODE(KEYCODE_PGDN) // unicode U+2192/U+1F508 + U+25B4 // S70
507507   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 4") PORT_CODE(KEYCODE_4_PAD) // S71
508508   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 1") PORT_CODE(KEYCODE_1_PAD) // S91
509509   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 2") PORT_CODE(KEYCODE_2_PAD) // S92
510510
511511   PORT_START("Y9")
512512   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad %") // find a good key for this // S30
513   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad "UTF8_DIVIDE) PORT_CODE(KEYCODE_SLASH_PAD) // unicode division sign U+00F7 // S31
513   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad " UTF8_DIVIDE) PORT_CODE(KEYCODE_SLASH_PAD) // unicode division sign U+00F7 // S31
514514   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 8") PORT_CODE(KEYCODE_8_PAD) // S51
515515   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 9") PORT_CODE(KEYCODE_9_PAD) // S52
516516   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 5") PORT_CODE(KEYCODE_5_PAD) // S72
r243410r243411
519519   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad Enter") PORT_CODE(KEYCODE_ENTER_PAD) // S94
520520
521521   PORT_START("YA")
522   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad "UTF8_MULTIPLY) PORT_CODE(KEYCODE_ASTERISK) // unicode multiply sign U+00D7 // S32
522   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad " UTF8_MULTIPLY) PORT_CODE(KEYCODE_ASTERISK) // unicode multiply sign U+00D7 // S32
523523   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F10 [10]") PORT_CODE(KEYCODE_F10) // S11
524524   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad -") PORT_CODE(KEYCODE_MINUS_PAD) // S53
525525   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F9 [9]") PORT_CODE(KEYCODE_F9) // S10
trunk/src/mess/machine/wangpckb.c
r243410r243411
284284   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad + *") PORT_CODE(KEYCODE_NUMLOCK) PORT_CHAR(UCHAR_MAMEKEY(NUMLOCK))// 60
285285   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad - !") PORT_CODE(KEYCODE_SLASH_PAD) PORT_CHAR(UCHAR_MAMEKEY(SLASH_PAD)) // 13
286286   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 8 >") PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) // 15
287   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 9 "UTF8_UP) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) // 16
287   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 9 " UTF8_UP) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) // 16
288288   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 5 ]") PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) // 40
289289   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 6 $") PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) // 17
290290   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 3 #") PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) // 10
trunk/src/mess/tools/imgtool/modules/ti990hd.c
r243410r243411
417417
418418#define symb2str2(a) #a
419419#define symb2str(a) symb2str2(a)
420#define ti990_create_optionspecs "B1-[145]-"symb2str(MAX_CYLINDERS)";C1-[4]-"symb2str(MAX_HEADS)";D1-[32]-"symb2str(MAX_SECTORS_PER_TRACK)";E"symb2str(MIN_SECTOR_SIZE)"-[256]-"symb2str(MAX_SECTOR_SIZE)";"
420#define ti990_create_optionspecs "B1-[145]-" symb2str(MAX_CYLINDERS)";C1-[4]-" symb2str(MAX_HEADS)";D1-[32]-" symb2str(MAX_SECTORS_PER_TRACK)";E" symb2str(MIN_SECTOR_SIZE)"-[256]-" symb2str(MAX_SECTOR_SIZE)";"
421421
422422void ti990_get_info(const imgtool_class *imgclass, UINT32 state, union imgtoolinfo *info)
423423{
trunk/src/osd/modules/sound/direct_sound.c
r243410r243411
279279   SDL_SysWMinfo wminfo;
280280   SDL_VERSION(&wminfo.version);
281281#if (SDLMAME_SDL2)
282   SDL_GetWindowWMInfo(sdl_window_list->m_sdl_window, &wminfo);
282   SDL_GetWindowWMInfo(sdl_window_list->sdl_window(), &wminfo);
283283   result = IDirectSound_SetCooperativeLevel(dsound, wminfo.info.win.window, DSSCL_PRIORITY);
284284#else
285285   SDL_GetWMInfo(&wminfo);
trunk/src/osd/sdl/draw13.c
r243410r243411
118118
119119private:
120120    Uint32              m_sdl_access;
121    SDL_Renderer *      m_renderer;
121    SDL_Renderer *      m_sdl_renderer;
122122    render_texinfo      m_texinfo;            // copy of the texture info
123123    HashT               m_hash;               // hash value for the texture (must be >= pointer size)
124124    UINT32              m_flags;              // rendering flags
r243410r243411
143143{
144144public:
145145    sdl_info13(sdl_window_info *w)
146    : osd_renderer(w), m_blittimer(0), m_renderer(NULL),
146    : osd_renderer(w, FLAG_NONE), m_blittimer(0), m_sdl_renderer(NULL),
147147      m_last_hofs(0), m_last_vofs(0),
148      m_resize_pending(0), m_resize_width(0), m_resize_height(0),
148      m_last_width(0), m_last_height(0),
149149      m_last_blit_time(0), m_last_blit_pixels(0)
150150    {}
151151
152   /* virtual */ int create(int width, int height);
153   /* virtual */ void resize(int width, int height);
154   /* virtual */ int draw(UINT32 dc, int update);
155   /* virtual */ void set_target_bounds();
156   /* virtual */ int xy_to_render_target(int x, int y, int *xt, int *yt);
152   /* virtual */ int create();
153   /* virtual */ int draw(const UINT32 dc, const int update);
154   /* virtual */ int xy_to_render_target(const int x, const int y, int *xt, int *yt);
157155   /* virtual */ void destroy_all_textures();
158156   /* virtual */ void destroy();
159157   /* virtual */ void clear();
r243410r243411
164162    texture_info *texture_update(const render_primitive &prim);
165163
166164   INT32           m_blittimer;
167   UINT32          m_extra_flags;
168165
169   SDL_Renderer *  m_renderer;
166#if (SDLMAME_SDL2)
167   SDL_GLContext   m_gl_context_id;
168#else
169   // SDL surface
170   SDL_Surface         *m_sdlsurf;
171#endif
172
173   SDL_Renderer *  m_sdl_renderer;
170174   simple_list<texture_info>  m_texlist;                // list of active textures
171175
172176   float           m_last_hofs;
173177   float           m_last_vofs;
174178
175   // resize information
179   int            m_last_width;
180   int            m_last_height;
176181
177   UINT8           m_resize_pending;
178   UINT32          m_resize_width;
179   UINT32          m_resize_height;
180
181182   // Stats
182183   INT64           m_last_blit_time;
183184   INT64           m_last_blit_pixels;
184
185   // Original display_mode
186   SDL_DisplayMode m_original_mode;
187185};
188186
189187struct copy_info_t {
r243410r243411
202200   copy_info_t           *next;
203201};
204202
203
205204//============================================================
206205//  PROTOTYPES
207206//============================================================
r243410r243411
386385
387386   SDL_SetTextureBlendMode(m_texture_id, m_sdl_blendmode);
388387   set_coloralphamode(m_texture_id, &prim->color);
389   SDL_RenderCopy(m_renderer,  m_texture_id, NULL, &target_rect);
388   SDL_RenderCopy(m_sdl_renderer,  m_texture_id, NULL, &target_rect);
390389}
391390
392391void sdl_info13::render_quad(texture_info *texture, const render_primitive *prim, const int x, const int y)
r243410r243411
420419      UINT32 sb = (UINT32)(255.0f * prim->color.b);
421420      UINT32 sa = (UINT32)(255.0f * prim->color.a);
422421
423      SDL_SetRenderDrawBlendMode(m_renderer, map_blendmode(PRIMFLAG_GET_BLENDMODE(prim->flags)));
424      SDL_SetRenderDrawColor(m_renderer, sr, sg, sb, sa);
425      SDL_RenderFillRect(m_renderer, &target_rect);
422      SDL_SetRenderDrawBlendMode(m_sdl_renderer, map_blendmode(PRIMFLAG_GET_BLENDMODE(prim->flags)));
423      SDL_SetRenderDrawColor(m_sdl_renderer, sr, sg, sb, sa);
424      SDL_RenderFillRect(m_sdl_renderer, &target_rect);
426425   }
427426}
428427
r243410r243411
454453}
455454
456455//============================================================
457//  drawsdl2_init
456//  drawsdl_init
458457//============================================================
459458
460459static void add_list(copy_info_t **head, copy_info_t *element, Uint32 bm)
r243410r243411
518517   else
519518      osd_printf_verbose("Loaded opengl shared library: %s\n", stemp ? stemp : "<default>");
520519
521   /* Enable bilinear filtering in case it is supported.
522    * This applies to all texture operations. However, artwort is pre-scaled
523    * and thus shouldn't be affected.
524    */
525   if (video_config.filter)
526   {
527      SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "1");
528   }
529   else
530   {
531      SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "0");
532   }
533
534520   return 0;
535521}
536522
537523
538524//============================================================
539//  drawsdl2_exit
525//  drawsdl_exit
540526//============================================================
541527
542528static void drawsdl2_exit(void)
r243410r243411
586572// a
587573//============================================================
588574
589int sdl_info13::create(int width, int height)
575int sdl_info13::create()
590576{
591   /* FIXME: On Ubuntu and potentially other Linux OS you should use
592    * to disable panning. This has to be done before every invocation of mame.
593    *
594    * xrandr --output HDMI-0 --panning 0x0+0+0 --fb 0x0
595    *
596    */
577#if (SDLMAME_SDL2)
578   // create renderer
597579
598   osd_printf_verbose("Enter sdl_info13::create\n");
599
600   // create the SDL window
601   m_extra_flags = (window().fullscreen() ?
602         SDL_WINDOW_BORDERLESS | SDL_WINDOW_INPUT_FOCUS | SDL_WINDOW_FULLSCREEN : SDL_WINDOW_RESIZABLE);
603
604#if defined(SDLMAME_WIN32)
605   SDL_SetHint(SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS, "0");
606#endif
607   // create the SDL window
608   window().m_sdl_window = SDL_CreateWindow(window().m_title,
609         window().monitor()->position_size().x, window().monitor()->position_size().y,
610         width, height, m_extra_flags);
611
612   if  (!window().m_sdl_window )
580   /* Enable bilinear filtering in case it is supported.
581    * This applies to all texture operations. However, artwort is pre-scaled
582    * and thus shouldn't be affected.
583    */
584   if (video_config.filter)
613585   {
614      osd_printf_error("Window creation failed: %s\n", SDL_GetError());
615      return 1;
586      SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "1");
616587   }
617
618   if (window().fullscreen() && video_config.switchres)
619   {
620      SDL_DisplayMode mode;
621      //SDL_GetCurrentDisplayMode(window().monitor()->handle, &mode);
622      SDL_GetWindowDisplayMode(window().m_sdl_window, &mode);
623      m_original_mode = mode;
624      mode.w = width;
625      mode.h = height;
626      if (window().m_refresh)
627         mode.refresh_rate = window().m_refresh;
628
629      SDL_SetWindowDisplayMode(window().m_sdl_window, &mode);    // Try to set mode
630#ifndef SDLMAME_WIN32
631      /* FIXME: Warp the mouse to 0,0 in case a virtual desktop resolution
632       * is in place after the mode switch - which will most likely be the case
633       * This is a hack to work around a deficiency in SDL2
634       */
635      SDL_WarpMouseInWindow(window().m_sdl_window, 1, 1);
636#endif
637   }
638588   else
639589   {
640      //SDL_SetWindowDisplayMode(window().m_sdl_window, NULL); // Use desktop
590      SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "0");
641591   }
642   // create renderer
643592
644593   if (video_config.waitvsync)
645      m_renderer = SDL_CreateRenderer(window().m_sdl_window, -1, SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_ACCELERATED);
594      m_sdl_renderer = SDL_CreateRenderer(window().sdl_window(), -1, SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_ACCELERATED);
646595   else
647      m_renderer = SDL_CreateRenderer(window().m_sdl_window, -1, SDL_RENDERER_ACCELERATED);
596      m_sdl_renderer = SDL_CreateRenderer(window().sdl_window(), -1, SDL_RENDERER_ACCELERATED);
648597
649   if (!m_renderer)
598   if (!m_sdl_renderer)
650599   {
651600      fatalerror("Error on creating renderer: %s\n", SDL_GetError());
652601   }
653602
654603   //SDL_SelectRenderer(window().sdl_window);
655604
656   // show window
657
658   SDL_ShowWindow(window().m_sdl_window);
659   //SDL_SetWindowFullscreen(window().sdl_window, window().fullscreen);
660   SDL_RaiseWindow(window().m_sdl_window);
661
662   SDL_GetWindowSize(window().m_sdl_window, &window().m_width, &window().m_height);
663
664605   m_blittimer = 3;
665606
666   SDL_RenderPresent(m_renderer);
607   SDL_RenderPresent(m_sdl_renderer);
667608   osd_printf_verbose("Leave sdl_info13::create\n");
609
610#else
611
612#endif
668613   return 0;
669614}
670615
616
671617//============================================================
672//  sdl_info::resize
618//  sdl_info::destroy
673619//============================================================
674620
675void sdl_info13::resize(int width, int height)
621void sdl_info13::destroy()
676622{
677   m_resize_pending = 1;
678   m_resize_height = height;
679   m_resize_width = width;
623   destroy_all_textures();
624}
680625
681   window().m_width = width;
682   window().m_height = height;
626//============================================================
627//  sdl_info::clear
628//============================================================
683629
684   m_blittimer = 3;
685
630void sdl_info13::clear()
631{
632   m_blittimer = 2;
686633}
687634
635
688636//============================================================
689637//  drawsdl_xy_to_render_target
690638//============================================================
r243410r243411
694642
695643   *xt = x - m_last_hofs;
696644   *yt = y - m_last_vofs;
697   if (*xt<0 || *xt >= window().m_blitwidth)
645   if (*xt<0 || *xt >= window().blitwidth())
698646      return 0;
699   if (*yt<0 || *yt >= window().m_blitheight)
647   if (*yt<0 || *yt >= window().blitheight())
700648      return 0;
701649   return 1;
702650}
703651
704652//============================================================
705//  sdl_info::get_primitives
653//  drawsdl_destroy_all_textures
706654//============================================================
707655
708void sdl_info13::set_target_bounds()
656void sdl_info13::destroy_all_textures()
709657{
710   window().m_target->set_bounds(window().m_blitwidth, window().m_blitheight, window().monitor()->aspect());
658   if(window().m_primlist)
659   {
660      window().m_primlist->acquire_lock();
661      m_texlist.reset();
662      window().m_primlist->release_lock();
663   }
664   else
665      m_texlist.reset();
711666}
712667
713668//============================================================
r243410r243411
726681      return 0;
727682   }
728683
729   if (m_resize_pending)
684   if ((window().width() != m_last_width) || (window().height() != m_last_height))
730685   {
731      SDL_SetWindowSize(window().m_sdl_window, m_resize_width, m_resize_height);
732      SDL_GetWindowSize(window().m_sdl_window, &window().m_width, &window().m_height);
733      m_resize_pending = 0;
734      SDL_RenderSetViewport(m_renderer, NULL);
735      //sdlvideo_monitor_refresh(window().monitor());
736
686      m_last_width = window().width();
687      m_last_height = window().height();
688      SDL_RenderSetViewport(m_sdl_renderer, NULL);
689      m_blittimer = 3;
737690   }
738
739691   //SDL_SelectRenderer(window().sdl_window);
740692
741693   if (m_blittimer > 0)
742694   {
743695      /* SDL Underlays need alpha = 0 ! */
744      SDL_SetRenderDrawBlendMode(m_renderer, SDL_BLENDMODE_NONE);
696      SDL_SetRenderDrawBlendMode(m_sdl_renderer, SDL_BLENDMODE_NONE);
745697      //SDL_SetRenderDrawColor(0,0,0,255);
746      SDL_SetRenderDrawColor(m_renderer, 0,0,0,0);
747      SDL_RenderFillRect(m_renderer, NULL);
698      SDL_SetRenderDrawColor(m_sdl_renderer, 0,0,0,0);
699      SDL_RenderFillRect(m_sdl_renderer, NULL);
748700      m_blittimer--;
749701   }
750702
r243410r243411
762714      }
763715      else
764716      {
765         ch = window().m_height;
766         cw = window().m_width;
717         ch = window().height();
718         cw = window().width();
767719      }
768720
769721      if (video_config.centerv)
770722      {
771         vofs = (ch - window().m_blitheight) / 2.0f;
723         vofs = (ch - window().blitheight()) / 2.0f;
772724      }
773725      if (video_config.centerh)
774726      {
775         hofs = (cw - window().m_blitwidth) / 2.0f;
727         hofs = (cw - window().blitwidth()) / 2.0f;
776728      }
777729   }
778730
r243410r243411
794746            sb = (int)(255.0f * prim->color.b);
795747            sa = (int)(255.0f * prim->color.a);
796748
797            SDL_SetRenderDrawBlendMode(m_renderer, map_blendmode(PRIMFLAG_GET_BLENDMODE(prim->flags)));
798            SDL_SetRenderDrawColor(m_renderer, sr, sg, sb, sa);
799            SDL_RenderDrawLine(m_renderer, prim->bounds.x0 + hofs, prim->bounds.y0 + vofs,
749            SDL_SetRenderDrawBlendMode(m_sdl_renderer, map_blendmode(PRIMFLAG_GET_BLENDMODE(prim->flags)));
750            SDL_SetRenderDrawColor(m_sdl_renderer, sr, sg, sb, sa);
751            SDL_RenderDrawLine(m_sdl_renderer, prim->bounds.x0 + hofs, prim->bounds.y0 + vofs,
800752                  prim->bounds.x1 + hofs, prim->bounds.y1 + vofs);
801753            break;
802754         case render_primitive::QUAD:
r243410r243411
816768
817769   m_last_blit_pixels = blit_pixels;
818770   m_last_blit_time = -osd_ticks();
819   SDL_RenderPresent(m_renderer);
771   SDL_RenderPresent(m_sdl_renderer);
820772   m_last_blit_time += osd_ticks();
821773
822774   return 0;
r243410r243411
824776
825777
826778//============================================================
827//  sdl_info13::clear
828//============================================================
829
830void sdl_info13::clear()
831{
832   m_blittimer = 2;
833}
834
835
836//============================================================
837//  sdl_info13::destroy
838//============================================================
839
840void sdl_info13::destroy()
841{
842   // free the memory in the window
843
844   destroy_all_textures();
845
846   if (window().fullscreen() && video_config.switchres)
847   {
848      SDL_SetWindowFullscreen(window().m_sdl_window, 0);    // Try to set mode
849      SDL_SetWindowDisplayMode(window().m_sdl_window, &m_original_mode);    // Try to set mode
850      SDL_SetWindowFullscreen(window().m_sdl_window, SDL_WINDOW_FULLSCREEN);    // Try to set mode
851   }
852
853   SDL_DestroyWindow(window().m_sdl_window);
854
855}
856
857//============================================================
858779//  texture handling
859780//============================================================
860781
r243410r243411
873794      if ((m_is_rotated == bi->blitter->m_is_rot)
874795            && (m_sdl_blendmode == bi->bm_mask))
875796      {
876         if (RendererSupportsFormat(m_renderer, bi->dst_fmt, m_sdl_access, bi->dstname))
797         if (RendererSupportsFormat(m_sdl_renderer, bi->dst_fmt, m_sdl_access, bi->dstname))
877798         {
878799            int perf = bi->perf;
879800            if (perf == 0)
r243410r243411
893814   {
894815      if ((m_is_rotated == bi->blitter->m_is_rot)
895816         && (m_sdl_blendmode == bi->bm_mask))
896         if (RendererSupportsFormat(m_renderer, bi->dst_fmt, m_sdl_access, bi->dstname))
817         if (RendererSupportsFormat(m_sdl_renderer, bi->dst_fmt, m_sdl_access, bi->dstname))
897818            return bi;
898819   }
899820   //FIXME: crash implement a -do nothing handler */
r243410r243411
931852texture_info::texture_info(SDL_Renderer *renderer, const render_texinfo &texsource, const quad_setup_data &setup, UINT32 flags)
932853{
933854   // fill in the core data
934   m_renderer = renderer;
855   m_sdl_renderer = renderer;
935856   m_hash = texture_compute_hash(texsource, flags);
936857   m_flags = flags;
937858   m_texinfo = texsource;
r243410r243411
980901
981902   m_copyinfo = compute_size_type();
982903
983   m_texture_id = SDL_CreateTexture(m_renderer, m_copyinfo->dst_fmt, m_sdl_access,
904   m_texture_id = SDL_CreateTexture(m_sdl_renderer, m_copyinfo->dst_fmt, m_sdl_access,
984905         m_setup.rotwidth, m_setup.rotheight);
985906
986907   if (!m_texture_id)
r243410r243411
11531074   // if we didn't find one, create a new texture
11541075   if (texture == NULL && prim.texture.base != NULL)
11551076   {
1156      texture = global_alloc(texture_info(m_renderer, prim.texture, setup, prim.flags));
1077      texture = global_alloc(texture_info(m_sdl_renderer, prim.texture, setup, prim.flags));
11571078      /* add us to the texture list */
11581079      m_texlist.prepend(*texture);
11591080
r243410r243411
11721093   return texture;
11731094}
11741095
1175
1176void sdl_info13::destroy_all_textures()
1177{
1178   if(window().m_primlist)
1179   {
1180      window().m_primlist->acquire_lock();
1181      m_texlist.reset();
1182      window().m_primlist->release_lock();
1183   }
1184   else
1185      m_texlist.reset();
1186}
trunk/src/osd/sdl/drawbgfx.c
r243410r243411
7474{
7575public:
7676    sdl_info_bgfx(sdl_window_info *w)
77    : osd_renderer(w), m_blittimer(0), m_renderer(NULL),
77    : osd_renderer(w, FLAG_NONE), m_blittimer(0), m_renderer(NULL),
7878      m_last_hofs(0), m_last_vofs(0),
79      m_resize_pending(0), m_resize_width(0), m_resize_height(0),
8079      m_last_blit_time(0), m_last_blit_pixels(0)
8180    {}
8281
83   /* virtual */ int create(int width, int height);
84   /* virtual */ void resize(int width, int height);
85   /* virtual */ int draw(UINT32 dc, int update);
86   /* virtual */ void set_target_bounds();
87   /* virtual */ int xy_to_render_target(int x, int y, int *xt, int *yt);
82   /* virtual */ int create();
83   /* virtual */ int draw(const UINT32 dc, const int update);
84   /* virtual */ int xy_to_render_target(const int x, const int y, int *xt, int *yt);
8885   /* virtual */ void destroy_all_textures();
8986   /* virtual */ void destroy();
9087   /* virtual */ void clear();
r243410r243411
10299   float           m_last_hofs;
103100   float           m_last_vofs;
104101
105   // resize information
106
107   UINT8           m_resize_pending;
108   UINT32          m_resize_width;
109   UINT32          m_resize_height;
110
111102   // Stats
112103   INT64           m_last_blit_time;
113104   INT64           m_last_blit_pixels;
r243410r243411
143134//  sdl_info_bgfx::create
144135//============================================================
145136
146int sdl_info_bgfx::create(int width, int height)
137int sdl_info_bgfx::create()
147138{
148   /* FIXME: On Ubuntu and potentially other Linux OS you should use
149    * to disable panning. This has to be done before every invocation of mame.
150    *
151    * xrandr --output HDMI-0 --panning 0x0+0+0 --fb 0x0
152    *
153    */
154
155   osd_printf_verbose("Enter drawsdl2_window_create\n");
156
157   UINT32 extra_flags = (window().fullscreen() ?
158         SDL_WINDOW_BORDERLESS | SDL_WINDOW_INPUT_FOCUS | SDL_WINDOW_FULLSCREEN : SDL_WINDOW_RESIZABLE);
159
160#if defined(SDLMAME_WIN32)
161   SDL_SetHint(SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS, "0");
162#endif
163   // create the SDL window
164   window().m_sdl_window = SDL_CreateWindow(window().m_title,
165         window().monitor()->position_size().x, window().monitor()->position_size().y,
166         width, height, extra_flags);
167
168   if (window().fullscreen() && video_config.switchres)
169   {
170      SDL_DisplayMode mode;
171      //SDL_GetCurrentDisplayMode(window().monitor()->handle, &mode);
172      SDL_GetWindowDisplayMode(window().m_sdl_window, &mode);
173      m_original_mode = mode;
174      mode.w = width;
175      mode.h = height;
176      if (window().m_refresh)
177         mode.refresh_rate = window().m_refresh;
178
179      SDL_SetWindowDisplayMode(window().m_sdl_window, &mode);    // Try to set mode
180#ifndef SDLMAME_WIN32
181      /* FIXME: Warp the mouse to 0,0 in case a virtual desktop resolution
182       * is in place after the mode switch - which will most likely be the case
183       * This is a hack to work around a deficiency in SDL2
184       */
185      SDL_WarpMouseInWindow(window().m_sdl_window, 1, 1);
186#endif
187   }
188   else
189   {
190      //SDL_SetWindowDisplayMode(window().m_sdl_window, NULL); // Use desktop
191   }
192139   // create renderer
193140
194   if (video_config.waitvsync)
195      m_renderer = SDL_CreateRenderer(window().m_sdl_window, -1, SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_ACCELERATED);
196   else
197      m_renderer = SDL_CreateRenderer(window().m_sdl_window, -1, SDL_RENDERER_ACCELERATED);
198
199   if (!m_renderer)
200   {
201      fatalerror("Error on creating renderer: %s\n", SDL_GetError());
202   }
203
204   //SDL_SelectRenderer(window().m_sdl_window);
205   SDL_ShowWindow(window().m_sdl_window);
206   //SDL_SetWindowFullscreen(window().window_id, window().fullscreen);
207   SDL_RaiseWindow(window().m_sdl_window);
208
209   SDL_GetWindowSize(window().m_sdl_window, &window().m_width, &window().m_height);
210
211141   m_blittimer = 3;
212142
213   SDL_RenderPresent(m_renderer);
214   
215   bgfx::sdlSetWindow(window().m_sdl_window);
143   bgfx::sdlSetWindow(window().sdl_window());
216144   bgfx::init();
217   bgfx::reset(window().m_width, window().m_height, BGFX_RESET_VSYNC);
145   bgfx::reset(window().width(), window().height(), BGFX_RESET_VSYNC);
218146   
219147   // Enable debug text.
220148   bgfx::setDebug(BGFX_DEBUG_STATS);// BGFX_DEBUG_TEXT);
r243410r243411
223151}
224152
225153//============================================================
226//  sdl_info_bgfx::resize
227//============================================================
228
229void sdl_info_bgfx::resize(int width, int height)
230{
231   m_resize_pending = 1;
232   m_resize_height = height;
233   m_resize_width = width;
234
235   window().m_width = width;
236   window().m_height = height;
237
238   m_blittimer = 3;
239}
240
241//============================================================
242154//  drawsdl_xy_to_render_target
243155//============================================================
244156
r243410r243411
246158{
247159   *xt = x - m_last_hofs;
248160   *yt = y - m_last_vofs;
249   if (*xt<0 || *xt >= window().m_blitwidth)
161   if (*xt<0 || *xt >= window().blitwidth())
250162      return 0;
251   if (*yt<0 || *yt >= window().m_blitheight)
163   if (*yt<0 || *yt >= window().blitheight())
252164      return 0;
253165   return 1;
254166}
255167
256168//============================================================
257//  sdl_info_bgfx::get_primitives
258//============================================================
259
260void sdl_info_bgfx::set_target_bounds()
261{
262   window().m_target->set_bounds(window().m_blitwidth, window().m_blitheight, window().monitor()->aspect());
263}
264
265//============================================================
266169//  sdl_info_bgfx::draw
267170//============================================================
268171
r243410r243411
275178      , 0
276179      );
277180   // Set view 0 default viewport.
278   bgfx::setViewRect(0, 0, 0, window().m_blitwidth, window().m_blitheight);
181   bgfx::setViewRect(0, 0, 0, window().blitwidth(), window().blitheight());
279182
280183   // This dummy draw call is here to make sure that view 0 is cleared
281184   // if no other draw calls are submitted to view 0.
r243410r243411
308211
309212   destroy_all_textures();
310213
311   if (window().fullscreen() && video_config.switchres)
312   {
313      SDL_SetWindowFullscreen(window().m_sdl_window, 0);    // Try to set mode
314      SDL_SetWindowDisplayMode(window().m_sdl_window, &m_original_mode);    // Try to set mode
315      SDL_SetWindowFullscreen(window().m_sdl_window, SDL_WINDOW_FULLSCREEN);    // Try to set mode
316   }
317
318   SDL_DestroyWindow(window().m_sdl_window);
319   
320214   // Shutdown bgfx.
321215   bgfx::shutdown();
322216}
trunk/src/osd/sdl/drawogl.c
r243410r243411
5858typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DEXTPROC) (GLenum m_target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
5959typedef void (APIENTRYP PFNGLGENRENDERBUFFERSEXTPROC) (GLsizei n, GLuint *renderbuffers);
6060typedef void (APIENTRYP PFNGLBINDRENDERBUFFEREXTPROC) (GLenum m_target, GLuint renderbuffer);
61typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEEXTPROC) (GLenum m_target, GLenum internalformat, GLsizei m_width, GLsizei m_height);
61typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEEXTPROC) (GLenum m_target, GLenum internalformat, GLsizei width, GLsizei height);
6262typedef void (APIENTRYP PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC) (GLenum m_target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
6363typedef void (APIENTRYP PFNGLDELETERENDERBUFFERSEXTPROC) (GLsizei n, const GLuint *renderbuffers);
6464#endif
r243410r243411
156156//  TYPES
157157//============================================================
158158
159struct texture_info;
159//============================================================
160//  Textures
161//============================================================
160162
161163/* texture_info holds information about a texture */
162struct texture_info
164class texture_info
163165{
166public:
164167   texture_info()
165   : hash(0), flags(0), rawwidth(0), rawheight(0),
168   :    hash(0), flags(0), rawwidth(0), rawheight(0),
166169      rawwidth_create(0), rawheight_create(0),
167170      type(0), format(0), borderpix(0), xprescale(0), yprescale(0), nocopy(0),
168171      texture(0), texTarget(0), texpow2(0), mpass_dest_idx(0), pbo(0), data(NULL),
r243410r243411
219222{
220223public:
221224   sdl_info_ogl(sdl_window_info *window)
222   : osd_renderer(window), m_blittimer(0), m_extra_flags(0),
225   : osd_renderer(window, FLAG_NEEDS_OPENGL), m_blittimer(0),
226      m_screen_width(0), m_screen_height(0),
227      m_last_width(0), m_last_height(0),
223228#if (SDLMAME_SDL2)
224229      m_gl_context_id(0),
225230#else
226      m_sdlsurf(NULL),
227231#endif
228232      m_initialized(0),
229233      m_last_blendmode(0),
r243410r243411
248252         m_texVerticex[i] = 0.0f;
249253   }
250254
251   /* virtual */ int create(int width, int height);
252   /* virtual */ void resize(int width, int height);
253   /* virtual */ int draw(UINT32 dc, int update);
254   /* virtual */ void set_target_bounds();
255   /* virtual */ int xy_to_render_target(int x, int y, int *xt, int *yt);
255   /* virtual */ int create();
256   /* virtual */ int draw(const UINT32 dc, const int update);
257   /* virtual */ int xy_to_render_target(const int x, const int y, int *xt, int *yt);
256258   /* virtual */ void destroy_all_textures();
257259   /* virtual */ void destroy();
258260   /* virtual */ void clear();
r243410r243411
276278   void texture_all_disable();
277279
278280   INT32           m_blittimer;
279   UINT32          m_extra_flags;
281   int             m_screen_width;
282   int             m_screen_height;
283   int            m_last_width;
284   int            m_last_height;
280285
281
282286#if (SDLMAME_SDL2)
283   // Original display_mode
284   SDL_DisplayMode m_original_mode;
285
286287   SDL_GLContext   m_gl_context_id;
287288#else
288   // SDL surface
289   SDL_Surface         *m_sdlsurf;
290289#endif
291290
292291   int             m_initialized;        // is everything well initialized, i.e. all GL stuff etc.
r243410r243411
393392
394393// core functions
395394
395//============================================================
396//  STATIC VARIABLES
397//============================================================
398
396399static void drawogl_exit(void);
397400static void load_gl_lib(running_machine &machine);
398401
r243410r243411
440443static int dll_loaded = 0;
441444
442445//============================================================
443//  drawogl_init
446//  drawsdl_init
444447//============================================================
445448
446449static osd_renderer *drawogl_create(sdl_window_info *window)
r243410r243411
456459
457460   dll_loaded = 0;
458461
462   load_gl_lib(machine);
459463   if (SDLMAME_SDL2)
460464   {
461465      osd_printf_verbose("Using SDL multi-window OpenGL driver (SDL 2.0+)\n");
462      load_gl_lib(machine);
463466   }
464467   else
465468      osd_printf_verbose("Using SDL single-window OpenGL driver (SDL 1.2)\n");
r243410r243411
708711// a
709712//============================================================
710713
711int sdl_info_ogl::create(int width, int height)
714int sdl_info_ogl::create()
712715{
713#if (SDLMAME_SDL2)
714716
715   SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );
716
717   /* FIXME: A reminder that gamma is wrong throughout MAME. Currently, SDL2.0 doesn't seem to
718    * support the following attribute although my hardware lists GL_ARB_framebuffer_sRGB as an extension.
719    *
720    * SDL_GL_SetAttribute( SDL_GL_FRAMEBUFFER_SRGB_CAPABLE, 1 );
721    *
722    */
723
724   osd_printf_verbose("Enter sdl_info_ogl::create\n");
725
726   // create the SDL window
727   // soft driver also used | SDL_WINDOW_INPUT_GRABBED | SDL_WINDOW_MOUSE_FOCUS
728   m_extra_flags = (window().fullscreen() ?
729         SDL_WINDOW_BORDERLESS | SDL_WINDOW_INPUT_FOCUS | SDL_WINDOW_FULLSCREEN : SDL_WINDOW_RESIZABLE);
730
731   m_extra_flags |= SDL_WINDOW_OPENGL;
732
733
734#if defined(SDLMAME_WIN32)
735   SDL_SetHint(SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS, "0");
736#endif
737   // create the SDL window
738   window().m_sdl_window = SDL_CreateWindow(window().m_title,
739         window().monitor()->position_size().x, window().monitor()->position_size().y,
740         width, height, m_extra_flags);
741   //window().m_sdl_window = SDL_CreateWindow(window().m_title, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
742   //      width, height, m_extra_flags);
743
744   if  (!window().m_sdl_window )
745   {
746      osd_printf_error("OpenGL not supported on this driver: %s\n", SDL_GetError());
747      return 1;
748   }
749
750   if (window().fullscreen() && video_config.switchres)
751   {
752      SDL_DisplayMode mode;
753      //SDL_GetCurrentDisplayMode(window().monitor()->handle, &mode);
754      SDL_GetWindowDisplayMode(window().m_sdl_window, &mode);
755      m_original_mode = mode;
756      mode.w = width;
757      mode.h = height;
758      if (window().m_refresh)
759         mode.refresh_rate = window().m_refresh;
760
761      SDL_SetWindowDisplayMode(window().m_sdl_window, &mode);    // Try to set mode
762#ifndef SDLMAME_WIN32
763      /* FIXME: Warp the mouse to 0,0 in case a virtual desktop resolution
764       * is in place after the mode switch - which will most likely be the case
765       * This is a hack to work around a deficiency in SDL2
766       */
767      SDL_WarpMouseInWindow(window().m_sdl_window, 1, 1);
768#endif
769   }
770   else
771   {
772      //SDL_SetWindowDisplayMode(window().m_sdl_window, NULL); // Use desktop
773   }
717#if (SDLMAME_SDL2)
774718   // create renderer
775719
776   //SDL_SelectRenderer(window().sdl_window);
777
778   // show window
779
780   SDL_ShowWindow(window().m_sdl_window);
781   //SDL_SetWindowFullscreen(window().m_sdl_window, window().fullscreen);
782   SDL_RaiseWindow(window().m_sdl_window);
783
784   SDL_GetWindowSize(window().m_sdl_window, &window().m_width, &window().m_height);
785
786
787   m_gl_context_id = SDL_GL_CreateContext(window().m_sdl_window);
720   m_gl_context_id = SDL_GL_CreateContext(window().sdl_window());
788721   if  (!m_gl_context_id)
789722   {
790723      osd_printf_error("OpenGL not supported on this driver: %s\n", SDL_GetError());
r243410r243411
794727   SDL_GL_SetSwapInterval(video_config.waitvsync ? 2 : 0);
795728
796729#else
797   m_extra_flags = (window().fullscreen() ?  SDL_FULLSCREEN : SDL_RESIZABLE);
798   m_extra_flags |= SDL_OPENGL | SDL_DOUBLEBUF;
799
800   SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );
801   #if (SDL_VERSION_ATLEAST(1,2,10)) && (!defined(SDLMAME_EMSCRIPTEN))
802   SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, video_config.waitvsync ? 1 : 0);
803   #endif
804
805   load_gl_lib(window().machine());
806
807   // create the SDL surface (which creates the window in windowed mode)
808   m_sdlsurf = SDL_SetVideoMode(width, height,
809                     0, SDL_SWSURFACE  | SDL_ANYFORMAT | m_extra_flags);
810
811   if (!m_sdlsurf)
812      return 1;
813
814   window().m_width = m_sdlsurf->w;
815   window().m_height = m_sdlsurf->h;
816
817   window().m_screen_width = 0;
818   window().m_screen_height = 0;
819
820   if ( (video_config.mode  == VIDEO_MODE_OPENGL) && !(m_sdlsurf->flags & SDL_OPENGL) )
821   {
822      osd_printf_error("OpenGL not supported on this driver!\n");
823      return 1;
824   }
825
826   // set the window title
827   SDL_WM_SetCaption(window().m_title, "SDLMAME");
828
829730#endif
830731
732   m_screen_width = 0;
733   m_screen_height = 0;
734
831735   m_blittimer = 0;
832736   m_surf_w = 0;
833737   m_surf_h = 0;
r243410r243411
852756   return 0;
853757}
854758
759
855760//============================================================
856//  sdl_info::resize
761//  sdl_info::destroy
857762//============================================================
858763
859void sdl_info_ogl::resize(int width, int height)
764void sdl_info_ogl::destroy()
860765{
861#if (SDLMAME_SDL2)
862   //SDL_GL_MakeCurrent(window().sdl_window, gl_context_id);
863   SDL_SetWindowSize(window().m_sdl_window, width, height);
864   SDL_GetWindowSize(window().m_sdl_window, &window().m_width, &window().m_height);
865   m_blittimer = 3;
866#else
867   SDL_FreeSurface(m_sdlsurf);
868766
869   m_sdlsurf = SDL_SetVideoMode(width, height, 0,
870         SDL_SWSURFACE | SDL_ANYFORMAT | m_extra_flags);
767   // free the memory in the window
871768
872   window().m_width = m_sdlsurf->w;
873   window().m_height = m_sdlsurf->h;
769   destroy_all_textures();
770
771#if (SDLMAME_SDL2)
772   SDL_GL_DeleteContext(m_gl_context_id);
874773#endif
875   m_init_context = 1;
876774
877775}
878776
879777//============================================================
778//  sdl_info::clear
779//============================================================
780
781void sdl_info_ogl::clear()
782{
783   //FIXME: Handled in sdl_info::draw as well
784   m_blittimer = 3;
785}
786
787//============================================================
880788//  drawsdl_xy_to_render_target
881789//============================================================
882790
883791int sdl_info_ogl::xy_to_render_target(int x, int y, int *xt, int *yt)
884792{
793
885794   *xt = x - m_last_hofs;
886795   *yt = y - m_last_vofs;
887   if (*xt<0 || *xt >= window().m_blitwidth)
796   if (*xt<0 || *xt >= window().blitwidth())
888797      return 0;
889   if (*yt<0 || *yt >= window().m_blitheight)
798   if (*yt<0 || *yt >= window().blitheight())
890799      return 0;
891800   return 1;
892801}
893802
894803//============================================================
895//  sdl_info::get_primitives
804//  drawsdl_destroy_all_textures
896805//============================================================
897806
898void sdl_info_ogl::set_target_bounds()
807void sdl_info_ogl::destroy_all_textures()
899808{
900   window().m_target->set_bounds(window().m_blitwidth, window().m_blitheight, window().monitor()->aspect());
901}
809   texture_info *texture = NULL;
810   int lock=FALSE;
811   int i;
902812
813   if ( !m_initialized )
814      return;
815
816#if (SDLMAME_SDL2)
817   SDL_GL_MakeCurrent(window().sdl_window(), m_gl_context_id);
818#endif
819
820   if(window().m_primlist)
821   {
822      lock=TRUE;
823      window().m_primlist->acquire_lock();
824   }
825
826   glFinish();
827
828   texture_all_disable();
829   glFinish();
830   glDisableClientState(GL_VERTEX_ARRAY);
831
832   i=0;
833   while (i<HASH_SIZE+OVERFLOW_SIZE)
834   {
835      texture = m_texhash[i];
836      m_texhash[i] = NULL;
837      if (texture != NULL)
838      {
839         if(m_usevbo)
840         {
841            pfn_glDeleteBuffers( 1, &(texture->texCoordBufferName) );
842            texture->texCoordBufferName=0;
843         }
844
845         if(m_usepbo && texture->pbo)
846         {
847            pfn_glDeleteBuffers( 1, (GLuint *)&(texture->pbo) );
848            texture->pbo=0;
849         }
850
851         if( m_glsl_program_num > 1 )
852         {
853            assert(m_usefbo);
854            pfn_glDeleteFramebuffers(2, (GLuint *)&texture->mpass_fbo_mamebm[0]);
855            glDeleteTextures(2, (GLuint *)&texture->mpass_texture_mamebm[0]);
856         }
857
858         if ( m_glsl_program_mb2sc < m_glsl_program_num - 1 )
859         {
860            assert(m_usefbo);
861            pfn_glDeleteFramebuffers(2, (GLuint *)&texture->mpass_fbo_scrn[0]);
862            glDeleteTextures(2, (GLuint *)&texture->mpass_texture_scrn[0]);
863         }
864
865         glDeleteTextures(1, (GLuint *)&texture->texture);
866         if ( texture->data_own )
867         {
868            free(texture->data);
869            texture->data=NULL;
870            texture->data_own=FALSE;
871         }
872         global_free(texture);
873      }
874      i++;
875   }
876   if ( m_useglsl )
877   {
878      glsl_shader_free(m_glsl);
879      m_glsl = NULL;
880   }
881
882   m_initialized = 0;
883
884   if (lock)
885      window().m_primlist->release_lock();
886}
903887//============================================================
904888//  loadGLExtensions
905889//============================================================
r243410r243411
11181102
11191103   if ( m_useglsl )
11201104   {
1121      if ( window().m_prescale != 1 )
1105      if ( window().prescale() != 1 )
11221106      {
11231107         m_useglsl = 0;
11241108         if (_once)
r243410r243411
12111195}
12121196
12131197//============================================================
1214//  sdl_info::destroy
1215//============================================================
1216
1217void sdl_info_ogl::destroy()
1218{
1219
1220   // free the memory in the window
1221
1222   destroy_all_textures();
1223
1224#if (SDLMAME_SDL2)
1225   SDL_GL_DeleteContext(m_gl_context_id);
1226   if (window().fullscreen() && video_config.switchres)
1227   {
1228      SDL_SetWindowFullscreen(window().m_sdl_window, 0);    // Try to set mode
1229      SDL_SetWindowDisplayMode(window().m_sdl_window, &m_original_mode);    // Try to set mode
1230      SDL_SetWindowFullscreen(window().m_sdl_window, SDL_WINDOW_FULLSCREEN);    // Try to set mode
1231   }
1232
1233   SDL_DestroyWindow(window().m_sdl_window);
1234#else
1235   if (m_sdlsurf)
1236   {
1237      SDL_FreeSurface(m_sdlsurf);
1238      m_sdlsurf = NULL;
1239   }
1240#endif
1241}
1242
1243//============================================================
12441198//  sdl_info::draw
12451199//============================================================
12461200
r243410r243411
12571211      return 0;
12581212   }
12591213
1214   if ((window().width() != m_last_width) || (window().height() != m_last_height))
1215   {
1216      m_last_width = window().width();
1217      m_last_height = window().height();
12601218#if (SDLMAME_SDL2)
1261   SDL_GL_MakeCurrent(window().m_sdl_window, m_gl_context_id);
1219      m_blittimer = 3;
1220#endif
1221      m_init_context = 1;
1222   }
1223
1224#if (SDLMAME_SDL2)
1225   SDL_GL_MakeCurrent(window().sdl_window(), m_gl_context_id);
12621226#else
12631227   if (!m_init_context)
12641228   {
r243410r243411
12671231      {
12681232         if (window().index() == 0)
12691233         {
1270            if ((screen->width() != window().m_screen_width) || (screen->height() != window().m_screen_height))
1234            if ((screen->width() != m_screen_width) || (screen->height() != m_screen_height))
12711235            {
1272               window().m_screen_width = screen->width();
1273               window().m_screen_height = screen->height();
1236               m_screen_width = screen->width();
1237               m_screen_height = screen->height();
12741238
12751239               // force all textures to be regenerated
12761240               destroy_all_textures();
r243410r243411
13211285   }
13221286
13231287   if ( !m_initialized ||
1324         window().m_width!= m_surf_w || window().m_height!= m_surf_h )
1288         window().width()!= m_surf_w || window().height()!= m_surf_h )
13251289   {
13261290      if ( !m_initialized )
13271291      {
13281292         loadGLExtensions();
13291293      }
13301294
1331      m_surf_w=window().m_width;
1332      m_surf_h=window().m_height;
1295      m_surf_w=window().width();
1296      m_surf_h=window().height();
13331297
13341298      // we're doing nothing 3d, so the Z-buffer is currently not interesting
13351299      glDisable(GL_DEPTH_TEST);
r243410r243411
13701334      //   |_________|
13711335      // (0,h)     (w,h)
13721336
1373      glViewport(0.0, 0.0, (GLsizei)window().m_width, (GLsizei)window().m_height);
1337      glViewport(0.0, 0.0, (GLsizei)window().width(), (GLsizei)window().height());
13741338      glMatrixMode(GL_PROJECTION);
13751339      glLoadIdentity();
1376      glOrtho(0.0, (GLdouble)window().m_width, (GLdouble)window().m_height, 0.0, 0.0, -1.0);
1340      glOrtho(0.0, (GLdouble)window().width(), (GLdouble)window().height(), 0.0, 0.0, -1.0);
13771341      glMatrixMode(GL_MODELVIEW);
13781342      glLoadIdentity();
13791343
r243410r243411
14001364      }
14011365      else
14021366      {
1403         ch = window().m_height;
1404         cw = window().m_width;
1367         ch = window().height();
1368         cw = window().width();
14051369      }
14061370
14071371      if (video_config.centerv)
14081372      {
1409         vofs = (ch - window().m_blitheight) / 2.0f;
1373         vofs = (ch - window().blitheight()) / 2.0f;
14101374      }
14111375      if (video_config.centerh)
14121376      {
1413         hofs = (cw - window().m_blitwidth) / 2.0f;
1377         hofs = (cw - window().blitwidth()) / 2.0f;
14141378      }
14151379   }
14161380
r243410r243411
14861450               set_blendmode(sdl, PRIMFLAG_GET_BLENDMODE(prim->flags));
14871451
14881452               // compute the effective width based on the direction of the line
1489               effwidth = prim->m_width;
1453               effwidth = prim->width();
14901454               if (effwidth < 0.5f)
14911455                  effwidth = 0.5f;
14921456
r243410r243411
15911555                     // 1:1 tex coord CCW (0/0) (1/0) (1/1) (0/1) on texture dimensions
15921556                     m_texVerticex[0]=(GLfloat)0.0;
15931557                     m_texVerticex[1]=(GLfloat)0.0;
1594                     m_texVerticex[2]=(GLfloat)window().m_width;
1558                     m_texVerticex[2]=(GLfloat)window().width();
15951559                     m_texVerticex[3]=(GLfloat)0.0;
1596                     m_texVerticex[4]=(GLfloat)window().m_width;
1597                     m_texVerticex[5]=(GLfloat)window().m_height;
1560                     m_texVerticex[4]=(GLfloat)window().width();
1561                     m_texVerticex[5]=(GLfloat)window().height();
15981562                     m_texVerticex[6]=(GLfloat)0.0;
1599                     m_texVerticex[7]=(GLfloat)window().m_height;
1563                     m_texVerticex[7]=(GLfloat)window().height();
16001564                  }
16011565
16021566                  if(i>0) // first fetch already done
r243410r243411
16421606#if (!SDLMAME_SDL2)
16431607   SDL_GL_SwapBuffers();
16441608#else
1645   SDL_GL_SwapWindow(window().m_sdl_window);
1609   SDL_GL_SwapWindow(window().sdl_window());
16461610#endif
16471611   return 0;
16481612}
r243410r243411
18001764      texture->xprescale--;
18011765   while (texture->yprescale > 1 && height_create * texture->yprescale > m_texture_max_height)
18021766      texture->yprescale--;
1803   if (PRIMFLAG_GET_SCREENTEX(flags) && (texture->xprescale != window().m_prescale || texture->yprescale != window().m_prescale))
1804      osd_printf_warning("SDL: adjusting prescale from %dx%d to %dx%d\n", window().m_prescale, window().m_prescale, texture->xprescale, texture->yprescale);
1767   if (PRIMFLAG_GET_SCREENTEX(flags) && (texture->xprescale != window().prescale() || texture->yprescale != window().prescale()))
1768      osd_printf_warning("SDL: adjusting prescale from %dx%d to %dx%d\n", window().prescale(), window().prescale(), texture->xprescale, texture->yprescale);
18051769
18061770   width  *= texture->xprescale;
18071771   height *= texture->yprescale;
r243410r243411
19801944{
19811945   int uniform_location;
19821946   int i;
1983   int surf_w_pow2  = get_valid_pow2_value (window().m_blitwidth, texture->texpow2);
1984   int surf_h_pow2  = get_valid_pow2_value (window().m_blitheight, texture->texpow2);
1947   int surf_w_pow2  = get_valid_pow2_value (window().blitwidth(), texture->texpow2);
1948   int surf_h_pow2  = get_valid_pow2_value (window().blitheight(), texture->texpow2);
19851949
19861950   assert ( texture->type==TEXTURE_TYPE_SHADER );
19871951
r243410r243411
20281992      pfn_glUniform2fvARB(uniform_location, 1, &(color_texture_pow2_sz[0]));
20291993      GL_CHECK_ERROR_NORMAL();
20301994
2031      GLfloat screen_texture_sz[2] = { (GLfloat)window().m_blitwidth, (GLfloat)window().m_blitheight };
1995      GLfloat screen_texture_sz[2] = { (GLfloat)window().blitwidth(), (GLfloat)window().blitheight() };
20321996      uniform_location = pfn_glGetUniformLocationARB(m_glsl_program[i], "screen_texture_sz");
20331997      pfn_glUniform2fvARB(uniform_location, 1, &(screen_texture_sz[0]));
20341998      GL_CHECK_ERROR_NORMAL();
r243410r243411
20842048      }
20852049
20862050      osd_printf_verbose("GL texture: mpass screen-bmp 2x %dx%d (pow2 %dx%d)\n",
2087         window().m_width, window().m_height, surf_w_pow2, surf_h_pow2);
2051         window().width(), window().height(), surf_w_pow2, surf_h_pow2);
20882052   }
20892053
20902054   // GL_TEXTURE0
r243410r243411
21632127   texture->texinfo.seqid = -1; // force set data
21642128   if (PRIMFLAG_GET_SCREENTEX(flags))
21652129   {
2166      texture->xprescale = window().m_prescale;
2167      texture->yprescale = window().m_prescale;
2130      texture->xprescale = window().prescale();
2131      texture->yprescale = window().prescale();
21682132   }
21692133   else
21702134   {
r243410r243411
27942758   }
27952759   else if ( texture->type == TEXTURE_TYPE_SHADER && shaderIdx>m_glsl_program_mb2sc )
27962760   {
2797      int surf_w_pow2  = get_valid_pow2_value (window().m_width, texture->texpow2);
2798      int surf_h_pow2  = get_valid_pow2_value (window().m_height, texture->texpow2);
2761      int surf_w_pow2  = get_valid_pow2_value (window().width(), texture->texpow2);
2762      int surf_h_pow2  = get_valid_pow2_value (window().height(), texture->texpow2);
27992763
2800      ustop  = (float)(window().m_width) / (float)surf_w_pow2;
2801      vstop  = (float)(window().m_height) / (float)surf_h_pow2;
2764      ustop  = (float)(window().width()) / (float)surf_w_pow2;
2765      vstop  = (float)(window().height()) / (float)surf_h_pow2;
28022766   }
28032767   else
28042768   {
r243410r243411
30863050   }
30873051}
30883052
3089void sdl_info_ogl::destroy_all_textures()
3090{
3091   texture_info *texture = NULL;
3092   int lock=FALSE;
3093   int i;
30943053
3095   if ( !m_initialized )
3096      return;
30973054
3098#if (SDLMAME_SDL2)
3099   SDL_GL_MakeCurrent(window().m_sdl_window, m_gl_context_id);
3100#endif
3101
3102   if(window().m_primlist)
3103   {
3104      lock=TRUE;
3105      window().m_primlist->acquire_lock();
3106   }
3107
3108   glFinish();
3109
3110   texture_all_disable();
3111   glFinish();
3112   glDisableClientState(GL_VERTEX_ARRAY);
3113
3114   i=0;
3115   while (i<HASH_SIZE+OVERFLOW_SIZE)
3116   {
3117      texture = m_texhash[i];
3118      m_texhash[i] = NULL;
3119      if (texture != NULL)
3120      {
3121         if(m_usevbo)
3122         {
3123            pfn_glDeleteBuffers( 1, &(texture->texCoordBufferName) );
3124            texture->texCoordBufferName=0;
3125         }
3126
3127         if(m_usepbo && texture->pbo)
3128         {
3129            pfn_glDeleteBuffers( 1, (GLuint *)&(texture->pbo) );
3130            texture->pbo=0;
3131         }
3132
3133         if( m_glsl_program_num > 1 )
3134         {
3135            assert(m_usefbo);
3136            pfn_glDeleteFramebuffers(2, (GLuint *)&texture->mpass_fbo_mamebm[0]);
3137            glDeleteTextures(2, (GLuint *)&texture->mpass_texture_mamebm[0]);
3138         }
3139
3140         if ( m_glsl_program_mb2sc < m_glsl_program_num - 1 )
3141         {
3142            assert(m_usefbo);
3143            pfn_glDeleteFramebuffers(2, (GLuint *)&texture->mpass_fbo_scrn[0]);
3144            glDeleteTextures(2, (GLuint *)&texture->mpass_texture_scrn[0]);
3145         }
3146
3147         glDeleteTextures(1, (GLuint *)&texture->texture);
3148         if ( texture->data_own )
3149         {
3150            free(texture->data);
3151            texture->data=NULL;
3152            texture->data_own=FALSE;
3153         }
3154         global_free(texture);
3155      }
3156      i++;
3157   }
3158   if ( m_useglsl )
3159   {
3160      glsl_shader_free(m_glsl);
3161      m_glsl = NULL;
3162   }
3163
3164   m_initialized = 0;
3165
3166   if (lock)
3167      window().m_primlist->release_lock();
3168}
3169
3170//============================================================
3171//  TEXCOPY FUNCS
3172//============================================================
3173
3174void sdl_info_ogl::clear()
3175{
3176   //FIXME: Handled in sdl_info::draw as well
3177   m_blittimer = 3;
3178}
trunk/src/osd/sdl/drawsdl.c
r243410r243411
5050{
5151public:
5252
53   sdl_info(sdl_window_info *w)
54   : osd_renderer(w),
55   m_blittimer(0),
56   m_extra_flags(0),
57
53   sdl_info(sdl_window_info *w, int extra_flags)
54   : osd_renderer(w, extra_flags),
5855   #if (SDLMAME_SDL2)
5956   m_sdl_renderer(NULL),
6057   m_texture_id(NULL),
6158   #else
62   m_sdlsurf(NULL),
6359   m_yuvsurf(NULL),
6460   #endif
6561   m_yuv_lookup(NULL),
r243410r243411
6965   m_last_hofs(0),
7066   m_last_vofs(0),
7167   m_old_blitwidth(0),
72   m_old_blitheight(0)
68   m_old_blitheight(0),
69   m_last_width(0),
70   m_last_height(0)
7371   { }
7472
75   /* virtual */ int create(int width, int height);
76   /* virtual */ void resize(int width, int height);
77   /* virtual */ int draw(UINT32 dc, int update);
78   /* virtual */ void set_target_bounds();
79   /* virtual */ int xy_to_render_target(int x, int y, int *xt, int *yt);
73   /* virtual */ int create();
74   /* virtual */ int draw(const UINT32 dc, const int update);
75   /* virtual */ int xy_to_render_target(const int x, const int y, int *xt, int *yt);
8076   /* virtual */ void destroy_all_textures();
8177   /* virtual */ void destroy();
8278   /* virtual */ void clear();
r243410r243411
9389#endif
9490
9591   INT32               m_blittimer;
96   UINT32              m_extra_flags;
9792
9893#if (SDLMAME_SDL2)
99   // Original display_mode
100   SDL_DisplayMode    m_original_mode;
101
10294   SDL_Renderer        *m_sdl_renderer;
10395   SDL_Texture         *m_texture_id;
10496#else
105   // SDL surface
106   SDL_Surface         *m_sdlsurf;
10797   SDL_Overlay         *m_yuvsurf;
10898#endif
10999
r243410r243411
118108   int                 m_last_vofs;
119109   int                 m_old_blitwidth;
120110   int                 m_old_blitheight;
111   int                 m_last_width;
112   int                 m_last_height;
121113};
122114
123115struct sdl_scale_mode
r243410r243411
165157
166158static const sdl_scale_mode scale_modes[] =
167159{
168      { "none",    0, 0, 1, 1, SDL_DOUBLEBUF, 0, 0 },
169      { "async",   0, 0, 1, 1, SDL_DOUBLEBUF | SDL_ASYNCBLIT, 0, 0 },
160      { "none",    0, 0, 1, 1, osd_renderer::FLAG_NEEDS_DOUBLEBUF, 0, 0 },
161      { "async",   0, 0, 1, 1, osd_renderer::FLAG_NEEDS_DOUBLEBUF | osd_renderer::FLAG_NEEDS_ASYNCBLIT, 0, 0 },
170162      { "yv12",    1, 1, 1, 1, 0,              SDL_YV12_OVERLAY, yuv_RGB_to_YV12 },
171163      { "yv12x2",  1, 1, 2, 2, 0,              SDL_YV12_OVERLAY, yuv_RGB_to_YV12X2 },
172164      { "yuy2",    1, 1, 1, 1, 0,              SDL_YUY2_OVERLAY, yuv_RGB_to_YUY2 },
r243410r243411
179171      { "none",    0, 0, 1, 1, DRAW2_SCALEMODE_NEAREST, 0, 0 },
180172      { "hwblit",  1, 0, 1, 1, DRAW2_SCALEMODE_LINEAR, 0, 0 },
181173      { "hwbest",  1, 0, 1, 1, DRAW2_SCALEMODE_BEST, 0, 0 },
182      { "yv12",    1, 1, 1, 1, DRAW2_SCALEMODE_NEAREST, SDL_PIXELFORMAT_YV12, yuv_RGB_to_YV12 },
183      { "yv12x2",  1, 1, 2, 2, DRAW2_SCALEMODE_NEAREST, SDL_PIXELFORMAT_YV12, yuv_RGB_to_YV12X2 },
184      { "yuy2",    1, 1, 1, 1, DRAW2_SCALEMODE_NEAREST, SDL_PIXELFORMAT_YUY2, yuv_RGB_to_YUY2 },
185      { "yuy2x2",  1, 1, 2, 1, DRAW2_SCALEMODE_NEAREST, SDL_PIXELFORMAT_YUY2, yuv_RGB_to_YUY2X2 },
174      /* SDL1.2 uses interpolation as well */
175      { "yv12",    1, 1, 1, 1, DRAW2_SCALEMODE_BEST, SDL_PIXELFORMAT_YV12, yuv_RGB_to_YV12 },
176      { "yv12x2",  1, 1, 2, 2, DRAW2_SCALEMODE_BEST, SDL_PIXELFORMAT_YV12, yuv_RGB_to_YV12X2 },
177      { "yuy2",    1, 1, 1, 1, DRAW2_SCALEMODE_BEST, SDL_PIXELFORMAT_YUY2, yuv_RGB_to_YUY2 },
178      { "yuy2x2",  1, 1, 2, 1, DRAW2_SCALEMODE_BEST, SDL_PIXELFORMAT_YUY2, yuv_RGB_to_YUY2X2 },
186179      { NULL }
187180};
188181#endif
r243410r243411
221214   return -1;
222215}
223216
224//============================================================
225//  drawsdl_init
226//============================================================
227217
228218static osd_renderer *drawsdl_create(sdl_window_info *window)
229219{
230   return global_alloc(sdl_info(window));
220   // FIXME: QUALITY HINTS
221#if (SDLMAME_SDL2)
222   return global_alloc(sdl_info(window, osd_renderer::FLAG_NONE));
223#else
224   const sdl_scale_mode *sm = &scale_modes[video_config.scale_mode];
225   return global_alloc(sdl_info(window, sm->m_extra_flags));
226#endif
231227}
232228
229//============================================================
230//  drawsdl_init
231//============================================================
233232
234233int drawsdl_init(sdl_draw_info *callbacks)
235234{
r243410r243411
254253}
255254
256255//============================================================
257//  drawsdl_destroy_all_textures
258//============================================================
259
260void sdl_info::destroy_all_textures()
261{
262   /* nothing to be done in soft mode */
263}
264
265//============================================================
266256//  setup_texture for window
267257//============================================================
268258
r243410r243411
289279      int m_hw_scale_width =0;
290280      int m_hw_scale_height = 0;
291281
292      window().m_target->compute_minimum_size(m_hw_scale_width, m_hw_scale_height);
282      window().target()->compute_minimum_size(m_hw_scale_width, m_hw_scale_height);
293283      if (video_config.prescale)
294284      {
295285         m_hw_scale_width *= video_config.prescale;
r243410r243411
325315   const sdl_scale_mode *sdl_sm = &scale_modes[video_config.scale_mode];
326316   int minimum_width, minimum_height;
327317
328   window().m_target->compute_minimum_size(minimum_width, minimum_height);
318   window().target()->compute_minimum_size(minimum_width, minimum_height);
329319
330320   if (video_config.prescale)
331321   {
r243410r243411
349339   m_yuv_bitmap = global_alloc_array(UINT16, minimum_width*minimum_height);
350340
351341   m_yuvsurf = SDL_CreateYUVOverlay(minimum_width * sdl_sm->mult_w, minimum_height * sdl_sm->mult_h,
352         sdl_sm->pixel_format, m_sdlsurf);
342         sdl_sm->pixel_format, window().sdl_surface());
353343
354344   if ( m_yuvsurf == NULL ) {
355345      osd_printf_error("SDL: Couldn't create SDL_yuv_overlay: %s\n", SDL_GetError());
r243410r243411
429419// a
430420//============================================================
431421
432int sdl_info::create(int width, int height)
422int sdl_info::create()
433423{
434   const sdl_scale_mode *sm = &scale_modes[video_config.scale_mode];
435424
436425#if (SDLMAME_SDL2)
426   const sdl_scale_mode *sm = &scale_modes[video_config.scale_mode];
437427
438   osd_printf_verbose("Enter sdl_info::create\n");
428   // create renderer
439429
440430   /* set hints ... */
441431   SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, sm->sdl_scale_mode);
442432
443   // create the SDL window
444   // soft driver also used | SDL_WINDOW_INPUT_GRABBED | SDL_WINDOW_MOUSE_FOCUS
445   m_extra_flags = (window().fullscreen() ?
446         SDL_WINDOW_BORDERLESS | SDL_WINDOW_INPUT_FOCUS | SDL_WINDOW_FULLSCREEN : SDL_WINDOW_RESIZABLE);
447433
448#if defined(SDLMAME_WIN32)
449   SDL_SetHint(SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS, "0");
450#endif
451   window().m_sdl_window = SDL_CreateWindow(window().m_title,
452         window().monitor()->position_size().x, window().monitor()->position_size().y,
453         width, height, m_extra_flags);
454   //window().m_sdl_window = SDL_CreateWindow(window().m_title, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
455   //      width, height, m_extra_flags);
434   if (video_config.waitvsync)
435      m_sdl_renderer = SDL_CreateRenderer(window().sdl_window(), -1, SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_ACCELERATED);
436   else
437      m_sdl_renderer = SDL_CreateRenderer(window().sdl_window(), -1, SDL_RENDERER_ACCELERATED);
456438
457   if (!window().m_sdl_window )
439   if (!m_sdl_renderer)
458440   {
459      osd_printf_error("Unable to create window: %s\n", SDL_GetError());
460      return 1;
441      fatalerror("Error on creating renderer: %s\n", SDL_GetError());
461442   }
462443
463   if (window().fullscreen() && video_config.switchres)
464444   {
465      SDL_DisplayMode mode;
466      //SDL_GetCurrentDisplayMode(window().monitor()->handle, &mode);
467      SDL_GetWindowDisplayMode(window().m_sdl_window, &mode);
468      m_original_mode = mode;
469      mode.w = width;
470      mode.h = height;
471      if (window().m_refresh)
472         mode.refresh_rate = window().m_refresh;
473
474      SDL_SetWindowDisplayMode(window().m_sdl_window, &mode);    // Try to set mode
475#ifndef SDLMAME_WIN32
476      /* FIXME: Warp the mouse to 0,0 in case a virtual desktop resolution
477       * is in place after the mode switch - which will most likely be the case
478       * This is a hack to work around a deficiency in SDL2
479       */
480      SDL_WarpMouseInWindow(window().m_sdl_window, 1, 1);
481#endif
482   }
483   else
484   {
485      //SDL_SetWindowDisplayMode(window().m_sdl_window, NULL); // Use desktop
486   }
487   // create renderer
488
489   //SDL_SelectRenderer(window().sdl_window);
490
491   // show window
492
493   SDL_ShowWindow(window().m_sdl_window);
494   //SDL_SetWindowFullscreen(window().m_sdl_window, window().fullscreen);
495   SDL_RaiseWindow(window().m_sdl_window);
496
497   SDL_GetWindowSize(window().m_sdl_window, &window().m_width, &window().m_height);
498
499   /* FIXME: Bug in SDL 1.3 */
500   if (window().fullscreen())
501      SDL_SetWindowGrab(window().m_sdl_window, SDL_TRUE);
502
503   // create a texture
504
505   if (video_config.waitvsync)
506      m_sdl_renderer = SDL_CreateRenderer(window().m_sdl_window, -1, /*SDL_RENDERER_PRESENTFLIP2 | SDL_RENDERER_PRESENTDISCARD |*/ SDL_RENDERER_PRESENTVSYNC);
507   else
508      m_sdl_renderer = SDL_CreateRenderer(window().m_sdl_window, -1, /*SDL_RENDERER_PRESENTFLIP2 | SDL_RENDERER_PRESENTDISCARD*/ 0);
509
510   //SDL_SelectRenderer(window().sdl_window);
511
512   {
513445      struct SDL_RendererInfo render_info;
514446
515447      SDL_GetRendererInfo(m_sdl_renderer, &render_info);
r243410r243411
533465      }
534466   }
535467
536   setup_texture(width, height);
468   setup_texture(window().width(), window().height());
537469#else
538   m_extra_flags = (window().fullscreen() ?  SDL_FULLSCREEN : SDL_RESIZABLE);
539
540   m_extra_flags |= sm->m_extra_flags;
541
542   m_sdlsurf = SDL_SetVideoMode(width, height,
543               0, SDL_SWSURFACE | SDL_ANYFORMAT | m_extra_flags);
544
545   if (!m_sdlsurf)
546      return 1;
547   window().m_width = m_sdlsurf->w;
548   window().m_height = m_sdlsurf->h;
549   if (sm->is_yuv)
550      yuv_overlay_init();
551
552   // set the window title
553   SDL_WM_SetCaption(window().m_title, "SDLMAME");
554
555470#endif
556471
557472   m_yuv_lookup = NULL;
r243410r243411
563478}
564479
565480//============================================================
566//  sdl_info::resize
567//============================================================
568
569void sdl_info::resize(int width, int height)
570{
571#if (!SDLMAME_SDL2)
572   const sdl_scale_mode *sdl_sm = &scale_modes[video_config.scale_mode];
573#endif
574#if (SDLMAME_SDL2)
575   SDL_SetWindowSize(window().m_sdl_window, width, height);
576   SDL_GetWindowSize(window().m_sdl_window, &window().m_width, &window().m_height);
577
578#else
579   if (m_yuvsurf != NULL)
580   {
581      SDL_FreeYUVOverlay(m_yuvsurf);
582      m_yuvsurf = NULL;
583   }
584   SDL_FreeSurface(m_sdlsurf);
585   
586   m_sdlsurf = SDL_SetVideoMode(width, height, 0,
587         SDL_SWSURFACE | SDL_ANYFORMAT | m_extra_flags);
588
589   window().m_width = m_sdlsurf->w;
590   window().m_height = m_sdlsurf->h;
591
592      if (sdl_sm->is_yuv)
593   {
594      yuv_overlay_init();
595   }
596
597#endif
598}
599
600
601//============================================================
602481//  sdl_info::destroy
603482//============================================================
604483
605484void sdl_info::destroy()
606485{
607486
608#if (SDLMAME_SDL2)
609   //SDL_SelectRenderer(window().sdl_window);
610   SDL_DestroyTexture(m_texture_id);
611   //SDL_DestroyRenderer(window().sdl_window);
612   if (window().fullscreen() && video_config.switchres)
613   {
614      SDL_SetWindowFullscreen(window().m_sdl_window, 0);    // Try to set mode
615      SDL_SetWindowDisplayMode(window().m_sdl_window, &m_original_mode);    // Try to set mode
616      SDL_SetWindowFullscreen(window().m_sdl_window, SDL_WINDOW_FULLSCREEN);    // Try to set mode
617   }
618
619   SDL_DestroyWindow(window().m_sdl_window);
620#else
621   if (m_yuvsurf != NULL)
622   {
623      SDL_FreeYUVOverlay(m_yuvsurf);
624      m_yuvsurf = NULL;
625   }
626
627   if (m_sdlsurf)
628   {
629      SDL_FreeSurface(m_sdlsurf);
630      m_sdlsurf = NULL;
631   }
632#endif
633487   // free the memory in the window
634488
489   destroy_all_textures();
490
635491   if (m_yuv_lookup != NULL)
636492   {
637493      global_free_array(m_yuv_lookup);
r243410r243411
645501}
646502
647503//============================================================
648//  sdl_info::draw
504//  sdl_info::clear
649505//============================================================
650506
651507void sdl_info::clear()
652508{
509   //FIXME: Handled in sdl_info::draw as well
653510   m_blittimer = 3;
654511}
655512
r243410r243411
659516
660517int sdl_info::xy_to_render_target(int x, int y, int *xt, int *yt)
661518{
662//   const sdl_scale_mode *sm = &scale_modes[video_config.scale_mode];
663
664519   *xt = x - m_last_hofs;
665520   *yt = y - m_last_vofs;
666   if (*xt<0 || *xt >= window().m_blitwidth)
521   if (*xt<0 || *xt >= window().blitwidth())
667522      return 0;
668   if (*yt<0 || *xt >= window().m_blitheight)
523   if (*yt<0 || *yt >= window().blitheight())
669524      return 0;
670525   return 1;
671526}
672527
673528//============================================================
674//  drawsdl_window_get_primitives
529//  drawsdl_destroy_all_textures
675530//============================================================
676531
677void sdl_info::set_target_bounds()
532void sdl_info::destroy_all_textures()
678533{
679   window().m_target->set_bounds(window().m_blitwidth, window().m_blitheight, window().monitor()->aspect());
534#if (SDLMAME_SDL2)
535   SDL_DestroyTexture(m_texture_id);
536   m_texture_id = NULL;
537#else
538   if (m_yuvsurf != NULL)
539   {
540      SDL_FreeYUVOverlay(m_yuvsurf);
541      m_yuvsurf = NULL;
542   }
543#endif
680544}
681545
546
682547//============================================================
683//  drawsdl_window_draw
548//  sdl_info::draw
684549//============================================================
685550
686551int sdl_info::draw(UINT32 dc, int update)
r243410r243411
700565      return 0;
701566   }
702567
568   if ((window().width() != m_last_width) || (window().height() != m_last_height))
569   {
570      m_last_width = window().width();
571      m_last_height = window().height();
572#if (SDLMAME_SDL2)
573      SDL_RenderSetViewport(m_sdl_renderer, NULL);
574#else
575      const sdl_scale_mode *sdl_sm = &scale_modes[video_config.scale_mode];
576      if (sdl_sm->is_yuv)
577      {
578         yuv_overlay_init();
579      }
580#endif
581   }
582
703583   // lock it if we need it
704584#if (!SDLMAME_SDL2)
705585
706   pitch = m_sdlsurf->pitch;
707   bpp = m_sdlsurf->format->BytesPerPixel;
708   rmask = m_sdlsurf->format->Rmask;
709   gmask = m_sdlsurf->format->Gmask;
710   bmask = m_sdlsurf->format->Bmask;
586   pitch = window().sdl_surface()->pitch;
587   bpp = window().sdl_surface()->format->BytesPerPixel;
588   rmask = window().sdl_surface()->format->Rmask;
589   gmask = window().sdl_surface()->format->Gmask;
590   bmask = window().sdl_surface()->format->Bmask;
711591//  amask = sdlsurf->format->Amask;
712592
713   if (window().m_blitwidth != m_old_blitwidth || window().m_blitheight != m_old_blitheight)
593   if (window().blitwidth() != m_old_blitwidth || window().blitheight() != m_old_blitheight)
714594   {
715595      if (sm->is_yuv)
716596         yuv_overlay_init();
717      m_old_blitwidth = window().m_blitwidth;
718      m_old_blitheight = window().m_blitheight;
597      m_old_blitwidth = window().blitwidth();
598      m_old_blitheight = window().blitheight();
719599      m_blittimer = 3;
720600   }
721601
722   if (SDL_MUSTLOCK(m_sdlsurf))
723      SDL_LockSurface(m_sdlsurf);
602   if (SDL_MUSTLOCK(window().sdl_surface()))
603      SDL_LockSurface(window().sdl_surface());
724604
725605   // Clear if necessary
726606   if (m_blittimer > 0)
727607   {
728      memset(m_sdlsurf->pixels, 0, window().m_height * m_sdlsurf->pitch);
608      memset(window().sdl_surface()->pixels, 0, window().height() * window().sdl_surface()->pitch);
729609      m_blittimer--;
730610   }
731611
r243410r243411
743623#endif
744624   }
745625   else
746      surfptr = (UINT8 *)m_sdlsurf->pixels;
626      surfptr = (UINT8 *)window().sdl_surface()->pixels;
747627#else
748628   //SDL_SelectRenderer(window().sdl_window);
749629
750   if (window().m_blitwidth != m_old_blitwidth || window().m_blitheight != m_old_blitheight)
630   if (window().blitwidth() != m_old_blitwidth || window().blitheight() != m_old_blitheight)
751631   {
752      SDL_RenderSetViewport(m_sdl_renderer, NULL);
632      //SDL_RenderSetViewport(m_sdl_renderer, NULL);
753633
754      SDL_DestroyTexture(m_texture_id);
755      setup_texture(window().m_blitwidth, window().m_blitheight);
756      m_old_blitwidth = window().m_blitwidth;
757      m_old_blitheight = window().m_blitheight;
634      if (m_texture_id != NULL)
635         SDL_DestroyTexture(m_texture_id);
636      setup_texture(window().blitwidth(), window().blitheight());
637      m_old_blitwidth = window().blitwidth();
638      m_old_blitheight = window().blitheight();
758639      m_blittimer = 3;
759640   }
760641
r243410r243411
782663#endif
783664   // get ready to center the image
784665   vofs = hofs = 0;
785   blitwidth = window().m_blitwidth;
786   blitheight = window().m_blitheight;
666   blitwidth = window().blitwidth();
667   blitheight = window().blitheight();
787668
788669   // figure out what coordinate system to use for centering - in window mode it's always the
789670   // SDL surface size.  in fullscreen the surface covers all monitors, so center according to
r243410r243411
795676   }
796677   else
797678   {
798      ch = window().m_height;
799      cw = window().m_width;
679      ch = window().height();
680      cw = window().width();
800681   }
801682
802683   // do not crash if the window's smaller than the blit area
r243410r243411
806687   }
807688   else if (video_config.centerv)
808689   {
809      vofs = (ch - window().m_blitheight) / 2;
690      vofs = (ch - window().blitheight()) / 2;
810691   }
811692
812693   if (blitwidth > cw)
r243410r243411
815696   }
816697   else if (video_config.centerh)
817698   {
818      hofs = (cw - window().m_blitwidth) / 2;
699      hofs = (cw - window().blitwidth()) / 2;
819700   }
820701
821702   m_last_hofs = hofs;
r243410r243411
829710      if (!sm->is_yuv)
830711      {
831712         surfptr += ((vofs * pitch) + (hofs * bpp));
832         mamewidth = blitwidth; //m_sdlsurf->w;
833         mameheight = blitheight; //m_sdlsurf->h;
713         mamewidth = blitwidth; //sdl_surface()->w;
714         mameheight = blitheight; //sdl_surface()->h;
834715      }
835716      else
836717      {
r243410r243411
855736
856737   for (render_primitive *prim = window().m_primlist->first(); prim != NULL; prim = prim->next())
857738   {
858      prim->bounds.x0 *= fw;
859      prim->bounds.x1 *= fw;
860      prim->bounds.y0 *= fh;
861      prim->bounds.y1 *= fh;
739      prim->bounds.x0 = floor(fw * prim->bounds.x0 + 0.5f);
740      prim->bounds.x1 = floor(fw * prim->bounds.x1 + 0.5f);
741      prim->bounds.y0 = floor(fh * prim->bounds.y0 + 0.5f);
742      prim->bounds.y1 = floor(fh * prim->bounds.y1 + 0.5f);
862743   }
863744
864745   // render to it
r243410r243411
903784
904785   // unlock and flip
905786#if (!SDLMAME_SDL2)
906   if (SDL_MUSTLOCK(m_sdlsurf)) SDL_UnlockSurface(m_sdlsurf);
787   if (SDL_MUSTLOCK(window().sdl_surface())) SDL_UnlockSurface(window().sdl_surface());
907788   if (!sm->is_yuv)
908789   {
909      SDL_Flip(m_sdlsurf);
790      SDL_Flip(window().sdl_surface());
910791   }
911792   else
912793   {
trunk/src/osd/sdl/input.c
r243410r243411
14731473//  sdlinput_get_focus_window
14741474//============================================================
14751475
1476sdl_window_info *sdlinput_get_focus_window(running_machine &machine)
1476sdl_window_info *sdlinput_get_focus_window()
14771477{
14781478   if (focus_window)  // only be set on SDL >= 1.3
14791479      return focus_window;
r243410r243411
15471547   for (w = sdl_window_list; w != NULL; w = w->m_next)
15481548   {
15491549      //printf("w->window_id: %d\n", w->window_id);
1550      if (w->m_sdl_window == window)
1550      if (w->sdl_window() == window)
15511551      {
15521552         return w;
15531553      }
r243410r243411
15661566      {
15671567         if (w->m_resize_width && w->m_resize_height && ((now - w->m_last_resize) > osd_ticks_per_second() / 10))
15681568         {
1569            w->window_resize(w->m_resize_width, w->m_resize_height);
1569            w->resize(w->m_resize_width, w->m_resize_height);
15701570            w->m_resize_width = 0;
15711571            w->m_resize_height = 0;
15721572         }
r243410r243411
15761576
15771577#endif
15781578
1579void sdlinput_process_events_buf(running_machine &machine)
1579void sdlinput_process_events_buf()
15801580{
15811581   SDL_Event event;
15821582
r243410r243411
17601760         devinfo->keyboard.state[OSD_SDL_INDEX_KEYSYM(&event.key.keysym)] = 0x80;
17611761#if (SDLMAME_SDL2)
17621762         if (event.key.keysym.sym < 0x20)
1763            ui_input_push_char_event(machine, sdl_window_list->m_target, event.key.keysym.sym);
1763            ui_input_push_char_event(machine, sdl_window_list->target(), event.key.keysym.sym);
17641764#else
1765         ui_input_push_char_event(machine, sdl_window_list->m_target, (unicode_char) event.key.keysym.unicode);
1765         ui_input_push_char_event(machine, sdl_window_list->target(), (unicode_char) event.key.keysym.unicode);
17661766#endif
17671767         break;
17681768      case SDL_KEYUP:
r243410r243411
18641864            sdl_window_info *window = GET_FOCUS_WINDOW(&event.button);
18651865            if (window != NULL && window->xy_to_render_target(event.button.x,event.button.y, &cx, &cy) )
18661866            {
1867               ui_input_push_mouse_down_event(machine, window->m_target, cx, cy);
1867               ui_input_push_mouse_down_event(machine, window->target(), cx, cy);
18681868               // FIXME Parameter ?
18691869               if ((click-last_click < 250)
18701870                     && (cx >= last_x - 4 && cx <= last_x  + 4)
18711871                     && (cy >= last_y - 4 && cy <= last_y  + 4) )
18721872               {
18731873                  last_click = 0;
1874                  ui_input_push_mouse_double_click_event(machine, window->m_target, cx, cy);
1874                  ui_input_push_mouse_double_click_event(machine, window->target(), cx, cy);
18751875               }
18761876               else
18771877               {
r243410r243411
18981898
18991899            if (window != NULL && window->xy_to_render_target(event.button.x,event.button.y, &cx, &cy) )
19001900            {
1901               ui_input_push_mouse_up_event(machine, window->m_target, cx, cy);
1901               ui_input_push_mouse_up_event(machine, window->target(), cx, cy);
19021902            }
19031903         }
19041904         break;
r243410r243411
19221922            sdl_window_info *window = GET_FOCUS_WINDOW(&event.motion);
19231923
19241924            if (window != NULL && window->xy_to_render_target(event.motion.x, event.motion.y, &cx, &cy) )
1925               ui_input_push_mouse_move_event(machine, window->m_target, cx, cy);
1925               ui_input_push_mouse_move_event(machine, window->target(), cx, cy);
19261926         }
19271927         break;
19281928      case SDL_JOYBALLMOTION:
r243410r243411
19371937         if (!event.active.gain)
19381938         {
19391939            sdl_window_info *window = GET_FOCUS_WINDOW(&event.motion);
1940            ui_input_push_mouse_leave_event(machine, window->m_target);
1940            ui_input_push_mouse_leave_event(machine, window->target());
19411941         }
19421942         break;
19431943      case SDL_QUIT:
19441944         machine.schedule_exit();
19451945         break;
19461946      case SDL_VIDEORESIZE:
1947         sdl_window_list->window_resize(event.resize.w, event.resize.h);
1947         sdl_window_list->resize(event.resize.w, event.resize.h);
19481948         break;
19491949#else
19501950      case SDL_TEXTINPUT:
r243410r243411
19561956            if (window != NULL )
19571957            {
19581958               osd_uchar_from_osdchar(&result, event.text.text, 1);
1959               ui_input_push_char_event(machine, window->m_target, result);
1959               ui_input_push_char_event(machine, window->target(), result);
19601960            }
19611961         }
19621962         break;
r243410r243411
19731973            machine.schedule_exit();
19741974            break;
19751975         case  SDL_WINDOWEVENT_LEAVE:
1976            ui_input_push_mouse_leave_event(machine, window->m_target);
1976            ui_input_push_mouse_leave_event(machine, window->target());
19771977            app_has_mouse_focus = 0;
19781978            break;
19791979         case SDL_WINDOWEVENT_MOVED:
1980            window->window_clear();
1980            window->clear();
19811981            focus_window = window;
19821982            break;
19831983         case SDL_WINDOWEVENT_RESIZED:
r243410r243411
19971997#endif
19981998               {
19991999                  //printf("event data1,data2 %d x %d %ld\n", event.window.data1, event.window.data2, sizeof(SDL_Event));
2000                  if (event.window.data1 != window->m_width || event.window.data2 != window->m_height)
2001                     window->window_resize(event.window.data1, event.window.data2);
2000                  if (event.window.data1 != window->width() || event.window.data2 != window->height())
2001                     window->resize(event.window.data1, event.window.data2);
20022002               }
20032003            }
20042004            focus_window = window;
r243410r243411
20292029//============================================================
20302030
20312031
2032void  sdlinput_release_keys(running_machine &machine)
2032void  sdlinput_release_keys()
20332033{
20342034   // FIXME: SDL >= 1.3 will nuke the window event buffer when
20352035   // a window is closed. This will leave keys in a pressed
r243410r243411
20532053//  sdlinput_should_hide_mouse
20542054//============================================================
20552055
2056int sdlinput_should_hide_mouse(running_machine &machine)
2056int sdlinput_should_hide_mouse()
20572057{
20582058   // if we are paused, no
20592059   if (input_paused)
trunk/src/osd/sdl/input.h
r243410r243411
1919//============================================================
2020
2121void sdlinput_poll(running_machine &machine);
22int  sdlinput_should_hide_mouse(running_machine &machine);
22int  sdlinput_should_hide_mouse();
2323
24sdl_window_info *sdlinput_get_focus_window(running_machine &machine);
24sdl_window_info *sdlinput_get_focus_window();
2525
26void  sdlinput_process_events_buf(running_machine &machine);
27void  sdlinput_release_keys(running_machine &machine);
26void  sdlinput_process_events_buf();
27void  sdlinput_release_keys();
2828
2929#endif /* __SDLINPUT_H__ */
trunk/src/osd/sdl/video.c
r243410r243411
113113      sdl_window_config conf;
114114      memset(&conf, 0, sizeof(conf));
115115      get_resolution(options().resolution(), options().resolution(index), &conf, TRUE);
116      if (sdlwindow_video_window_create(machine(), index, sdl_monitor_info::pick_monitor(options(), index), &conf))
116
117      // create window ...
118      sdl_window_info *win = global_alloc(sdl_window_info(machine(), index, sdl_monitor_info::pick_monitor(options(), index), &conf));
119
120      if (win->window_init())
117121         return false;
118122   }
119123
r243410r243411
308312   {
309313//      profiler_mark(PROFILER_BLIT);
310314      for (window = sdl_window_list; window != NULL; window = window->m_next)
311         window->video_window_update(machine());
315         window->update();
312316//      profiler_mark(PROFILER_END);
313317   }
314318
r243410r243411
540544
541545static void check_osd_inputs(running_machine &machine)
542546{
543   sdl_window_info *window = sdlinput_get_focus_window(machine);
547   sdl_window_info *window = sdlinput_get_focus_window();
544548
545549   // check for toggling fullscreen mode
546550   if (ui_input_pressed(machine, IPT_OSD_1))
r243410r243411
549553
550554      while (curwin != (sdl_window_info *)NULL)
551555      {
552         curwin->toggle_full_screen(machine);
556         curwin->toggle_full_screen();
553557         curwin = curwin->m_next;
554558      }
555559   }
r243410r243411
578582   #endif
579583
580584   if (ui_input_pressed(machine, IPT_OSD_6))
581      window->modify_prescale(machine, -1);
585      window->modify_prescale(-1);
582586
583587   if (ui_input_pressed(machine, IPT_OSD_7))
584      window->modify_prescale(machine, 1);
588      window->modify_prescale(1);
585589}
586590
587591//============================================================
trunk/src/osd/sdl/window.c
r243410r243411
100100
101101struct worker_param {
102102   worker_param()
103   : m_window(NULL), m_list(NULL), m_machine(NULL), m_resize_new_width(0), m_resize_new_height(0)
103   : m_window(NULL), m_list(NULL), m_resize_new_width(0), m_resize_new_height(0)
104104   {
105105   }
106   worker_param(running_machine &amachine, sdl_window_info *awindow)
107   : m_window(awindow), m_list(NULL), m_machine(&amachine), m_resize_new_width(0), m_resize_new_height(0)
106   worker_param(sdl_window_info *awindow, render_primitive_list &alist)
107   : m_window(awindow), m_list(&alist), m_resize_new_width(0), m_resize_new_height(0)
108108   {
109109   }
110   worker_param(running_machine &amachine, sdl_window_info *awindow, render_primitive_list &alist)
111   : m_window(awindow), m_list(&alist), m_machine(&amachine), m_resize_new_width(0), m_resize_new_height(0)
112   {
113   }
114110   worker_param(sdl_window_info *awindow, int anew_width, int anew_height)
115   : m_window(awindow), m_list(NULL), m_machine(NULL), m_resize_new_width(anew_width), m_resize_new_height(anew_height)
111   : m_window(awindow), m_list(NULL), m_resize_new_width(anew_width), m_resize_new_height(anew_height)
116112   {
117113   }
118114   worker_param(sdl_window_info *awindow)
119   : m_window(awindow), m_list(NULL), m_machine(NULL), m_resize_new_width(0), m_resize_new_height(0)
115   : m_window(awindow), m_list(NULL), m_resize_new_width(0), m_resize_new_height(0)
120116   {
121117   }
122   running_machine &machine() const { assert(m_machine != NULL); return *m_machine; }
123118   sdl_window_info *window() const { assert(m_window != NULL); return m_window; }
124119   render_primitive_list *list() const { return m_list; }
125120   int new_width() const { return m_resize_new_width; }
r243410r243411
129124private:
130125   sdl_window_info *m_window;
131126   render_primitive_list *m_list;
132   running_machine *m_machine;
133127   int m_resize_new_width;
134128   int m_resize_new_height;
135129};
r243410r243411
139133//  PROTOTYPES
140134//============================================================
141135
142static void sdlwindow_update_cursor_state(running_machine &machine, sdl_window_info *window);
143136static void sdlwindow_sync(void);
144137
145static void set_starting_view(running_machine &machine, int index, sdl_window_info *window, const char *defview, const char *view);
146
147138//============================================================
148139//  execute_async
149140//============================================================
r243410r243411
275266         SDL_HINT_RENDER_VSYNC,
276267         SDL_HINT_VIDEO_X11_XVIDMODE, SDL_HINT_VIDEO_X11_XINERAMA,
277268         SDL_HINT_VIDEO_X11_XRANDR, SDL_HINT_GRAB_KEYBOARD,
278         SDL_HINT_MOUSE_RELATIVE_MODE_WARP,
279269         SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS, SDL_HINT_IDLE_TIMER_DISABLED,
280270         SDL_HINT_ORIENTATIONS,
281271         SDL_HINT_XINPUT_ENABLED, SDL_HINT_GAMECONTROLLERCONFIG,
r243410r243411
285275         SDL_HINT_RENDER_DIRECT3D_THREADSAFE, SDL_HINT_VIDEO_ALLOW_SCREENSAVER,
286276         SDL_HINT_ACCELEROMETER_AS_JOYSTICK, SDL_HINT_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK,
287277         SDL_HINT_VIDEO_WIN_D3DCOMPILER, SDL_HINT_VIDEO_WINDOW_SHARE_PIXEL_FORMAT,
288         SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES,
278         SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES, SDL_HINT_MOUSE_RELATIVE_MODE_WARP,
289279#endif
290280#if SDL_VERSION_ATLEAST(2, 0, 3)
291281         SDL_HINT_RENDER_DIRECT3D11_DEBUG, SDL_HINT_VIDEO_HIGHDPI_DISABLED,
r243410r243411
355345   {
356346      sdl_window_info *temp = sdl_window_list;
357347      sdl_window_list = temp->m_next;
358      temp->video_window_destroy(machine());
348      temp->destroy();
359349      // free the window itself
360350      global_free(temp);
361351   }
r243410r243411
464454      newwidth = window_width;
465455
466456   if ((m_blitwidth != newwidth) || (m_blitheight != newheight))
467      window_clear();
457      clear();
468458
469459   m_blitwidth = newwidth;
470460   m_blitheight = newheight;
r243410r243411
480470{
481471   worker_param *      wp = (worker_param *) param;
482472   sdl_window_info *   window = wp->window();
473   int width = wp->new_width();
474   int height = wp->new_height();
483475
484476   ASSERT_WINDOW_THREAD();
485477
486478   window->renderer().destroy_all_textures();
487   window->renderer().resize(wp->new_width(), wp->new_height());
488479
489   window->blit_surface_size(wp->new_width(), wp->new_height());
480#if (SDLMAME_SDL2)
481   SDL_SetWindowSize(window->sdl_window(), width, height);
482   SDL_GetWindowSize(window->sdl_window(), &window->m_width, &window->m_height);
483#else
484   SDL_FreeSurface(window->m_sdlsurf);
490485
491   window->window_clear();
486   window->m_sdlsurf = SDL_SetVideoMode(width, height, 0,
487         SDL_SWSURFACE | SDL_ANYFORMAT | window->m_extra_flags);
492488
489   window->m_width = window->m_sdlsurf->w;
490   window->m_height = window->m_sdlsurf->h;
491#endif
492
493   window->blit_surface_size(window->m_width, window->m_height);
494
495   window->clear();
496
493497   osd_free(wp);
494498   return NULL;
495499}
496500
497void sdl_window_info::window_resize(INT32 width, INT32 height)
501void sdl_window_info::resize(INT32 width, INT32 height)
498502{
499503   ASSERT_MAIN_THREAD();
500504
501   if (width == this->m_width && height == this->m_height)
505   if (width == this->width() && height == this->height())
502506      return;
503507
504508   execute_async_wait(&sdlwindow_resize_wt, worker_param(this, width, height));
r243410r243411
522526   return NULL;
523527}
524528
525void sdl_window_info::window_clear()
529void sdl_window_info::clear()
526530{
527531   worker_param wp;
528532
r243410r243411
554558   // If we are going fullscreen (leaving windowed) remember our windowed size
555559   if (!window->fullscreen())
556560   {
557      window->m_windowed_width = window->m_width;
558      window->m_windowed_height = window->m_height;
561      window->m_windowed_width = window->width();
562      window->m_windowed_height = window->height();
559563   }
560564
561565   window->renderer().destroy();
562   sdlinput_release_keys(wp->machine());
563566
567#if (SDLMAME_SDL2)
568   if (window->fullscreen() && video_config.switchres)
569   {
570      SDL_SetWindowFullscreen(window->sdl_window(), 0);    // Try to set mode
571      SDL_SetWindowDisplayMode(window->sdl_window(), &window->m_original_mode);    // Try to set mode
572      SDL_SetWindowFullscreen(window->sdl_window(), SDL_WINDOW_FULLSCREEN);    // Try to set mode
573   }
574   SDL_DestroyWindow(window->sdl_window());
575#else
576   if (window->m_sdlsurf)
577   {
578      SDL_FreeSurface(window->m_sdlsurf);
579      window->m_sdlsurf = NULL;
580   }
581#endif
582
583
584   sdlinput_release_keys();
585
564586   // toggle the window mode
565587   window->set_fullscreen(!window->fullscreen());
566588
r243410r243411
569591   return NULL;
570592}
571593
572void sdl_window_info::toggle_full_screen(running_machine &machine)
594void sdl_window_info::toggle_full_screen()
573595{
574596   ASSERT_MAIN_THREAD();
575597
576   execute_async_wait(&sdlwindow_toggle_full_screen_wt, worker_param(machine, this));
598   execute_async_wait(&sdlwindow_toggle_full_screen_wt, worker_param(this));
577599}
578600
579601OSDWORK_CALLBACK( sdl_window_info::destroy_all_textures_wt )
r243410r243411
588610   return NULL;
589611}
590612
591void sdl_window_info::modify_prescale(running_machine &machine, int dir)
613void sdl_window_info::modify_prescale(int dir)
592614{
593   worker_param wp = worker_param(machine, this);
594   int new_prescale = m_prescale;
615   worker_param wp = worker_param(this);
616   int new_prescale = prescale();
595617
596   if (dir > 0 && m_prescale < 3)
597      new_prescale = m_prescale + 1;
598   if (dir < 0 && m_prescale > 1)
599      new_prescale = m_prescale - 1;
618   if (dir > 0 && prescale() < 3)
619      new_prescale = prescale() + 1;
620   if (dir < 0 && prescale() > 1)
621      new_prescale = prescale() - 1;
600622
601   if (new_prescale != m_prescale)
623   if (new_prescale != prescale())
602624   {
603625      if (m_fullscreen && video_config.switchres)
604626      {
r243410r243411
614636         execute_async_wait(destroy_all_textures_wt, wp);
615637         m_prescale = new_prescale;
616638      }
617      machine.ui().popup_time(1, "Prescale %d", m_prescale);
639      machine().ui().popup_time(1, "Prescale %d", prescale());
618640   }
619641}
620642
r243410r243411
623645//  (main or window thread)
624646//============================================================
625647
626static void sdlwindow_update_cursor_state(running_machine &machine, sdl_window_info *window)
648void sdl_window_info::update_cursor_state()
627649{
628650#if (USE_XINPUT)
629651   // Hack for wii-lightguns:
r243410r243411
638660#if (SDLMAME_SDL2)
639661   // do not do mouse capture if the debugger's enabled to avoid
640662   // the possibility of losing control
641   if (!(machine.debug_flags & DEBUG_FLAG_OSD_ENABLED))
663   if (!(machine().debug_flags & DEBUG_FLAG_OSD_ENABLED))
642664   {
643665      //FIXME: SDL1.3: really broken: the whole SDL code
644666      //       will only work correct with relative mouse movements ...
645      if (!window->fullscreen() && !sdlinput_should_hide_mouse(machine))
667      if (!fullscreen() && !sdlinput_should_hide_mouse())
646668      {
647669         SDL_ShowCursor(SDL_ENABLE);
648         if (SDL_GetWindowGrab(window->m_sdl_window ))
649            SDL_SetWindowGrab(window->m_sdl_window, SDL_FALSE);
670         if (SDL_GetWindowGrab(sdl_window() ))
671            SDL_SetWindowGrab(sdl_window(), SDL_FALSE);
650672         SDL_SetRelativeMouseMode(SDL_FALSE);
651673      }
652674      else
653675      {
654676         SDL_ShowCursor(SDL_DISABLE);
655         if (!SDL_GetWindowGrab(window->m_sdl_window))
656            SDL_SetWindowGrab(window->m_sdl_window, SDL_TRUE);
677         if (!SDL_GetWindowGrab(sdl_window()))
678            SDL_SetWindowGrab(sdl_window(), SDL_TRUE);
657679         SDL_SetRelativeMouseMode(SDL_TRUE);
658680      }
659681      SDL_SetCursor(NULL); // Force an update in case the underlying driver has changed visibility
r243410r243411
662684#else
663685   // do not do mouse capture if the debugger's enabled to avoid
664686   // the possibility of losing control
665   if (!(machine.debug_flags & DEBUG_FLAG_OSD_ENABLED))
687   if (!(machine().debug_flags & DEBUG_FLAG_OSD_ENABLED))
666688   {
667      if ( window->fullscreen() || sdlinput_should_hide_mouse(machine) )
689      if ( fullscreen() || sdlinput_should_hide_mouse() )
668690      {
669691         SDL_ShowCursor(SDL_DISABLE);
670692         if (!SDL_WM_GrabInput(SDL_GRAB_QUERY))
r243410r243411
685707#endif
686708}
687709
688static OSDWORK_CALLBACK( sdlwindow_update_cursor_state_wt )
710OSDWORK_CALLBACK( sdl_window_info::update_cursor_state_wt )
689711{
690712   worker_param *      wp = (worker_param *) param;
691   //sdl_window_info *   window = wp->window;
713   sdl_window_info *   window = wp->window();
692714
693   sdlwindow_update_cursor_state(wp->machine(), wp->window());
715   window->update_cursor_state();
694716
695717   osd_free(wp);
696718   return NULL;
r243410r243411
706728//  (main thread)
707729//============================================================
708730
709int sdlwindow_video_window_create(running_machine &machine, int index, sdl_monitor_info *monitor, const sdl_window_config *config)
731int sdl_window_info::window_init()
710732{
711   sdl_window_info *window;
712733   worker_param *wp = (worker_param *) osd_malloc(sizeof(worker_param));
713734   int result;
714735
715736   ASSERT_MAIN_THREAD();
716737
717   // allocate a new window object
718   window = global_alloc(sdl_window_info(&machine, monitor, index, config));
719
720738   // set the initial maximized state
721739   // FIXME: Does not belong here
722   sdl_options &options = downcast<sdl_options &>(machine.options());
723   window->m_startmaximized = options.maximize();
740   sdl_options &options = downcast<sdl_options &>(m_machine.options());
741   m_startmaximized = options.maximize();
724742
725743   // add us to the list
726   *last_window_ptr = window;
727   last_window_ptr = &window->m_next;
744   *last_window_ptr = this;
745   last_window_ptr = &this->m_next;
728746
729   window->set_renderer(draw.create(window));
747   set_renderer(draw.create(this));
730748
731749   // create an event that we can use to skip blitting
732   window->m_rendered_event = osd_event_alloc(FALSE, TRUE);
750   m_rendered_event = osd_event_alloc(FALSE, TRUE);
733751
734752   // load the layout
735   window->m_target = machine.render().target_alloc();
753   m_target = m_machine.render().target_alloc();
736754
737755   // set the specific view
738   set_starting_view(machine, index, window, options.view(), options.view(index));
756   set_starting_view(m_machine, m_index, options.view(), options.view(m_index));
739757
740758   // make the window title
741759   if (video_config.numscreens == 1)
742      sprintf(window->m_title, "%s: %s [%s]", emulator_info::get_appname(), machine.system().description, machine.system().name);
760      sprintf(m_title, "%s: %s [%s]", emulator_info::get_appname(), m_machine.system().description, m_machine.system().name);
743761   else
744      sprintf(window->m_title, "%s: %s [%s] - Screen %d", emulator_info::get_appname(), machine.system().description, machine.system().name, index);
762      sprintf(m_title, "%s: %s [%s] - Screen %d", emulator_info::get_appname(), m_machine.system().description, m_machine.system().name, m_index);
745763
746   wp->set_window(window);
764   wp->set_window(this);
747765
748766   // FIXME: pass error back in a different way
749767   if (multithreading_enabled)
r243410r243411
765783   return 0;
766784
767785error:
768   window->video_window_destroy(machine);
769   // free the window itself
770   global_free(window);
786   destroy();
771787   return 1;
772788}
773789
r243410r243411
787803   // free the textures etc
788804   window->renderer().destroy();
789805
806#if (SDLMAME_SDL2)
807   if (window->fullscreen() && video_config.switchres)
808   {
809      SDL_SetWindowFullscreen(window->sdl_window(), 0);    // Try to set mode
810      SDL_SetWindowDisplayMode(window->sdl_window(), &window->m_original_mode);    // Try to set mode
811      SDL_SetWindowFullscreen(window->sdl_window(), SDL_WINDOW_FULLSCREEN);    // Try to set mode
812   }
813   SDL_DestroyWindow(window->sdl_window());
814#else
815   if (window->m_sdlsurf)
816   {
817      SDL_FreeSurface(window->m_sdlsurf);
818      window->m_sdlsurf = NULL;
819   }
820#endif
821
790822   // release all keys ...
791   sdlinput_release_keys(wp->machine());
823   sdlinput_release_keys();
792824
793825
794826   osd_free(wp);
795827   return NULL;
796828}
797829
798void sdl_window_info::video_window_destroy(running_machine &machine)
830void sdl_window_info::destroy()
799831{
800832   sdl_window_info **prevptr;
801833
r243410r243411
816848      }
817849
818850   // free the textures etc
819   execute_async_wait(&sdlwindow_video_window_destroy_wt, worker_param(machine, this));
851   execute_async_wait(&sdlwindow_video_window_destroy_wt, worker_param(this));
820852
821853   // free the render target, after the textures!
822854   this->machine().render().target_free(m_target);
r243410r243411
843875   m_target->compute_minimum_size(minimum_width, minimum_height);
844876
845877   // use those as the target for now
846   target_width = minimum_width * MAX(1, m_prescale);
847   target_height = minimum_height * MAX(1, m_prescale);
878   target_width = minimum_width * MAX(1, prescale());
879   target_height = minimum_height * MAX(1, prescale());
848880
849881   // if we're not stretching, allow some slop on the minimum since we can handle it
850882   {
r243410r243411
910942   m_target->compute_minimum_size(minimum_width, minimum_height);
911943
912944   // use those as the target for now
913   target_width = minimum_width * MAX(1, m_prescale);
914   target_height = minimum_height * MAX(1, m_prescale);
945   target_width = minimum_width * MAX(1, prescale());
946   target_height = minimum_height * MAX(1, prescale());
915947
916948   // if we're not stretching, allow some slop on the minimum since we can handle it
917949   {
r243410r243411
9791011//  (main thread)
9801012//============================================================
9811013
982void sdl_window_info::video_window_update(running_machine &machine)
1014void sdl_window_info::update()
9831015{
9841016   osd_ticks_t     event_wait_ticks;
9851017   ASSERT_MAIN_THREAD();
r243410r243411
9871019   // adjust the cursor state
9881020   //sdlwindow_update_cursor_state(machine, window);
9891021
990   execute_async(&sdlwindow_update_cursor_state_wt, worker_param(machine, this));
1022   execute_async(&update_cursor_state_wt, worker_param(this));
9911023
9921024   // if we're visible and running and not in the middle of a resize, draw
9931025   if (m_target != NULL)
r243410r243411
10031035
10041036         if (!this->m_fullscreen)
10051037         {
1006            blit_surface_size(m_width, m_height);
1038            blit_surface_size(width(), height());
10071039            //Don't resize window without user interaction;
10081040            //window_resize(blitwidth, blitheight);
10091041         }
10101042         else if (video_config.switchres)
10111043         {
10121044            this->pick_best_mode(&tempwidth, &tempheight);
1013            window_resize(tempwidth, tempheight);
1045            resize(tempwidth, tempheight);
10141046         }
10151047      }
10161048
r243410r243411
10311063         }
10321064
10331065         // ensure the target bounds are up-to-date, and then get the primitives
1034         renderer().set_target_bounds();
10351066
1067         m_target->set_bounds(m_blitwidth, m_blitheight, monitor()->aspect());
1068
10361069         render_primitive_list &primlist = m_target->get_primitives();
10371070
10381071         // and redraw now
10391072
1040         execute_async(&draw_video_contents_wt, worker_param(machine, this, primlist));
1073         execute_async(&draw_video_contents_wt, worker_param(this, primlist));
10411074      }
10421075   }
10431076}
r243410r243411
10481081//  (main thread)
10491082//============================================================
10501083
1051static void set_starting_view(running_machine &machine, int index, sdl_window_info *window, const char *defview, const char *view)
1084void sdl_window_info::set_starting_view(running_machine &machine, int index, const char *defview, const char *view)
10521085{
10531086   int viewindex;
10541087
r243410r243411
10591092      view = defview;
10601093
10611094   // query the video system to help us pick a view
1062   viewindex = window->m_target->configured_view(view, index, video_config.numscreens);
1095   viewindex = target()->configured_view(view, index, video_config.numscreens);
10631096
10641097   // set the view
1065   window->m_target->set_view(viewindex);
1066   window->m_start_viewscreen=viewindex;
1098   target()->set_view(viewindex);
1099   m_start_viewscreen=viewindex;
10671100}
10681101
10691102
r243410r243411
11191152      }
11201153   }
11211154
1155
1156   // create the window .....
1157
1158   /* FIXME: On Ubuntu and potentially other Linux OS you should use
1159    * to disable panning. This has to be done before every invocation of mame.
1160    *
1161    * xrandr --output HDMI-0 --panning 0x0+0+0 --fb 0x0
1162    *
1163    */
1164   osd_printf_verbose("Enter sdl_info::create\n");
1165
1166#if (SDLMAME_SDL2)
1167
1168   if (window->renderer().check_flag(osd_renderer::FLAG_NEEDS_OPENGL))
1169   {
1170      SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );
1171
1172      /* FIXME: A reminder that gamma is wrong throughout MAME. Currently, SDL2.0 doesn't seem to
1173         * support the following attribute although my hardware lists GL_ARB_framebuffer_sRGB as an extension.
1174         *
1175         * SDL_GL_SetAttribute( SDL_GL_FRAMEBUFFER_SRGB_CAPABLE, 1 );
1176         *
1177         */
1178      window->m_extra_flags = SDL_WINDOW_OPENGL;
1179   }
1180   else
1181      window->m_extra_flags = 0;
1182
1183   // create the SDL window
1184   // soft driver also used | SDL_WINDOW_INPUT_GRABBED | SDL_WINDOW_MOUSE_FOCUS
1185   window->m_extra_flags |= (window->fullscreen() ?
1186         SDL_WINDOW_BORDERLESS | SDL_WINDOW_INPUT_FOCUS | SDL_WINDOW_FULLSCREEN : SDL_WINDOW_RESIZABLE);
1187
1188#if defined(SDLMAME_WIN32)
1189   SDL_SetHint(SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS, "0");
1190#endif
1191   // create the SDL window
1192   window->m_sdl_window = SDL_CreateWindow(window->m_title,
1193         window->monitor()->position_size().x, window->monitor()->position_size().y,
1194         tempwidth, tempheight, window->m_extra_flags);
1195   //window().sdl_window() = SDL_CreateWindow(window().m_title, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
1196   //      width, height, m_extra_flags);
1197
1198   if  ( window->m_sdl_window == NULL )
1199   {
1200      if (window->renderer().check_flag(osd_renderer::FLAG_NEEDS_OPENGL))
1201         osd_printf_error("OpenGL not supported on this driver: %s\n", SDL_GetError());
1202      else
1203         osd_printf_error("Window creation failed: %s\n", SDL_GetError());
1204      return (void *) &result[1];
1205   }
1206
1207   if (window->fullscreen() && video_config.switchres)
1208   {
1209      SDL_DisplayMode mode;
1210      //SDL_GetCurrentDisplayMode(window().monitor()->handle, &mode);
1211      SDL_GetWindowDisplayMode(window->sdl_window(), &mode);
1212      window->m_original_mode = mode;
1213      mode.w = tempwidth;
1214      mode.h = tempheight;
1215      if (window->m_refresh)
1216         mode.refresh_rate = window->m_refresh;
1217
1218      SDL_SetWindowDisplayMode(window->sdl_window(), &mode);    // Try to set mode
1219#ifndef SDLMAME_WIN32
1220      /* FIXME: Warp the mouse to 0,0 in case a virtual desktop resolution
1221       * is in place after the mode switch - which will most likely be the case
1222       * This is a hack to work around a deficiency in SDL2
1223       */
1224      SDL_WarpMouseInWindow(window->sdl_window(), 1, 1);
1225#endif
1226   }
1227   else
1228   {
1229      //SDL_SetWindowDisplayMode(window().sdl_window(), NULL); // Use desktop
1230   }
1231
1232   // show window
1233
1234   SDL_ShowWindow(window->sdl_window());
1235   //SDL_SetWindowFullscreen(window().sdl_window(), window().fullscreen);
1236   SDL_RaiseWindow(window->sdl_window());
1237
1238   SDL_GetWindowSize(window->sdl_window(), &window->m_width, &window->m_height);
1239
1240#else
1241   window->m_extra_flags = (window->fullscreen() ?  SDL_FULLSCREEN : SDL_RESIZABLE);
1242
1243   if (window->renderer().check_flag(osd_renderer::FLAG_NEEDS_DOUBLEBUF))
1244      window->m_extra_flags |= SDL_DOUBLEBUF;
1245   if (window->renderer().check_flag(osd_renderer::FLAG_NEEDS_ASYNCBLIT))
1246      window->m_extra_flags |= SDL_ASYNCBLIT;
1247
1248   if (window->renderer().check_flag(osd_renderer::FLAG_NEEDS_OPENGL))
1249 {
1250      window->m_extra_flags |= SDL_DOUBLEBUF | SDL_OPENGL;
1251      SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );
1252      #if (SDL_VERSION_ATLEAST(1,2,10)) && (!defined(SDLMAME_EMSCRIPTEN))
1253      SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, video_config.waitvsync ? 1 : 0);
1254      #endif
1255         //load_gl_lib(window->machine());
1256 }
1257
1258   // create the SDL surface (which creates the window in windowed mode)
1259   window->m_sdlsurf = SDL_SetVideoMode(tempwidth, tempheight,
1260                     0, SDL_SWSURFACE  | SDL_ANYFORMAT | window->m_extra_flags);
1261
1262   if (!window->m_sdlsurf)
1263      return (void *) &result[1];
1264   if ( (video_config.mode  == VIDEO_MODE_OPENGL) && !(window->m_sdlsurf->flags & SDL_OPENGL) )
1265   {
1266      osd_printf_error("OpenGL not supported on this driver!\n");
1267      return (void *) &result[1];
1268   }
1269
1270   window->m_width = window->m_sdlsurf->w;
1271   window->m_height = window->m_sdlsurf->h;
1272
1273   // set the window title
1274   SDL_WM_SetCaption(window->m_title, "SDLMAME");
1275#endif
1276
11221277   // initialize the drawing backend
1123   if (window->renderer().create(tempwidth, tempheight))
1278   if (window->renderer().create())
11241279      return (void *) &result[1];
11251280
11261281   // Make sure we have a consistent state
r243410r243411
11881343   ASSERT_REDRAW_THREAD();
11891344
11901345   // Some configurations require events to be polled in the worker thread
1191   sdlinput_process_events_buf(wp->machine());
1346   sdlinput_process_events_buf();
11921347
11931348   window->m_primlist = wp->list();
11941349
trunk/src/osd/sdl/window.h
r243410r243411
3737class osd_renderer
3838{
3939public:
40   osd_renderer(sdl_window_info *window)
41   : m_window(window) { }
4240
41   /* Generic flags */
42   static const int FLAG_NONE                = 0x0000;
43   static const int FLAG_NEEDS_OPENGL          = 0x0001;
44
45#if (!(SDLMAME_SDL2))
46   /* SDL 1.2 flags */
47   static const int FLAG_NEEDS_DOUBLEBUF       = 0x0100;
48   static const int FLAG_NEEDS_ASYNCBLIT       = 0x0200;
49#endif
50
51   osd_renderer(sdl_window_info *window, const int flags)
52   : m_window(window), m_flags(flags) { }
53
4354   virtual ~osd_renderer() { }
4455
4556   sdl_window_info &window() { return *m_window; }
57   int flags() const { return m_flags; }
58   bool check_flag(const int flag) { return ((m_flags & flag)) == flag; }
4659
47   virtual int create(int width, int height) = 0;
48   virtual void resize(int width, int height) = 0;
49   virtual int draw(UINT32 dc, int update) = 0;
50   virtual void set_target_bounds() = 0;
51   virtual int xy_to_render_target(int x, int y, int *xt, int *yt) = 0;
60   virtual int create() = 0;
61   virtual int draw(const UINT32 dc, const int update) = 0;
62   virtual int xy_to_render_target(const int x, const int y, int *xt, int *yt) = 0;
5263   virtual void destroy_all_textures() = 0;
5364   virtual void destroy() = 0;
5465   virtual void clear() = 0;
5566
5667private:
5768   sdl_window_info *m_window;
69   int m_flags;
5870};
5971
6072#define OSDWORK_CALLBACK(name)  void *name(void *param, ATTR_UNUSED int threadid)
r243410r243411
6274class sdl_window_info
6375{
6476public:
65   sdl_window_info(running_machine *a_machine, sdl_monitor_info *a_monitor,
66         int index, const sdl_window_config *config)
67   : m_next(NULL), m_minwidth(0), m_minheight(0),
68      m_startmaximized(0),
69      m_rendered_event(0), m_target(0), m_primlist(NULL),
70      m_width(0), m_height(0), m_blitwidth(0), m_blitheight(0),
77   sdl_window_info(running_machine &a_machine, int index, sdl_monitor_info *a_monitor,
78         const sdl_window_config *config)
79   : m_next(NULL), m_primlist(NULL),
7180      m_start_viewscreen(0),
81      // Following three are used by input code to defer resizes
7282#if (SDLMAME_SDL2)
73      m_sdl_window(NULL),
7483      m_resize_width(0),
7584      m_resize_height(0),
7685      m_last_resize(0),
86#endif
87       m_minwidth(0), m_minheight(0),
88      m_rendered_event(0), m_target(0),
89      m_width(0), m_height(0), m_blitwidth(0), m_blitheight(0),
90#if (SDLMAME_SDL2)
91      m_sdl_window(NULL),
92
7793#else
78      m_screen_width(0), m_screen_height(0),
94      m_sdlsurf(NULL),
7995#endif
8096      m_machine(a_machine), m_monitor(a_monitor), m_fullscreen(0), m_index(0)
8197   {
r243410r243411
98114      global_free(m_renderer);
99115   }
100116
101   void video_window_update(running_machine &machine);
102   void toggle_full_screen(running_machine &machine);
103   void modify_prescale(running_machine &machine, int dir);
104   void window_resize(INT32 width, INT32 height);
105   void window_clear();
117   int window_init();
106118
107   void video_window_destroy(running_machine &machine);
108   void get_min_bounds(int *window_width, int *window_height, int constrain);
109   void get_max_bounds(int *window_width, int *window_height, int constrain);
119   void update();
120   void toggle_full_screen();
121   void modify_prescale(int dir);
122   void resize(INT32 width, INT32 height);
123   void destroy();
124   void clear();
125   int xy_to_render_target(int x, int y, int *xt, int *yt);
110126
111   running_machine &machine() const { assert(m_machine != NULL); return *m_machine; }
127   running_machine &machine() const { return m_machine; }
112128   sdl_monitor_info *monitor() const { return m_monitor; }
113129   int fullscreen() const { return m_fullscreen; }
114130
115   void set_fullscreen(int afullscreen) { m_fullscreen = afullscreen; }
116
117   void blit_surface_size(int window_width, int window_height);
118   void pick_best_mode(int *fswidth, int *fsheight);
119131   int index() const { return m_index; }
120132
121   int xy_to_render_target(int x, int y, int *xt, int *yt);
133   render_target *target() { return m_target; }
134#if (SDLMAME_SDL2)
135   SDL_Window *sdl_window() { return m_sdl_window; }
136#else
137   SDL_Surface *sdl_surface() { return m_sdlsurf; }
138#endif
139   int   width() const { return m_width; }
140   int height() const { return m_height; }
122141
142   int   blitwidth() const { return m_blitwidth; }
143   int blitheight() const { return m_blitheight; }
144   int prescale() const { return m_prescale; }
145
123146   // Pointer to next window
124147   sdl_window_info *   m_next;
125148
149   // FIXME: renderer should deal with this
150   render_primitive_list *m_primlist;
151   int                 m_start_viewscreen;
152#if (SDLMAME_SDL2)
153   // These are used in combine resizing events ... #if SDL13_COMBINE_RESIZE
154   int                 m_resize_width;
155   int                 m_resize_height;
156   osd_ticks_t         m_last_resize;
157#endif
158
159private:
126160   // window handle and info
127161   char                m_title[256];
162   int                 m_startmaximized;
128163
129164   // diverse flags
130165   int                 m_minwidth, m_minheight;
131166   int                 m_maxwidth, m_maxheight;
167   int                 m_refresh;
132168   int                 m_depth;
133   int                 m_refresh;
134169   int                 m_windowed_width;
135170   int                 m_windowed_height;
136   int                 m_startmaximized;
137171
138172   // rendering info
139173   osd_event *         m_rendered_event;
140174   render_target *     m_target;
141   render_primitive_list *m_primlist;
142175
143   // cache of physical m_width and m_height
176   // cache of physical width() and height()
144177   int                 m_width;
145178   int                 m_height;
146179
147   // current m_blitwidth and m_height
180   // current m_blitwidth and height()
148181   int                 m_blitwidth;
149182   int                 m_blitheight;
150183
151   int                 m_start_viewscreen;
152184
153   // GL specific
154185   int                 m_prescale;
155186
156187#if (SDLMAME_SDL2)
157188   // Needs to be here as well so we can identify window
158189   SDL_Window          *m_sdl_window;
159   // These are used in combine resizing events ... #if SDL13_COMBINE_RESIZE
160   int                 m_resize_width;
161   int                 m_resize_height;
162   osd_ticks_t         m_last_resize;
190   // Original display_mode
191   SDL_DisplayMode m_original_mode;
163192#else
164   int                 m_screen_width;
165   int                 m_screen_height;
193   // SDL surface
194   SDL_Surface         *m_sdlsurf;
166195#endif
167196
197   int             m_extra_flags;
198
168199   void set_renderer(osd_renderer *renderer)
169200   {
170201      m_renderer = renderer;
r243410r243411
175206   osd_renderer &renderer() { return *m_renderer; }
176207private:
177208   void constrain_to_aspect_ratio(int *window_width, int *window_height, int adjustment);
209   void update_cursor_state();
210   void blit_surface_size(int window_width, int window_height);
211   void pick_best_mode(int *fswidth, int *fsheight);
212   void set_starting_view(running_machine &machine, int index, const char *defview, const char *view);
213   void get_min_bounds(int *window_width, int *window_height, int constrain);
214   void get_max_bounds(int *window_width, int *window_height, int constrain);
215   void set_fullscreen(int afullscreen) { m_fullscreen = afullscreen; }
178216
217
218
219
179220   // Pointer to machine
180   running_machine *   m_machine;
221   running_machine &   m_machine;
181222   // monitor info
182223   sdl_monitor_info *  m_monitor;
183224   int                 m_fullscreen;
r243410r243411
192233   static OSDWORK_CALLBACK( sdlwindow_toggle_full_screen_wt );
193234   static OSDWORK_CALLBACK( sdlwindow_clear_surface_wt );
194235   static OSDWORK_CALLBACK( destroy_all_textures_wt );
236   static OSDWORK_CALLBACK( update_cursor_state_wt );
195237
196238   void measure_fps(UINT32 dc, int update);
197239
r243410r243411
214256//  PROTOTYPES
215257//============================================================
216258
217// creation/deletion of windows
218int sdlwindow_video_window_create(running_machine &machine, int index, sdl_monitor_info *monitor, const sdl_window_config *config);
219
220259//============================================================
221260// PROTOTYPES - drawsdl.c
222261//============================================================
trunk/src/osd/windows/d3dhlsl.c
r243410r243411
224224   if (!master_enable || !d3dintf->post_fx_available)
225225      return;
226226
227   renderer *d3d = (renderer *)window->m_drawdata;
227   renderer *d3d = dynamic_cast<renderer *>(window->m_renderer);
228228
229229   HRESULT result = (*d3dintf->device.create_texture)(d3d->get_device(), snap_width, snap_height, 1, D3DUSAGE_DYNAMIC, D3DFMT_A8R8G8B8, D3DPOOL_SYSTEMMEM, &snap_copy_texture);
230230   if (result != D3D_OK)
r243410r243411
276276   if (!master_enable || !d3dintf->post_fx_available)
277277      return;
278278
279   renderer *d3d = (renderer *)window->m_drawdata;
279   renderer *d3d = dynamic_cast<renderer *>(window->m_renderer);
280280
281281   D3DLOCKED_RECT rect;
282282
r243410r243411
326326   if (!master_enable || !d3dintf->post_fx_available)
327327      return;
328328
329   renderer *d3d = (renderer *)window->m_drawdata;
329   renderer *d3d = dynamic_cast<renderer *>(window->m_renderer);
330330
331331   D3DLOCKED_RECT rect;
332332
r243410r243411
519519   if (!master_enable || !d3dintf->post_fx_available)
520520      return;
521521
522   renderer *d3d = (renderer *)window->m_drawdata;
522   renderer *d3d = dynamic_cast<renderer *>(window->m_renderer);
523523
524524   // stop any existing recording
525525   end_avi_recording();
r243410r243411
678678   if (!master_enable || !d3dintf->post_fx_available)
679679      return;
680680
681   renderer *d3d = (renderer *)window->m_drawdata;
681   renderer *d3d = dynamic_cast<renderer *>(window->m_renderer);
682682
683683   if(texture != NULL)
684684   {
r243410r243411
820820   if (!master_enable || !d3dintf->post_fx_available)
821821      return;
822822
823   renderer *d3d = (renderer *)window->m_drawdata;
823   renderer *d3d = dynamic_cast<renderer *>(window->m_renderer);
824824
825825   // get a pointer to the vertex buffer
826826   fsfx_vertices = (vertex *)vertbuf;
r243410r243411
892892   if (!master_enable || !d3dintf->post_fx_available)
893893      return 0;
894894
895   renderer *d3d = (renderer *)window->m_drawdata;
895   renderer *d3d = dynamic_cast<renderer *>(window->m_renderer);
896896
897897   HRESULT result = (*d3dintf->device.get_render_target)(d3d->get_device(), 0, &backbuffer);
898898   if (result != D3D_OK) osd_printf_verbose("Direct3D: Error %08X during device get_render_target call\n", (int)result);
r243410r243411
10661066   if (!master_enable || !d3dintf->post_fx_available)
10671067      return;
10681068
1069   renderer *d3d = (renderer *)window->m_drawdata;
1069   renderer *d3d = dynamic_cast<renderer *>(window->m_renderer);
10701070
10711071   curr_effect = default_effect;
10721072
r243410r243411
11011101void shaders::blit(surface *dst, texture *src, surface *new_dst, D3DPRIMITIVETYPE prim_type,
11021102                  UINT32 prim_index, UINT32 prim_count, int dstw, int dsth)
11031103{
1104   renderer *d3d = (renderer *)window->m_drawdata;
1104   renderer *d3d = dynamic_cast<renderer *>(window->m_renderer);
11051105
11061106   HRESULT result = (*d3dintf->device.set_render_target)(d3d->get_device(), 0, dst);
11071107   if (result != D3D_OK) osd_printf_verbose("Direct3D: Error %08X during device set_render_target call\n", (int)result);
r243410r243411
11461146void shaders::blit(surface *dst, texture *src, surface *new_dst, D3DPRIMITIVETYPE prim_type,
11471147                  UINT32 prim_index, UINT32 prim_count)
11481148{
1149   renderer *d3d = (renderer *)window->m_drawdata;
1149   renderer *d3d = dynamic_cast<renderer *>(window->m_renderer);
11501150
11511151   HRESULT result = (*d3dintf->device.set_render_target)(d3d->get_device(), 0, dst);
11521152   if (result != D3D_OK) osd_printf_verbose("Direct3D: Error %08X during device set_render_target call\n", (int)result);
r243410r243411
12311231   if (!master_enable || !d3dintf->post_fx_available)
12321232      return;
12331233
1234   renderer *d3d = (renderer *)window->m_drawdata;
1234   renderer *d3d = dynamic_cast<renderer *>(window->m_renderer);
12351235   texture_info *texture = poly->get_texture();
12361236
12371237   if(PRIMFLAG_GET_SCREENTEX(d3d->get_last_texture_flags()) && texture != NULL)
r243410r243411
13081308
13091309void shaders::ntsc_pass(render_target *rt, vec2f &sourcedims, vec2f &delta)
13101310{
1311   renderer *d3d = (renderer *)window->m_drawdata;
1311   renderer *d3d = dynamic_cast<renderer *>(window->m_renderer);
13121312   UINT num_passes = 0;
13131313
13141314   if(options->yiq_enable)
r243410r243411
13701370
13711371void shaders::color_convolution_pass(render_target *rt, vec2f &texsize, vec2f &sourcedims)
13721372{
1373   renderer *d3d = (renderer *)window->m_drawdata;
1373   renderer *d3d = dynamic_cast<renderer *>(window->m_renderer);
13741374   UINT num_passes = 0;
13751375
13761376   curr_effect = color_effect;
r243410r243411
13981398
13991399void shaders::prescale_pass(render_target *rt, vec2f &texsize, vec2f &sourcedims)
14001400{
1401   renderer *d3d = (renderer *)window->m_drawdata;
1401   renderer *d3d = dynamic_cast<renderer *>(window->m_renderer);
14021402   UINT num_passes = 0;
14031403
14041404   curr_effect = prescale_effect;
r243410r243411
14261426
14271427void shaders::deconverge_pass(render_target *rt, vec2f &texsize, vec2f &delta, vec2f &sourcedims)
14281428{
1429   renderer *d3d = (renderer *)window->m_drawdata;
1429   renderer *d3d = dynamic_cast<renderer *>(window->m_renderer);
14301430   UINT num_passes = 0;
14311431
14321432   curr_effect = deconverge_effect;
r243410r243411
14541454
14551455void shaders::defocus_pass(render_target *rt, vec2f &texsize)
14561456{
1457   renderer *d3d = (renderer *)window->m_drawdata;
1457   renderer *d3d = dynamic_cast<renderer *>(window->m_renderer);
14581458   UINT num_passes = 0;
14591459
14601460   // Defocus pass 1
r243410r243411
15031503
15041504void shaders::phosphor_pass(render_target *rt, cache_target *ct, vec2f &texsize, bool focus_enable)
15051505{
1506   renderer *d3d = (renderer *)window->m_drawdata;
1506   renderer *d3d = dynamic_cast<renderer *>(window->m_renderer);
15071507   UINT num_passes = 0;
15081508
15091509   curr_effect = phosphor_effect;
r243410r243411
15611561
15621562void shaders::avi_post_pass(render_target *rt, vec2f &texsize, vec2f &delta, vec2f &sourcedims, poly_info *poly, int vertnum)
15631563{
1564   renderer *d3d = (renderer *)window->m_drawdata;
1564   renderer *d3d = dynamic_cast<renderer *>(window->m_renderer);
15651565   UINT num_passes = 0;
15661566
15671567   curr_effect = post_effect;
r243410r243411
16161616
16171617void shaders::screen_post_pass(render_target *rt, vec2f &texsize, vec2f &delta, vec2f &sourcedims, poly_info *poly, int vertnum)
16181618{
1619   renderer *d3d = (renderer *)window->m_drawdata;
1619   renderer *d3d = dynamic_cast<renderer *>(window->m_renderer);
16201620   UINT num_passes = 0;
16211621
16221622   curr_effect = post_effect;
r243410r243411
16501650
16511651void shaders::raster_bloom_pass(render_target *rt, vec2f &texsize, vec2f &delta, poly_info *poly, int vertnum)
16521652{
1653   renderer *d3d = (renderer *)window->m_drawdata;
1653   renderer *d3d = dynamic_cast<renderer *>(window->m_renderer);
16541654   UINT num_passes = 0;
16551655
16561656   curr_effect = downsample_effect;
r243410r243411
17551755      return;
17561756
17571757   UINT num_passes = 0;
1758   renderer *d3d = (renderer *)window->m_drawdata;
1758   renderer *d3d = dynamic_cast<renderer *>(window->m_renderer);
17591759   curr_texture = poly->get_texture();
17601760
17611761   if(PRIMFLAG_GET_SCREENTEX(d3d->get_last_texture_flags()) && curr_texture != NULL)
r243410r243411
20802080      return NULL;
20812081   }
20822082
2083   renderer *d3d = (renderer *)window->m_drawdata;
2083   renderer *d3d = dynamic_cast<renderer *>(window->m_renderer);
20842084
20852085   return find_render_target(d3d->get_width(), d3d->get_height(), 0, 0);
20862086}
20872087
20882088void shaders::create_vector_target(render_primitive *prim)
20892089{
2090   renderer *d3d = (renderer *)window->m_drawdata;
2090   renderer *d3d = dynamic_cast<renderer *>(window->m_renderer);
20912091   if (!add_render_target(d3d, NULL, d3d->get_width(), d3d->get_height(), 1, 1))
20922092   {
20932093      vector_enable = false;
r243410r243411
22022202
22032203   enumerate_screens();
22042204
2205   renderer *d3d = (renderer *)window->m_drawdata;
2205   renderer *d3d = dynamic_cast<renderer *>(window->m_renderer);
22062206
22072207   int hlsl_prescale_x = prescale_force_x;
22082208   int hlsl_prescale_y = prescale_force_y;
r243410r243411
29942994   }
29952995
29962996   shaders *shadersys = m_shader->m_shaders;
2997   renderer *d3d = (renderer *)shadersys->window->m_drawdata;
2997   renderer *d3d = dynamic_cast<renderer *>(shadersys->window->m_renderer);
29982998   hlsl_options *options = shadersys->options;
29992999
30003000   switch(m_id)
r243410r243411
34223422   UINT32 origflags = file.openflags();
34233423
34243424   // handle defaults
3425   const char *snapname = templ ? templ : d3d->get_window()->machine().options().snap_name();
3425   const char *snapname = templ ? templ : d3d->window().machine().options().snap_name();
34263426
34273427   if (snapname == NULL || snapname[0] == 0)
34283428      snapname = "%g/%i";
r243410r243411
34693469         snapdevname.cpysubstr(snapstr, pos + 3, end - pos - 3);
34703470
34713471         // verify that there is such a device for this system
3472         image_interface_iterator iter(d3d->get_window()->machine().root_device());
3472         image_interface_iterator iter(d3d->window().machine().root_device());
34733473         for (device_image_interface *image = iter.first(); image != NULL; iter.next())
34743474         {
34753475            // get the device name
r243410r243411
35063506
35073507   // substitute path and gamename up front
35083508   snapstr.replace(0, "/", PATH_SEPARATOR);
3509   snapstr.replace(0, "%g", d3d->get_window()->machine().basename());
3509   snapstr.replace(0, "%g", d3d->window().machine().basename());
35103510
35113511   // determine if the template has an index; if not, we always use the same name
35123512   astring fname;
trunk/src/osd/windows/drawbgfx.c
r243410r243411
2222#include <bgfxplatform.h>
2323#include <bgfx.h>
2424
25class renderer_bgfx : public osd_renderer
26{
27public:
28   renderer_bgfx(win_window_info *window)
29   : osd_renderer(window, FLAG_NONE) { }
30
31   virtual ~renderer_bgfx() { }
32
33   virtual int init();
34   virtual render_primitive_list *get_primitives();
35   virtual int draw(HDC dc, int update);
36   virtual void save() {};
37   virtual void record() {};
38   virtual void toggle_fsfx() {};
39   virtual void destroy();
40
41private:
42};
43
44
2545//============================================================
2646//  PROTOTYPES
2747//============================================================
2848
2949// core functions
3050static void drawbgfx_exit(void);
31static int drawbgfx_window_init(win_window_info *window);
32static void drawbgfx_window_destroy(win_window_info *window);
33static render_primitive_list *drawbgfx_window_get_primitives(win_window_info *window);
34static int drawbgfx_window_draw(win_window_info *window, HDC dc, int update);
3551
52//============================================================
53//  drawnone_create
54//============================================================
3655
56osd_renderer *drawbgfx_create(win_window_info *window)
57{
58   return global_alloc(renderer_bgfx(window));
59}
3760
3861//============================================================
3962//  drawbgfx_init
4063//============================================================
4164
42int drawbgfx_init(running_machine &machine, win_draw_callbacks *callbacks)
65int drawbgfx_init(running_machine &machine, osd_draw_callbacks *callbacks)
4366{
4467   // fill in the callbacks
4568   memset(callbacks, 0, sizeof(*callbacks));
4669   callbacks->exit = drawbgfx_exit;
47   callbacks->window_init = drawbgfx_window_init;
48   callbacks->window_get_primitives = drawbgfx_window_get_primitives;
49   callbacks->window_draw = drawbgfx_window_draw;
50   callbacks->window_destroy = drawbgfx_window_destroy;
70   callbacks->create = drawbgfx_create;
5171   return 0;
5272}
5373
r243410r243411
6787//  drawbgfx_window_init
6888//============================================================
6989
70static int drawbgfx_window_init(win_window_info *window)
90int renderer_bgfx::init()
7191{
7292   RECT client;
73   GetClientRect(window->m_hwnd, &client);
93   GetClientRect(window().m_hwnd, &client);
7494
75   bgfx::winSetHwnd(window->m_hwnd);
95   bgfx::winSetHwnd(window().m_hwnd);
7696   bgfx::init();
7797   bgfx::reset(rect_width(&client), rect_height(&client), BGFX_RESET_VSYNC);
7898   
7999   // Enable debug text.
80100   bgfx::setDebug(BGFX_DEBUG_STATS);// BGFX_DEBUG_TEXT);
81101
82   window->m_drawdata = window->m_hwnd;
83102   return 0;
84103}
85104
r243410r243411
89108//  drawbgfx_window_destroy
90109//============================================================
91110
92static void drawbgfx_window_destroy(win_window_info *window)
111void renderer_bgfx::destroy()
93112{
94113   // Shutdown bgfx.
95114   bgfx::shutdown();
96   window->m_drawdata = NULL;
97115}
98116
99117
r243410r243411
102120//  drawbgfx_window_get_primitives
103121//============================================================
104122
105static render_primitive_list *drawbgfx_window_get_primitives(win_window_info *window)
123render_primitive_list *renderer_bgfx::get_primitives()
106124{
107125   RECT client;
108   GetClientRect(window->m_hwnd, &client);
109   window->m_target->set_bounds(rect_width(&client), rect_height(&client), window->m_monitor->get_aspect());
110   return &window->m_target->get_primitives();   
126   GetClientRect(window().m_hwnd, &client);
127   window().m_target->set_bounds(rect_width(&client), rect_height(&client), window().m_monitor->get_aspect());
128   return &window().m_target->get_primitives();
111129}
112130
113131
r243410r243411
116134//  drawbgfx_window_draw
117135//============================================================
118136
119static int drawbgfx_window_draw(win_window_info *window, HDC dc, int update)
137int renderer_bgfx::draw(HDC dc, int update)
120138{
121139   RECT client;
122   GetClientRect(window->m_hwnd, &client);
140   GetClientRect(window().m_hwnd, &client);
123141
124142   bgfx::setViewClear(0
125143      , BGFX_CLEAR_COLOR|BGFX_CLEAR_DEPTH
r243410r243411
134152   // if no other draw calls are submitted to view 0.
135153   bgfx::submit(0);
136154
137   window->m_primlist->acquire_lock();
155   window().m_primlist->acquire_lock();
138156
139157   // now draw
140   for (render_primitive *prim = window->m_primlist->first(); prim != NULL; prim = prim->next())
158   for (render_primitive *prim = window().m_primlist->first(); prim != NULL; prim = prim->next())
141159   {
142160      switch (prim->type)
143161      {
r243410r243411
219237      }
220238   }
221239
222   window->m_primlist->release_lock();   
240   window().m_primlist->release_lock();
223241   // Advance to next frame. Rendering thread will be kicked to
224242   // process submitted rendering primitives.
225243   bgfx::frame();
trunk/src/osd/windows/drawd3d.c
r243410r243411
179179
180180// core functions
181181static void drawd3d_exit(void);
182static int drawd3d_window_init(win_window_info *window);
183static void drawd3d_window_destroy(win_window_info *window);
184static render_primitive_list *drawd3d_window_get_primitives(win_window_info *window);
185static void drawd3d_window_save(win_window_info *window);
186static void drawd3d_window_record(win_window_info *window);
187static void drawd3d_window_toggle_fsfx(win_window_info *window);
188static int drawd3d_window_draw(win_window_info *window, HDC dc, int update);
189182
190
191183//============================================================
192184//  drawd3d_window_init
193185//============================================================
194186
195static int drawd3d_window_init(win_window_info *window)
187int d3d::renderer::init()
196188{
197   // allocate memory for our structures
198   d3d::renderer *d3d = global_alloc(d3d::renderer(window));
199   window->m_drawdata = d3d;
200
201   if (!d3d->initialize())
189   if (!initialize())
202190   {
203      drawd3d_window_destroy(window);
191      destroy();
204192      osd_printf_error("Unable to initialize Direct3D.\n");
205193      return 1;
206194   }
r243410r243411
218206      (*d3dintf->d3d.release)(d3dintf);
219207}
220208
221static void drawd3d_window_toggle_fsfx(win_window_info *window)
209void d3d::renderer::toggle_fsfx()
222210{
223   d3d::renderer *d3d = (d3d::renderer *)window->m_drawdata;
224   d3d->set_restarting(true);
211   set_restarting(true);
225212}
226213
227static void drawd3d_window_record(win_window_info *window)
214void d3d::renderer::record()
228215{
229   d3d::renderer *d3d = (d3d::renderer *)window->m_drawdata;
230   d3d->get_shaders()->window_record();
216   get_shaders()->window_record();
231217}
232218
233static void drawd3d_window_save(win_window_info *window)
219void d3d::renderer::save()
234220{
235   d3d::renderer *d3d = (d3d::renderer *)window->m_drawdata;
236   d3d->get_shaders()->window_save();
221   get_shaders()->window_save();
237222}
238223
239224
r243410r243411
242227//  drawd3d_window_destroy
243228//============================================================
244229
245static void drawd3d_window_destroy(win_window_info *window)
230void d3d::renderer::destroy()
246231{
247   d3d::renderer *d3d = (d3d::renderer *)window->m_drawdata;
232   if (get_shaders() != NULL && get_shaders()->recording())
233      get_shaders()->window_record();
248234
249   // skip if nothing
250   if (d3d == NULL)
251      return;
252
253   if (d3d->get_shaders() != NULL && d3d->get_shaders()->recording())
254      d3d->get_shaders()->window_record();
255
256   // free the memory in the window
257   global_free(d3d);
258   window->m_drawdata = NULL;
259235}
260236
261237
r243410r243411
264240//  drawd3d_window_get_primitives
265241//============================================================
266242
267static render_primitive_list *drawd3d_window_get_primitives(win_window_info *window)
243render_primitive_list *d3d::renderer::get_primitives()
268244{
269   d3d::renderer *d3d = (d3d::renderer *)window->m_drawdata;
270245   RECT client;
271246
272   GetClientRectExceptMenu(window->m_hwnd, &client, window->m_fullscreen);
247   GetClientRectExceptMenu(window().m_hwnd, &client, window().m_fullscreen);
273248   if (rect_width(&client) > 0 && rect_height(&client) > 0)
274249   {
275      window->m_target->set_bounds(rect_width(&client), rect_height(&client), window->m_monitor->get_aspect());
276      window->m_target->set_max_update_rate((d3d->get_refresh() == 0) ? d3d->get_origmode().RefreshRate : d3d->get_refresh());
250      window().m_target->set_bounds(rect_width(&client), rect_height(&client), window().m_monitor->get_aspect());
251      window().m_target->set_max_update_rate((get_refresh() == 0) ? get_origmode().RefreshRate : get_refresh());
277252   }
278   return &window->m_target->get_primitives();
253   return &window().m_target->get_primitives();
279254}
280255
281int drawd3d_init(running_machine &machine, win_draw_callbacks *callbacks)
256//============================================================
257//  drawnone_create
258//============================================================
259
260static osd_renderer *drawd3d_create(win_window_info *window)
282261{
262   return global_alloc(d3d::renderer(window));
263}
264
265int drawd3d_init(running_machine &machine, osd_draw_callbacks *callbacks)
266{
283267   d3dintf = NULL;
284268
285269   // Use Direct3D9
r243410r243411
295279   // fill in the callbacks
296280   memset(callbacks, 0, sizeof(*callbacks));
297281   callbacks->exit = drawd3d_exit;
298   callbacks->window_init = drawd3d_window_init;
299   callbacks->window_get_primitives = drawd3d_window_get_primitives;
300   callbacks->window_draw = drawd3d_window_draw;
301   callbacks->window_save = drawd3d_window_save;
302   callbacks->window_record = drawd3d_window_record;
303   callbacks->window_toggle_fsfx = drawd3d_window_toggle_fsfx;
304   callbacks->window_destroy = drawd3d_window_destroy;
282   callbacks->create = drawd3d_create;
305283   return 0;
306284}
307285
r243410r243411
309287//  drawd3d_window_draw
310288//============================================================
311289
312static int drawd3d_window_draw(win_window_info *window, HDC dc, int update)
290int d3d::renderer::draw(HDC dc, int update)
313291{
314   d3d::renderer *d3d = (d3d::renderer *)window->m_drawdata;
315
316   // if we haven't been created, just punt
317   if (d3d == NULL)
318      return 1;
319
320   int check = d3d->pre_window_draw_check();
292   int check = pre_window_draw_check();
321293   if (check >= 0)
322294      return check;
323295
324   d3d->begin_frame();
325   d3d->process_primitives();
326   d3d->end_frame();
296   begin_frame();
297   process_primitives();
298   end_frame();
327299
328300   return 0;
329301}
r243410r243411
496468   osd_printf_verbose("Direct3D: YUV format = %s\n", (m_yuv_format == D3DFMT_YUY2) ? "YUY2" : (m_yuv_format == D3DFMT_UYVY) ? "UYVY" : "RGB");
497469
498470   // set the max texture size
499   d3d->get_window()->m_target->set_max_texture_size(m_texture_max_width, m_texture_max_height);
471   d3d->window().m_target->set_max_texture_size(m_texture_max_width, m_texture_max_height);
500472   osd_printf_verbose("Direct3D: Max texture size = %dx%d\n", (int)m_texture_max_width, (int)m_texture_max_height);
501473}
502474
r243410r243411
508480{
509481   // experimental: load a PNG to use for vector rendering; it is treated
510482   // as a brightness map
511   emu_file file(m_renderer->get_window()->machine().options().art_path(), OPEN_FLAG_READ);
483   emu_file file(m_renderer->window().machine().options().art_path(), OPEN_FLAG_READ);
512484   render_load_png(m_vector_bitmap, file, NULL, "vector.png");
513485   if (m_vector_bitmap.valid())
514486   {
r243410r243411
650622}
651623
652624renderer::renderer(win_window_info *window)
625   : osd_renderer(window, FLAG_NONE)
653626{
654627   m_device = NULL;
655628   m_restarting = false;
656   m_window = window;
657629   m_shaders = NULL;
658630   m_numverts = 0;
659631   m_numpolys = 0;
r243410r243411
672644      return false;
673645
674646   // create the device immediately for the full screen case (defer for window mode)
675   if (m_window->m_fullscreen && device_create())
647   if (window().m_fullscreen && device_create())
676648      return false;
677649
678650   return true;
r243410r243411
681653int renderer::pre_window_draw_check()
682654{
683655   // if we're in the middle of resizing, leave things alone
684   if (m_window->m_resize_state == RESIZE_STATE_RESIZING)
656   if (window().m_resize_state == RESIZE_STATE_RESIZING)
685657      return 0;
686658
687659   // if we're restarting the renderer, leave things alone
r243410r243411
706678   }
707679
708680   // in window mode, we need to track the window size
709   if (!m_window->m_fullscreen || m_device == NULL)
681   if (!window().m_fullscreen || m_device == NULL)
710682   {
711683      // if the size changes, skip this update since the render target will be out of date
712684      if (update_window_size())
r243410r243411
722694
723695void texture_manager::update_textures()
724696{
725   for (render_primitive *prim = m_renderer->get_window()->m_primlist->first(); prim != NULL; prim = prim->next())
697   for (render_primitive *prim = m_renderer->window().m_primlist->first(); prim != NULL; prim = prim->next())
726698   {
727699      if (prim->texture.base != NULL)
728700      {
r243410r243411
759731
760732   m_shaders->begin_frame();
761733
762   m_window->m_primlist->acquire_lock();
734   window().m_primlist->acquire_lock();
763735
764736   // first update any textures
765737   m_texture_manager->update_textures();
r243410r243411
780752   m_line_count = 0;
781753
782754   // loop over primitives
783   for (render_primitive *prim = m_window->m_primlist->first(); prim != NULL; prim = prim->next())
755   for (render_primitive *prim = window().m_primlist->first(); prim != NULL; prim = prim->next())
784756      if (prim->type == render_primitive::LINE && PRIMFLAG_GET_VECTOR(prim->flags))
785757         m_line_count++;
786758}
r243410r243411
788760void renderer::process_primitives()
789761{
790762   // Rotating index for vector time offsets
791   for (render_primitive *prim = m_window->m_primlist->first(); prim != NULL; prim = prim->next())
763   for (render_primitive *prim = window().m_primlist->first(); prim != NULL; prim = prim->next())
792764   {
793765      switch (prim->type)
794766      {
r243410r243411
818790
819791void renderer::end_frame()
820792{
821   m_window->m_primlist->release_lock();
793   window().m_primlist->release_lock();
822794
823795   // flush any pending polygons
824796   primitive_flush_pending();
r243410r243411
893865   m_presentation.BackBufferCount               = video_config.triplebuf ? 2 : 1;
894866   m_presentation.MultiSampleType               = D3DMULTISAMPLE_NONE;
895867   m_presentation.SwapEffect                    = D3DSWAPEFFECT_DISCARD;
896   m_presentation.hDeviceWindow                 = m_window->m_hwnd;
897   m_presentation.Windowed                      = !m_window->m_fullscreen || win_has_menu(m_window);
868   m_presentation.hDeviceWindow                 = window().m_hwnd;
869   m_presentation.Windowed                      = !window().m_fullscreen || win_has_menu(&window());
898870   m_presentation.EnableAutoDepthStencil        = FALSE;
899871   m_presentation.AutoDepthStencilFormat        = D3DFMT_D16;
900872   m_presentation.Flags                         = 0;
901873   m_presentation.FullScreen_RefreshRateInHz    = m_refresh;
902   m_presentation.PresentationInterval          = ((video_config.triplebuf && m_window->m_fullscreen) ||
874   m_presentation.PresentationInterval          = ((video_config.triplebuf && window().m_fullscreen) ||
903875                                       video_config.waitvsync || video_config.syncrefresh) ?
904876                                       D3DPRESENT_INTERVAL_ONE : D3DPRESENT_INTERVAL_IMMEDIATE;
905877
906878   // create the D3D device
907   result = (*d3dintf->d3d.create_device)(d3dintf, m_adapter, D3DDEVTYPE_HAL, m_window->m_focus_hwnd,
879   result = (*d3dintf->d3d.create_device)(d3dintf, m_adapter, D3DDEVTYPE_HAL, window().m_focus_hwnd,
908880               D3DCREATE_SOFTWARE_VERTEXPROCESSING | D3DCREATE_FPU_PRESERVE, &m_presentation, &m_device);
909881   if (result != D3D_OK)
910882   {
r243410r243411
927899   osd_printf_verbose("Direct3D: Device created at %dx%d\n", m_width, m_height);
928900
929901   // set the gamma if we need to
930   if (m_window->m_fullscreen)
902   if (window().m_fullscreen)
931903   {
932904      // only set the gamma if it's not 1.0f
933      windows_options &options = downcast<windows_options &>(m_window->machine().options());
905      windows_options &options = downcast<windows_options &>(window().machine().options());
934906      float brightness = options.full_screen_brightness();
935907      float contrast = options.full_screen_contrast();
936908      float gamma = options.full_screen_gamma();
r243410r243411
10921064   int retval = 0;
10931065
10941066   m_shaders = global_alloc_clear(shaders);
1095   m_shaders->init(d3dintf, m_window);
1067   m_shaders->init(d3dintf, &window());
10961068
10971069   DWORD tempcaps;
10981070   HRESULT result = (*d3dintf->d3d.get_caps_dword)(d3dintf, m_adapter, D3DDEVTYPE_HAL, CAPS_MAX_PS30_INSN_SLOTS, &tempcaps);
r243410r243411
12311203   }
12321204
12331205   // choose a resolution: window mode case
1234   if (!m_window->m_fullscreen || !video_config.switchres || win_has_menu(m_window))
1206   if (!window().m_fullscreen || !video_config.switchres || win_has_menu(&window()))
12351207   {
12361208      RECT client;
12371209
12381210      // bounds are from the window client rect
1239      GetClientRectExceptMenu(m_window->m_hwnd, &client, m_window->m_fullscreen);
1211      GetClientRectExceptMenu(window().m_hwnd, &client, window().m_fullscreen);
12401212      m_width = client.right - client.left;
12411213      m_height = client.bottom - client.top;
12421214
r243410r243411
12471219      // make sure it's a pixel format we can get behind
12481220      if (m_pixformat != D3DFMT_X1R5G5B5 && m_pixformat != D3DFMT_R5G6B5 && m_pixformat != D3DFMT_X8R8G8B8)
12491221      {
1250         char *utf8_device = utf8_from_tstring(m_window->m_monitor->info.szDevice);
1222         char *utf8_device = utf8_from_tstring(window().m_monitor->info.szDevice);
12511223         if (utf8_device != NULL)
12521224         {
12531225            osd_printf_error("Device %s currently in an unsupported mode\n", utf8_device);
r243410r243411
12721244   }
12731245
12741246   // see if we can handle the device type
1275   result = (*d3dintf->d3d.check_device_type)(d3dintf, m_adapter, D3DDEVTYPE_HAL, m_pixformat, m_pixformat, !m_window->m_fullscreen);
1247   result = (*d3dintf->d3d.check_device_type)(d3dintf, m_adapter, D3DDEVTYPE_HAL, m_pixformat, m_pixformat, !window().m_fullscreen);
12761248   if (result != D3D_OK)
12771249   {
1278      char *utf8_device = utf8_from_tstring(m_window->m_monitor->info.szDevice);
1250      char *utf8_device = utf8_from_tstring(window().m_monitor->info.szDevice);
12791251      if (utf8_device != NULL)
12801252      {
12811253         osd_printf_error("Proposed video mode not supported on device %s\n", utf8_device);
r243410r243411
13031275      HMONITOR curmonitor = (*d3dintf->d3d.get_adapter_monitor)(d3dintf, adapternum);
13041276
13051277      // if we match the proposed monitor, this is it
1306      if (curmonitor == m_window->m_monitor->handle)
1278      if (curmonitor == window().m_monitor->handle)
13071279      {
13081280         return adapternum;
13091281      }
r243410r243411
13261298   float best_score = 0.0f;
13271299
13281300   // determine the refresh rate of the primary screen
1329   const screen_device *primary_screen = m_window->machine().config().first_screen();
1301   const screen_device *primary_screen = window().machine().config().first_screen();
13301302   if (primary_screen != NULL)
13311303   {
13321304      target_refresh = ATTOSECONDS_TO_HZ(primary_screen->refresh_attoseconds());
r243410r243411
13361308   // note: technically we should not be calling this from an alternate window
13371309   // thread; however, it is only done during init time, and the init code on
13381310   // the main thread is waiting for us to finish, so it is safe to do so here
1339   m_window->m_target->compute_minimum_size(minwidth, minheight);
1311   window().m_target->compute_minimum_size(minwidth, minheight);
13401312
13411313   // use those as the target for now
13421314   INT32 target_width = minwidth;
r243410r243411
13711343         size_score *= 0.1f;
13721344
13731345      // if we're looking for a particular mode, that's a winner
1374      if (mode.Width == m_window->m_maxwidth && mode.Height == m_window->m_maxheight)
1346      if (mode.Width == window().m_maxwidth && mode.Height == window().m_maxheight)
13751347         size_score = 2.0f;
13761348
13771349      // compute refresh score
r243410r243411
13821354         refresh_score *= 0.1f;
13831355
13841356      // if we're looking for a particular refresh, make sure it matches
1385      if (mode.RefreshRate == m_window->m_refresh)
1357      if (mode.RefreshRate == window().m_refresh)
13861358         refresh_score = 2.0f;
13871359
13881360      // weight size and refresh equally
r243410r243411
14121384{
14131385   // get the current window bounds
14141386   RECT client;
1415   GetClientRectExceptMenu(m_window->m_hwnd, &client, m_window->m_fullscreen);
1387   GetClientRectExceptMenu(window().m_hwnd, &client, window().m_fullscreen);
14161388
14171389   // if we have a device and matching width/height, nothing to do
14181390   if (m_device != NULL && rect_width(&client) == m_width && rect_height(&client) == m_height)
14191391   {
14201392      // clear out any pending resizing if the area didn't change
1421      if (m_window->m_resize_state == RESIZE_STATE_PENDING)
1422         m_window->m_resize_state = RESIZE_STATE_NORMAL;
1393      if (window().m_resize_state == RESIZE_STATE_PENDING)
1394         window().m_resize_state = RESIZE_STATE_NORMAL;
14231395      return FALSE;
14241396   }
14251397
14261398   // if we're in the middle of resizing, leave it alone as well
1427   if (m_window->m_resize_state == RESIZE_STATE_RESIZING)
1399   if (window().m_resize_state == RESIZE_STATE_RESIZING)
14281400      return FALSE;
14291401
14301402   // set the new bounds and create the device again
r243410r243411
14341406      return FALSE;
14351407
14361408   // reset the resize state to normal, and indicate we made a change
1437   m_window->m_resize_state = RESIZE_STATE_NORMAL;
1409   window().m_resize_state = RESIZE_STATE_NORMAL;
14381410   return TRUE;
14391411}
14401412
r243410r243411
14441416
14451417void renderer::batch_vectors()
14461418{
1447   windows_options &options = downcast<windows_options &>(m_window->machine().options());
1419   windows_options &options = downcast<windows_options &>(window().machine().options());
14481420
14491421   int vector_size = (options.antialias() ? 24 : 6);
14501422   m_vectorbatch = mesh_alloc(m_line_count * vector_size);
r243410r243411
14541426   int line_index = 0;
14551427   float period = options.screen_vector_time_period();
14561428   UINT32 cached_flags = 0;
1457   for (render_primitive *prim = m_window->m_primlist->first(); prim != NULL; prim = prim->next())
1429   for (render_primitive *prim = window().m_primlist->first(); prim != NULL; prim = prim->next())
14581430   {
14591431      switch (prim->type)
14601432      {
trunk/src/osd/windows/drawd3d.h
r243410r243411
9595};
9696
9797/* renderer is the information about Direct3D for the current screen */
98class renderer
98class renderer : public osd_renderer
9999{
100100public:
101   renderer() { }
101   //renderer() { }
102102   renderer(win_window_info *window);
103   ~renderer();
103   virtual ~renderer();
104104
105   virtual int init();
106   virtual render_primitive_list *get_primitives();
107   virtual int draw(HDC dc, int update);
108   virtual void save();
109   virtual void record();
110   virtual void toggle_fsfx();
111   virtual void destroy();
112
105113   int                     initialize();
106114
107115   int                     device_create();
r243410r243411
148156   int                     get_height() { return m_height; }
149157   int                     get_refresh() { return m_refresh; }
150158
151   win_window_info *       get_window() { return m_window; }
152
153159   device *                get_device() { return m_device; }
154160   present_parameters *    get_presentation() { return &m_presentation; }
155161
r243410r243411
181187   int                     m_refresh;                  // current refresh rate
182188   int                     m_create_error_count;       // number of consecutive create errors
183189
184   win_window_info *       m_window;                     // current window info
185
186190   device *                m_device;                   // pointer to the Direct3DDevice object
187191   int                     m_gamma_supported;          // is full screen gamma supported?
188192   present_parameters      m_presentation;             // set of presentation parameters
trunk/src/osd/windows/drawdd.c
r243410r243411
3636
3737
3838/* dd_info is the information about DirectDraw for the current screen */
39struct dd_info
39class renderer_dd : public osd_renderer
4040{
41public:
42   renderer_dd(win_window_info *window)
43   : osd_renderer(window, FLAG_NONE),
44      //adapter(0),
45      adapter_ptr(NULL),
46      clearouter(0),
47      blitwidth(0), blitheight(0),
48      //lastdest
49      ddraw(NULL),
50      primary(NULL),
51      back(NULL),
52      blit(NULL),
53      clipper(NULL),
54      gamma(NULL),
55      //DDSURFACEDESC2          primarydesc;
56      //DDSURFACEDESC2          blitdesc;
57      //DDSURFACEDESC2          origmode;
58      //ddcaps(0),
59      //helcaps(0),
60      membuffer(NULL),
61      membuffersize(NULL)
62   { }
63
64   virtual ~renderer_dd() { }
65
66   virtual int init();
67   virtual render_primitive_list *get_primitives();
68   virtual int draw(HDC dc, int update);
69   virtual void save() {};
70   virtual void record() {};
71   virtual void toggle_fsfx() {};
72   virtual void destroy();
73
74   int                     width, height;              // current width, height
75   int                     refresh;                    // current refresh rate
76
77private:
78
79   inline void update_outer_rects();
80
81   // surface management
82   int ddraw_create();
83   int ddraw_create_surfaces();
84   void ddraw_delete();
85   void ddraw_delete_surfaces();
86   int ddraw_verify_caps();
87   int ddraw_test_cooperative();
88   HRESULT create_surface(DDSURFACEDESC2 *desc, IDirectDrawSurface7 **surface, const char *type);
89   int create_clipper();
90
91   // drawing helpers
92   void compute_blit_surface_size();
93   void blit_to_primary(int srcwidth, int srcheight);
94
95   // video modes
96   int config_adapter_mode();
97   void get_adapter_for_monitor(win_monitor_info *monitor);
98   void pick_best_mode();
99
100   // various
101   void calc_fullscreen_margins(DWORD desc_width, DWORD desc_height, RECT *margins);
102
103
41104   GUID                    adapter;                    // current display adapter
42105   GUID *                  adapter_ptr;                // pointer to current display adapter
43   int                     width, height;              // current width, height
44   int                     refresh;                    // current refresh rate
45106   int                     clearouter;                 // clear the outer areas?
46107
47108   INT32                   blitwidth, blitheight;      // current blit width/height values
r243410r243411
79140/* mode_enum_info holds information during a display mode enumeration */
80141struct mode_enum_info
81142{
82   win_window_info *       window;
143   win_window_info *      window;
83144   INT32                   minimum_width, minimum_height;
84145   INT32                   target_width, target_height;
85146   double                  target_refresh;
r243410r243411
102163//  INLINES
103164//============================================================
104165
105INLINE void update_outer_rects(dd_info *dd)
166inline void renderer_dd::update_outer_rects()
106167{
107   dd->clearouter = (dd->back != NULL) ? 3 : 1;
168   clearouter = (back != NULL) ? 3 : 1;
108169}
109170
110171
r243410r243411
123184
124185// core functions
125186static void drawdd_exit(void);
126static int drawdd_window_init(win_window_info *window);
127static void drawdd_window_destroy(win_window_info *window);
128static render_primitive_list *drawdd_window_get_primitives(win_window_info *window);
129static int drawdd_window_draw(win_window_info *window, HDC dc, int update);
130187
131// surface management
132static int ddraw_create(win_window_info *window);
133static int ddraw_create_surfaces(win_window_info *window);
134static void ddraw_delete(win_window_info *window);
135static void ddraw_delete_surfaces(win_window_info *window);
136static int ddraw_verify_caps(dd_info *dd);
137static int ddraw_test_cooperative(win_window_info *window);
138static HRESULT create_surface(dd_info *dd, DDSURFACEDESC2 *desc, IDirectDrawSurface7 **surface, const char *type);
139static int create_clipper(win_window_info *window);
140188
141// drawing helpers
142static void compute_blit_surface_size(win_window_info *window);
143static void blit_to_primary(win_window_info *window, int srcwidth, int srcheight);
144189
145// video modes
146static int config_adapter_mode(win_window_info *window);
147static void get_adapter_for_monitor(dd_info *dd, win_monitor_info *monitor);
148static void pick_best_mode(win_window_info *window);
190//============================================================
191//  drawnone_create
192//============================================================
149193
194static osd_renderer *drawdd_create(win_window_info *window)
195{
196   return global_alloc(renderer_dd(window));
197}
150198
151199
152200//============================================================
153201//  drawdd_init
154202//============================================================
155203
156int drawdd_init(running_machine &machine, win_draw_callbacks *callbacks)
204int drawdd_init(running_machine &machine, osd_draw_callbacks *callbacks)
157205{
158206   // dynamically grab the create function from ddraw.dll
159207   dllhandle = LoadLibrary(TEXT("ddraw.dll"));
r243410r243411
186234   // fill in the callbacks
187235   memset(callbacks, 0, sizeof(*callbacks));
188236   callbacks->exit = drawdd_exit;
189   callbacks->window_init = drawdd_window_init;
190   callbacks->window_get_primitives = drawdd_window_get_primitives;
191   callbacks->window_draw = drawdd_window_draw;
192   callbacks->window_destroy = drawdd_window_destroy;
237   callbacks->create = drawdd_create;
193238
194239   osd_printf_verbose("DirectDraw: Using DirectDraw 7\n");
195240   return 0;
r243410r243411
213258//  drawdd_window_init
214259//============================================================
215260
216static int drawdd_window_init(win_window_info *window)
261int renderer_dd::init()
217262{
218   dd_info *dd;
219
220   // allocate memory for our structures
221   dd = global_alloc_clear(dd_info);
222   window->m_drawdata = dd;
223
224263   // configure the adapter for the mode we want
225   if (config_adapter_mode(window))
264   if (config_adapter_mode())
226265      goto error;
227266
228267   // create the ddraw object
229   if (ddraw_create(window))
268   if (ddraw_create())
230269      goto error;
231270
232271   return 0;
233272
234273error:
235   drawdd_window_destroy(window);
274   destroy();
236275   osd_printf_error("Unable to initialize DirectDraw.\n");
237276   return 1;
238277}
r243410r243411
243282//  drawdd_window_destroy
244283//============================================================
245284
246static void drawdd_window_destroy(win_window_info *window)
285void renderer_dd::destroy()
247286{
248   dd_info *dd = (dd_info *)window->m_drawdata;
249
250   // skip if nothing
251   if (dd == NULL)
252      return;
253
254287   // delete the ddraw object
255   ddraw_delete(window);
256
257   // free the memory in the window
258   global_free(dd);
259   window->m_drawdata = NULL;
288   ddraw_delete();
260289}
261290
262291
r243410r243411
265294//  drawdd_window_get_primitives
266295//============================================================
267296
268static render_primitive_list *drawdd_window_get_primitives(win_window_info *window)
297render_primitive_list *renderer_dd::get_primitives()
269298{
270   dd_info *dd = (dd_info *)window->m_drawdata;
299   compute_blit_surface_size();
300   window().m_target->set_bounds(blitwidth, blitheight, 0);
301   window().m_target->set_max_update_rate((refresh == 0) ? origmode.dwRefreshRate : refresh);
271302
272   compute_blit_surface_size(window);
273   window->m_target->set_bounds(dd->blitwidth, dd->blitheight, 0);
274   window->m_target->set_max_update_rate((dd->refresh == 0) ? dd->origmode.dwRefreshRate : dd->refresh);
275
276   return &window->m_target->get_primitives();
303   return &window().m_target->get_primitives();
277304}
278305
279306
r243410r243411
282309//  drawdd_window_draw
283310//============================================================
284311
285static int drawdd_window_draw(win_window_info *window, HDC dc, int update)
312int renderer_dd::draw(HDC dc, int update)
286313{
287   dd_info *dd = (dd_info *)window->m_drawdata;
288314   render_primitive *prim;
289315   int usemembuffer = FALSE;
290316   HRESULT result;
291317
292   // if we haven't been created, just punt
293   if (dd == NULL)
294      return 1;
295
296318   // if we're updating, remember to erase the outer stuff
297319   if (update)
298      update_outer_rects(dd);
320      update_outer_rects();
299321
300322   // if we have a ddraw object, check the cooperative level
301   if (ddraw_test_cooperative(window))
323   if (ddraw_test_cooperative())
302324      return 1;
303325
304326   // get the size; if we're too small, delete the existing surfaces
305   if (dd->blitwidth > dd->blitdesc.dwWidth || dd->blitheight > dd->blitdesc.dwHeight)
306      ddraw_delete_surfaces(window);
327   if (blitwidth > blitdesc.dwWidth || blitheight > blitdesc.dwHeight)
328      ddraw_delete_surfaces();
307329
308330   // if we need to create surfaces, do it now
309   if (dd->blit == NULL && ddraw_create_surfaces(window) != 0)
331   if (blit == NULL && ddraw_create_surfaces() != 0)
310332      return 1;
311333
312334   // select our surface and lock it
313   result = IDirectDrawSurface7_Lock(dd->blit, NULL, &dd->blitdesc, DDLOCK_WAIT, NULL);
335   result = IDirectDrawSurface7_Lock(blit, NULL, &blitdesc, DDLOCK_WAIT, NULL);
314336   if (result == DDERR_SURFACELOST)
315337   {
316338      osd_printf_verbose("DirectDraw: Lost surfaces; deleting and retrying next frame\n");
317      ddraw_delete_surfaces(window);
339      ddraw_delete_surfaces();
318340      return 1;
319341   }
320342   if (result != DD_OK)
r243410r243411
324346   }
325347
326348   // render to it
327   window->m_primlist->acquire_lock();
349   window().m_primlist->acquire_lock();
328350
329351   // scan the list of primitives for tricky stuff
330   for (prim = window->m_primlist->first(); prim != NULL; prim = prim->next())
352   for (prim = window().m_primlist->first(); prim != NULL; prim = prim->next())
331353      if (PRIMFLAG_GET_BLENDMODE(prim->flags) != BLENDMODE_NONE ||
332354         (prim->texture.base != NULL && PRIMFLAG_GET_TEXFORMAT(prim->flags) == TEXFORMAT_ARGB32))
333355      {
r243410r243411
341363      int x, y;
342364
343365      // based on the target format, use one of our standard renderers
344      switch (dd->blitdesc.ddpfPixelFormat.dwRBitMask)
366      switch (blitdesc.ddpfPixelFormat.dwRBitMask)
345367      {
346         case 0x00ff0000:    software_renderer<UINT32, 0,0,0, 16,8,0>::draw_primitives(*window->m_primlist, dd->membuffer, dd->blitwidth, dd->blitheight, dd->blitwidth);  break;
347         case 0x000000ff:    software_renderer<UINT32, 0,0,0, 0,8,16>::draw_primitives(*window->m_primlist, dd->membuffer, dd->blitwidth, dd->blitheight, dd->blitwidth);  break;
348         case 0xf800:        software_renderer<UINT16, 3,2,3, 11,5,0>::draw_primitives(*window->m_primlist, dd->membuffer, dd->blitwidth, dd->blitheight, dd->blitwidth);  break;
349         case 0x7c00:        software_renderer<UINT16, 3,3,3, 10,5,0>::draw_primitives(*window->m_primlist, dd->membuffer, dd->blitwidth, dd->blitheight, dd->blitwidth);  break;
368         case 0x00ff0000:    software_renderer<UINT32, 0,0,0, 16,8,0>::draw_primitives(*window().m_primlist, membuffer, blitwidth, blitheight, blitwidth);  break;
369         case 0x000000ff:    software_renderer<UINT32, 0,0,0, 0,8,16>::draw_primitives(*window().m_primlist, membuffer, blitwidth, blitheight, blitwidth);  break;
370         case 0xf800:        software_renderer<UINT16, 3,2,3, 11,5,0>::draw_primitives(*window().m_primlist, membuffer, blitwidth, blitheight, blitwidth);  break;
371         case 0x7c00:        software_renderer<UINT16, 3,3,3, 10,5,0>::draw_primitives(*window().m_primlist, membuffer, blitwidth, blitheight, blitwidth);  break;
350372         default:
351            osd_printf_verbose("DirectDraw: Unknown target mode: R=%08X G=%08X B=%08X\n", (int)dd->blitdesc.ddpfPixelFormat.dwRBitMask, (int)dd->blitdesc.ddpfPixelFormat.dwGBitMask, (int)dd->blitdesc.ddpfPixelFormat.dwBBitMask);
373            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);
352374            break;
353375      }
354376
355377      // handle copying to both 16bpp and 32bpp destinations
356      for (y = 0; y < dd->blitheight; y++)
378      for (y = 0; y < blitheight; y++)
357379      {
358         if (dd->blitdesc.ddpfPixelFormat.dwRGBBitCount == 32)
380         if (blitdesc.ddpfPixelFormat.dwRGBBitCount == 32)
359381         {
360            UINT32 *src = (UINT32 *)dd->membuffer + y * dd->blitwidth;
361            UINT32 *dst = (UINT32 *)((UINT8 *)dd->blitdesc.lpSurface + y * dd->blitdesc.lPitch);
362            for (x = 0; x < dd->blitwidth; x++)
382            UINT32 *src = (UINT32 *)membuffer + y * blitwidth;
383            UINT32 *dst = (UINT32 *)((UINT8 *)blitdesc.lpSurface + y * blitdesc.lPitch);
384            for (x = 0; x < blitwidth; x++)
363385               *dst++ = *src++;
364386         }
365         else if (dd->blitdesc.ddpfPixelFormat.dwRGBBitCount == 16)
387         else if (blitdesc.ddpfPixelFormat.dwRGBBitCount == 16)
366388         {
367            UINT16 *src = (UINT16 *)dd->membuffer + y * dd->blitwidth;
368            UINT16 *dst = (UINT16 *)((UINT8 *)dd->blitdesc.lpSurface + y * dd->blitdesc.lPitch);
369            for (x = 0; x < dd->blitwidth; x++)
389            UINT16 *src = (UINT16 *)membuffer + y * blitwidth;
390            UINT16 *dst = (UINT16 *)((UINT8 *)blitdesc.lpSurface + y * blitdesc.lPitch);
391            for (x = 0; x < blitwidth; x++)
370392               *dst++ = *src++;
371393         }
372394      }
r243410r243411
377399   else
378400   {
379401      // based on the target format, use one of our standard renderers
380      switch (dd->blitdesc.ddpfPixelFormat.dwRBitMask)
402      switch (blitdesc.ddpfPixelFormat.dwRBitMask)
381403      {
382         case 0x00ff0000:    software_renderer<UINT32, 0,0,0, 16,8,0, true>::draw_primitives(*window->m_primlist, dd->blitdesc.lpSurface, dd->blitwidth, dd->blitheight, dd->blitdesc.lPitch / 4); break;
383         case 0x000000ff:    software_renderer<UINT32, 0,0,0, 0,8,16, true>::draw_primitives(*window->m_primlist, dd->blitdesc.lpSurface, dd->blitwidth, dd->blitheight, dd->blitdesc.lPitch / 4); break;
384         case 0xf800:        software_renderer<UINT16, 3,2,3, 11,5,0, true>::draw_primitives(*window->m_primlist, dd->blitdesc.lpSurface, dd->blitwidth, dd->blitheight, dd->blitdesc.lPitch / 2); break;
385         case 0x7c00:        software_renderer<UINT16, 3,3,3, 10,5,0, true>::draw_primitives(*window->m_primlist, dd->blitdesc.lpSurface, dd->blitwidth, dd->blitheight, dd->blitdesc.lPitch / 2); break;
404         case 0x00ff0000:    software_renderer<UINT32, 0,0,0, 16,8,0, true>::draw_primitives(*window().m_primlist, blitdesc.lpSurface, blitwidth, blitheight, blitdesc.lPitch / 4); break;
405         case 0x000000ff:    software_renderer<UINT32, 0,0,0, 0,8,16, true>::draw_primitives(*window().m_primlist, blitdesc.lpSurface, blitwidth, blitheight, blitdesc.lPitch / 4); break;
406         case 0xf800:        software_renderer<UINT16, 3,2,3, 11,5,0, true>::draw_primitives(*window().m_primlist, blitdesc.lpSurface, blitwidth, blitheight, blitdesc.lPitch / 2); break;
407         case 0x7c00:        software_renderer<UINT16, 3,3,3, 10,5,0, true>::draw_primitives(*window().m_primlist, blitdesc.lpSurface, blitwidth, blitheight, blitdesc.lPitch / 2); break;
386408         default:
387            osd_printf_verbose("DirectDraw: Unknown target mode: R=%08X G=%08X B=%08X\n", (int)dd->blitdesc.ddpfPixelFormat.dwRBitMask, (int)dd->blitdesc.ddpfPixelFormat.dwGBitMask, (int)dd->blitdesc.ddpfPixelFormat.dwBBitMask);
409            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);
388410            break;
389411      }
390412   }
391   window->m_primlist->release_lock();
413   window().m_primlist->release_lock();
392414
393415   // unlock and blit
394   result = IDirectDrawSurface7_Unlock(dd->blit, NULL);
416   result = IDirectDrawSurface7_Unlock(blit, NULL);
395417   if (result != DD_OK) osd_printf_verbose("DirectDraw: Error %08X unlocking blit surface\n", (int)result);
396418
397419   // sync to VBLANK
398   if ((video_config.waitvsync || video_config.syncrefresh) && window->machine().video().throttled() && (!window->m_fullscreen || dd->back == NULL))
420   if ((video_config.waitvsync || video_config.syncrefresh) && window().machine().video().throttled() && (!window().m_fullscreen || back == NULL))
399421   {
400      result = IDirectDraw7_WaitForVerticalBlank(dd->ddraw, DDWAITVB_BLOCKBEGIN, NULL);
422      result = IDirectDraw7_WaitForVerticalBlank(ddraw, DDWAITVB_BLOCKBEGIN, NULL);
401423      if (result != DD_OK) osd_printf_verbose("DirectDraw: Error %08X waiting for VBLANK\n", (int)result);
402424   }
403425
404426   // complete the blitting
405   blit_to_primary(window, dd->blitwidth, dd->blitheight);
427   blit_to_primary(blitwidth, blitheight);
406428   return 0;
407429}
408430
r243410r243411
412434//  ddraw_create
413435//============================================================
414436
415static int ddraw_create(win_window_info *window)
437int renderer_dd::ddraw_create()
416438{
417   dd_info *dd = (dd_info *)window->m_drawdata;
418439   HRESULT result;
419440   int verify;
420441
421442   // if a device exists, free it
422   if (dd->ddraw != NULL)
423      ddraw_delete(window);
443   if (ddraw != NULL)
444      ddraw_delete();
424445
425446   // create the DirectDraw object
426   result = (*directdrawcreateex)(dd->adapter_ptr, (LPVOID *)&dd->ddraw, WRAP_REFIID(IID_IDirectDraw7), NULL);
447   result = (*directdrawcreateex)(adapter_ptr, (LPVOID *)&ddraw, WRAP_REFIID(IID_IDirectDraw7), NULL);
427448   if (result != DD_OK)
428449   {
429450      osd_printf_verbose("DirectDraw: Error %08X during DirectDrawCreateEx call\n", (int)result);
r243410r243411
431452   }
432453
433454   // verify the caps
434   verify = ddraw_verify_caps(dd);
455   verify = ddraw_verify_caps();
435456   if (verify == 2)
436457   {
437458      osd_printf_error("DirectDraw: Error - Device does not meet minimum requirements for DirectDraw rendering\n");
r243410r243411
442463
443464   // set the cooperative level
444465   // for non-window modes, we will use full screen here
445   result = IDirectDraw7_SetCooperativeLevel(dd->ddraw, win_window_list->m_hwnd, DDSCL_SETFOCUSWINDOW);
466   result = IDirectDraw7_SetCooperativeLevel(ddraw, win_window_list->m_hwnd, DDSCL_SETFOCUSWINDOW);
446467   if (result != DD_OK)
447468   {
448469      osd_printf_verbose("DirectDraw: Error %08X during IDirectDraw7_SetCooperativeLevel(FOCUSWINDOW) call\n", (int)result);
449470      goto error;
450471   }
451   result = IDirectDraw7_SetCooperativeLevel(dd->ddraw, window->m_hwnd, DDSCL_SETDEVICEWINDOW | (window->m_fullscreen ? DDSCL_FULLSCREEN | DDSCL_EXCLUSIVE : DDSCL_NORMAL));
472   result = IDirectDraw7_SetCooperativeLevel(ddraw, window().m_hwnd, DDSCL_SETDEVICEWINDOW | (window().m_fullscreen ? DDSCL_FULLSCREEN | DDSCL_EXCLUSIVE : DDSCL_NORMAL));
452473   if (result != DD_OK)
453474   {
454475      osd_printf_verbose("DirectDraw: Error %08X during IDirectDraw7_SetCooperativeLevel(DEVICEWINDOW) call\n", (int)result);
r243410r243411
456477   }
457478
458479   // full screen mode: set the resolution
459   if (window->m_fullscreen && video_config.switchres)
480   if (window().m_fullscreen && video_config.switchres)
460481   {
461      result = IDirectDraw7_SetDisplayMode(dd->ddraw, dd->width, dd->height, 32, dd->refresh, 0);
482      result = IDirectDraw7_SetDisplayMode(ddraw, width, height, 32, refresh, 0);
462483      if (result != DD_OK)
463484      {
464         osd_printf_verbose("DirectDraw: Error %08X attempting to set video mode %dx%d@%d call\n", (int)result, dd->width, dd->height, dd->refresh);
485         osd_printf_verbose("DirectDraw: Error %08X attempting to set video mode %dx%d@%d call\n", (int)result, width, height, refresh);
465486         goto error;
466487      }
467488   }
468489
469   return ddraw_create_surfaces(window);
490   return ddraw_create_surfaces();
470491
471492error:
472   ddraw_delete(window);
493   ddraw_delete();
473494   return 1;
474495}
475496
r243410r243411
479500//  ddraw_create_surfaces
480501//============================================================
481502
482static int ddraw_create_surfaces(win_window_info *window)
503int renderer_dd::ddraw_create_surfaces()
483504{
484   dd_info *dd = (dd_info *)window->m_drawdata;
485505   HRESULT result;
486506
487507   // make a description of the primary surface
488   memset(&dd->primarydesc, 0, sizeof(dd->primarydesc));
489   dd->primarydesc.dwSize = sizeof(dd->primarydesc);
490   dd->primarydesc.dwFlags = DDSD_CAPS;
491   dd->primarydesc.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
508   memset(&primarydesc, 0, sizeof(primarydesc));
509   primarydesc.dwSize = sizeof(primarydesc);
510   primarydesc.dwFlags = DDSD_CAPS;
511   primarydesc.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
492512
493513   // for triple-buffered full screen mode, allocate flipping surfaces
494   if (window->m_fullscreen && video_config.triplebuf)
514   if (window().m_fullscreen && video_config.triplebuf)
495515   {
496      dd->primarydesc.dwFlags |= DDSD_BACKBUFFERCOUNT;
497      dd->primarydesc.ddsCaps.dwCaps |= DDSCAPS_FLIP | DDSCAPS_COMPLEX;
498      dd->primarydesc.dwBackBufferCount = 2;
516      primarydesc.dwFlags |= DDSD_BACKBUFFERCOUNT;
517      primarydesc.ddsCaps.dwCaps |= DDSCAPS_FLIP | DDSCAPS_COMPLEX;
518      primarydesc.dwBackBufferCount = 2;
499519   }
500520
501521   // create the primary surface and report errors
502   result = create_surface(dd, &dd->primarydesc, &dd->primary, "primary");
522   result = create_surface(&primarydesc, &primary, "primary");
503523   if (result != DD_OK) goto error;
504524
505525   // full screen mode: get the back surface
506   dd->back = NULL;
507   if (window->m_fullscreen && video_config.triplebuf)
526   back = NULL;
527   if (window().m_fullscreen && video_config.triplebuf)
508528   {
509529      DDSCAPS2 caps = { DDSCAPS_BACKBUFFER };
510      result = IDirectDrawSurface7_GetAttachedSurface(dd->primary, &caps, &dd->back);
530      result = IDirectDrawSurface7_GetAttachedSurface(primary, &caps, &back);
511531      if (result != DD_OK)
512532      {
513533         osd_printf_verbose("DirectDraw: Error %08X getting attached back surface\n", (int)result);
r243410r243411
516536   }
517537
518538   // now make a description of our blit surface, based on the primary surface
519   if (dd->blitwidth == 0 || dd->blitheight == 0)
520      compute_blit_surface_size(window);
521   dd->blitdesc = dd->primarydesc;
522   dd->blitdesc.dwFlags = DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT | DDSD_CAPS;
523   dd->blitdesc.dwWidth = dd->blitwidth;
524   dd->blitdesc.dwHeight = dd->blitheight;
525   dd->blitdesc.ddsCaps.dwCaps = DDSCAPS_VIDEOMEMORY;
539   if (blitwidth == 0 || blitheight == 0)
540      compute_blit_surface_size();
541   blitdesc = primarydesc;
542   blitdesc.dwFlags = DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT | DDSD_CAPS;
543   blitdesc.dwWidth = blitwidth;
544   blitdesc.dwHeight = blitheight;
545   blitdesc.ddsCaps.dwCaps = DDSCAPS_VIDEOMEMORY;
526546
527547   // then create the blit surface, fall back to system memory if video mem doesn't work
528   result = create_surface(dd, &dd->blitdesc, &dd->blit, "blit");
548   result = create_surface(&blitdesc, &blit, "blit");
529549   if (result != DD_OK)
530550   {
531      dd->blitdesc.ddsCaps.dwCaps = DDSCAPS_SYSTEMMEMORY;
532      result = create_surface(dd, &dd->blitdesc, &dd->blit, "blit");
551      blitdesc.ddsCaps.dwCaps = DDSCAPS_SYSTEMMEMORY;
552      result = create_surface(&blitdesc, &blit, "blit");
533553   }
534554   if (result != DD_OK) goto error;
535555
536556   // create a memory buffer for offscreen drawing
537   if (dd->membuffersize < dd->blitwidth * dd->blitheight * 4)
557   if (membuffersize < blitwidth * blitheight * 4)
538558   {
539      dd->membuffersize = dd->blitwidth * dd->blitheight * 4;
540      global_free_array(dd->membuffer);
541      dd->membuffer = global_alloc_array(UINT8, dd->membuffersize);
559      membuffersize = blitwidth * blitheight * 4;
560      global_free_array(membuffer);
561      membuffer = global_alloc_array(UINT8, membuffersize);
542562   }
543   if (dd->membuffer == NULL)
563   if (membuffer == NULL)
544564      goto error;
545565
546566   // create a clipper for windowed mode
547   if (!window->m_fullscreen && create_clipper(window))
567   if (!window().m_fullscreen && create_clipper())
548568      goto error;
549569
550570   // full screen mode: set the gamma
551   if (window->m_fullscreen)
571   if (window().m_fullscreen)
552572   {
553573      // only set the gamma if it's not 1.0f
554      windows_options &options = downcast<windows_options &>(window->machine().options());
574      windows_options &options = downcast<windows_options &>(window().machine().options());
555575      float brightness = options.full_screen_brightness();
556576      float contrast = options.full_screen_contrast();
557      float gamma = options.full_screen_gamma();
558      if (brightness != 1.0f || contrast != 1.0f || gamma != 1.0f)
577      float fgamma = options.full_screen_gamma();
578      if (brightness != 1.0f || contrast != 1.0f || fgamma != 1.0f)
559579      {
560580         // see if we can get a GammaControl object
561         result = IDirectDrawSurface_QueryInterface(dd->primary, WRAP_REFIID(IID_IDirectDrawGammaControl), (void **)&dd->gamma);
581         result = IDirectDrawSurface_QueryInterface(primary, WRAP_REFIID(IID_IDirectDrawGammaControl), (void **)&gamma);
562582         if (result != DD_OK)
563583         {
564584            osd_printf_warning("DirectDraw: Warning - device does not support full screen gamma correction.\n");
565            dd->gamma = NULL;
585            this->gamma = NULL;
566586         }
567587
568588         // proceed if we can
569         if (dd->gamma != NULL)
589         if (this->gamma != NULL)
570590         {
571591            DDGAMMARAMP ramp;
572592            int i;
573593
574594            // create a standard ramp and set it
575595            for (i = 0; i < 256; i++)
576               ramp.red[i] = ramp.green[i] = ramp.blue[i] = apply_brightness_contrast_gamma(i, brightness, contrast, gamma) << 8;
596               ramp.red[i] = ramp.green[i] = ramp.blue[i] = apply_brightness_contrast_gamma(i, brightness, contrast, fgamma) << 8;
577597
578598            // attempt to set it
579            result = IDirectDrawGammaControl_SetGammaRamp(dd->gamma, 0, &ramp);
599            result = IDirectDrawGammaControl_SetGammaRamp(this->gamma, 0, &ramp);
580600            if (result != DD_OK)
581601               osd_printf_verbose("DirectDraw: Error %08X attempting to set gamma correction.\n", (int)result);
582602         }
r243410r243411
584604   }
585605
586606   // force some updates
587   update_outer_rects(dd);
607   update_outer_rects();
588608   return 0;
589609
590610error:
591   ddraw_delete_surfaces(window);
611   ddraw_delete_surfaces();
592612   return 1;
593613}
594614
r243410r243411
598618//  ddraw_delete
599619//============================================================
600620
601static void ddraw_delete(win_window_info *window)
621void renderer_dd::ddraw_delete()
602622{
603   dd_info *dd = (dd_info *)window->m_drawdata;
604
605623   // free surfaces
606   ddraw_delete_surfaces(window);
624   ddraw_delete_surfaces();
607625
608626   // restore resolutions
609   if (dd->ddraw != NULL)
610      IDirectDraw7_RestoreDisplayMode(dd->ddraw);
627   if (ddraw != NULL)
628      IDirectDraw7_RestoreDisplayMode(ddraw);
611629
612630   // reset cooperative level
613   if (dd->ddraw != NULL && window->m_hwnd != NULL)
614      IDirectDraw7_SetCooperativeLevel(dd->ddraw, window->m_hwnd, DDSCL_NORMAL);
631   if (ddraw != NULL && window().m_hwnd != NULL)
632      IDirectDraw7_SetCooperativeLevel(ddraw, window().m_hwnd, DDSCL_NORMAL);
615633
616634   // release the DirectDraw object itself
617   if (dd->ddraw != NULL)
618      IDirectDraw7_Release(dd->ddraw);
619   dd->ddraw = NULL;
635   if (ddraw != NULL)
636      IDirectDraw7_Release(ddraw);
637   ddraw = NULL;
620638}
621639
622640
r243410r243411
625643//  ddraw_delete_surfaces
626644//============================================================
627645
628static void ddraw_delete_surfaces(win_window_info *window)
646void renderer_dd::ddraw_delete_surfaces()
629647{
630   dd_info *dd = (dd_info *)window->m_drawdata;
631
632648   // release the gamma control
633   if (dd->gamma != NULL)
634      IDirectDrawGammaControl_Release(dd->gamma);
635   dd->gamma = NULL;
649   if (gamma != NULL)
650      IDirectDrawGammaControl_Release(gamma);
651   gamma = NULL;
636652
637653   // release the clipper
638   if (dd->clipper != NULL)
639      IDirectDrawClipper_Release(dd->clipper);
640   dd->clipper = NULL;
654   if (clipper != NULL)
655      IDirectDrawClipper_Release(clipper);
656   clipper = NULL;
641657
642658   // free the memory buffer
643   global_free_array(dd->membuffer);
644   dd->membuffer = NULL;
645   dd->membuffersize = 0;
659   global_free_array(membuffer);
660   membuffer = NULL;
661   membuffersize = 0;
646662
647663   // release the blit surface
648   if (dd->blit != NULL)
649      IDirectDrawSurface7_Release(dd->blit);
650   dd->blit = NULL;
664   if (blit != NULL)
665      IDirectDrawSurface7_Release(blit);
666   blit = NULL;
651667
652668   // release the back surface
653   if (dd->back != NULL)
654      IDirectDrawSurface7_Release(dd->back);
655   dd->back = NULL;
669   if (back != NULL)
670      IDirectDrawSurface7_Release(back);
671   back = NULL;
656672
657673   // release the primary surface
658   if (dd->primary != NULL)
659      IDirectDrawSurface7_Release(dd->primary);
660   dd->primary = NULL;
674   if (primary != NULL)
675      IDirectDrawSurface7_Release(primary);
676   primary = NULL;
661677}
662678
663679
r243410r243411
666682//  ddraw_verify_caps
667683//============================================================
668684
669static int ddraw_verify_caps(dd_info *dd)
685int renderer_dd::ddraw_verify_caps()
670686{
671687   int retval = 0;
672688   HRESULT result;
673689
674690   // get the capabilities
675   dd->ddcaps.dwSize = sizeof(dd->ddcaps);
676   dd->helcaps.dwSize = sizeof(dd->helcaps);
677   result = IDirectDraw7_GetCaps(dd->ddraw, &dd->ddcaps, &dd->helcaps);
691   ddcaps.dwSize = sizeof(ddcaps);
692   helcaps.dwSize = sizeof(helcaps);
693   result = IDirectDraw7_GetCaps(ddraw, &ddcaps, &helcaps);
678694   if (result != DD_OK)
679695   {
680696      osd_printf_verbose("DirectDraw: Error %08X during IDirectDraw7_GetCaps call\n", (int)result);
r243410r243411
682698   }
683699
684700   // determine if hardware stretching is available
685   if ((dd->ddcaps.dwCaps & DDCAPS_BLTSTRETCH) == 0)
701   if ((ddcaps.dwCaps & DDCAPS_BLTSTRETCH) == 0)
686702   {
687703      osd_printf_verbose("DirectDraw: Warning - Device does not support hardware stretching\n");
688704      retval = 1;
r243410r243411
697713//  ddraw_test_cooperative
698714//============================================================
699715
700static int ddraw_test_cooperative(win_window_info *window)
716int renderer_dd::ddraw_test_cooperative()
701717{
702   dd_info *dd = (dd_info *)window->m_drawdata;
703718   HRESULT result;
704719
705720   // check our current status; if we lost the device, punt to GDI
706   result = IDirectDraw7_TestCooperativeLevel(dd->ddraw);
721   result = IDirectDraw7_TestCooperativeLevel(ddraw);
707722   switch (result)
708723   {
709724      // punt to GDI if someone else has exclusive mode
710725      case DDERR_NOEXCLUSIVEMODE:
711726      case DDERR_EXCLUSIVEMODEALREADYSET:
712         ddraw_delete_surfaces(window);
727         ddraw_delete_surfaces();
713728         return 1;
714729
715730      // if we're ok, but we don't have a primary surface, create one
716731      default:
717732      case DD_OK:
718         if (dd->primary == NULL)
719            return ddraw_create_surfaces(window);
733         if (primary == NULL)
734            return ddraw_create_surfaces();
720735         return 0;
721736   }
722737}
r243410r243411
727742//  create_surface
728743//============================================================
729744
730static HRESULT create_surface(dd_info *dd, DDSURFACEDESC2 *desc, IDirectDrawSurface7 **surface, const char *type)
745HRESULT renderer_dd::create_surface(DDSURFACEDESC2 *desc, IDirectDrawSurface7 **surface, const char *type)
731746{
732747   HRESULT result;
733748
734749   // create the surface as requested
735   result = IDirectDraw7_CreateSurface(dd->ddraw, desc, surface, NULL);
750   result = IDirectDraw7_CreateSurface(ddraw, desc, surface, NULL);
736751   if (result != DD_OK)
737752   {
738753      osd_printf_verbose("DirectDraw: Error %08X creating %s surface\n", (int)result, type);
r243410r243411
767782//  create_clipper
768783//============================================================
769784
770static int create_clipper(win_window_info *window)
785int renderer_dd::create_clipper()
771786{
772   dd_info *dd = (dd_info *)window->m_drawdata;
773787   HRESULT result;
774788
775789   // create a clipper for the primary surface
776   result = IDirectDraw7_CreateClipper(dd->ddraw, 0, &dd->clipper, NULL);
790   result = IDirectDraw7_CreateClipper(ddraw, 0, &clipper, NULL);
777791   if (result != DD_OK)
778792   {
779793      osd_printf_verbose("DirectDraw: Error %08X creating clipper\n", (int)result);
r243410r243411
781795   }
782796
783797   // set the clipper's hwnd
784   result = IDirectDrawClipper_SetHWnd(dd->clipper, 0, window->m_hwnd);
798   result = IDirectDrawClipper_SetHWnd(clipper, 0, window().m_hwnd);
785799   if (result != DD_OK)
786800   {
787801      osd_printf_verbose("DirectDraw: Error %08X setting clipper hwnd\n", (int)result);
r243410r243411
789803   }
790804
791805   // set the clipper on the primary surface
792   result = IDirectDrawSurface7_SetClipper(dd->primary, dd->clipper);
806   result = IDirectDrawSurface7_SetClipper(primary, clipper);
793807   if (result != DD_OK)
794808   {
795809      osd_printf_verbose("DirectDraw: Error %08X setting clipper on primary surface\n", (int)result);
r243410r243411
804818//  compute_blit_surface_size
805819//============================================================
806820
807static void compute_blit_surface_size(win_window_info *window)
821void renderer_dd::compute_blit_surface_size()
808822{
809   dd_info *dd = (dd_info *)window->m_drawdata;
810823   INT32 newwidth, newheight;
811824   int xscale, yscale;
812825   RECT client;
813826
814827   // start with the minimum size
815   window->m_target->compute_minimum_size(newwidth, newheight);
828   window().m_target->compute_minimum_size(newwidth, newheight);
816829
817830   // get the window's client rectangle
818   GetClientRect(window->m_hwnd, &client);
831   GetClientRect(window().m_hwnd, &client);
819832
820833   // hardware stretch case: apply prescale
821834   if (video_config.hwstretch)
r243410r243411
841854      // compute the appropriate visible area if we're trying to keepaspect
842855      if (video_config.keepaspect)
843856      {
844         win_monitor_info *monitor = winwindow_video_window_monitor(window, NULL);
845         window->m_target->compute_visible_area(target_width, target_height, monitor->get_aspect(), window->m_target->orientation(), target_width, target_height);
857         win_monitor_info *monitor = winwindow_video_window_monitor(&window(), NULL);
858         window().m_target->compute_visible_area(target_width, target_height, monitor->get_aspect(), window().m_target->orientation(), target_width, target_height);
846859         desired_aspect = (float)target_width / (float)target_height;
847860      }
848861
r243410r243411
884897   // apply the final scale
885898   newwidth *= xscale;
886899   newheight *= yscale;
887   if (newwidth != dd->blitwidth || newheight != dd->blitheight)
900   if (newwidth != blitwidth || newheight != blitheight)
888901   {
889902      // force some updates
890      update_outer_rects(dd);
903      update_outer_rects();
891904      osd_printf_verbose("DirectDraw: New blit size = %dx%d\n", newwidth, newheight);
892905   }
893   dd->blitwidth = newwidth;
894   dd->blitheight = newheight;
906   blitwidth = newwidth;
907   blitheight = newheight;
895908}
896909
897910
r243410r243411
900913//  calc_fullscreen_margins
901914//============================================================
902915
903static void calc_fullscreen_margins(win_window_info *window, DWORD desc_width, DWORD desc_height, RECT *margins)
916void renderer_dd::calc_fullscreen_margins(DWORD desc_width, DWORD desc_height, RECT *margins)
904917{
905918   margins->left = 0;
906919   margins->top = 0;
907920   margins->right = desc_width;
908921   margins->bottom = desc_height;
909922
910   if (win_has_menu(window))
923   if (win_has_menu(&window()))
911924   {
912925      static int height_with_menubar = 0;
913926      if (height_with_menubar == 0)
r243410r243411
928941//  blit_to_primary
929942//============================================================
930943
931static void blit_to_primary(win_window_info *window, int srcwidth, int srcheight)
944void renderer_dd::blit_to_primary(int srcwidth, int srcheight)
932945{
933   dd_info *dd = (dd_info *)window->m_drawdata;
934   IDirectDrawSurface7 *target = (dd->back != NULL) ? dd->back : dd->primary;
935   win_monitor_info *monitor = winwindow_video_window_monitor(window, NULL);
946   IDirectDrawSurface7 *target = (back != NULL) ? back : primary;
947   win_monitor_info *monitor = winwindow_video_window_monitor(&window(), NULL);
936948   DDBLTFX blitfx = { sizeof(DDBLTFX) };
937949   RECT clear, outer, dest, source;
938950   INT32 dstwidth, dstheight;
r243410r243411
944956   source.bottom = srcheight;
945957
946958   // compute outer rect -- windowed version
947   if (!window->m_fullscreen)
959   if (!window().m_fullscreen)
948960   {
949      GetClientRect(window->m_hwnd, &outer);
950      ClientToScreen(window->m_hwnd, &((LPPOINT)&outer)[0]);
951      ClientToScreen(window->m_hwnd, &((LPPOINT)&outer)[1]);
961      GetClientRect(window().m_hwnd, &outer);
962      ClientToScreen(window().m_hwnd, &((LPPOINT)&outer)[0]);
963      ClientToScreen(window().m_hwnd, &((LPPOINT)&outer)[1]);
952964
953965      // adjust to be relative to the monitor
954966      outer.left -= monitor->info.rcMonitor.left;
r243410r243411
960972   // compute outer rect -- full screen version
961973   else
962974   {
963      calc_fullscreen_margins(window, dd->primarydesc.dwWidth, dd->primarydesc.dwHeight, &outer);
975      calc_fullscreen_margins(primarydesc.dwWidth, primarydesc.dwHeight, &outer);
964976   }
965977
966978   // if we're respecting the aspect ratio, we need to adjust to fit
r243410r243411
987999   else if (video_config.keepaspect)
9881000   {
9891001      // compute the appropriate visible area
990      window->m_target->compute_visible_area(rect_width(&outer), rect_height(&outer), monitor->get_aspect(), window->m_target->orientation(), dstwidth, dstheight);
1002      window().m_target->compute_visible_area(rect_width(&outer), rect_height(&outer), monitor->get_aspect(), window().m_target->orientation(), dstwidth, dstheight);
9911003   }
9921004
9931005   // center within
r243410r243411
9971009   dest.bottom = dest.top + dstheight;
9981010
9991011   // compare against last destination; if different, force a redraw
1000   if (dest.left != dd->lastdest.left || dest.right != dd->lastdest.right || dest.top != dd->lastdest.top || dest.bottom != dd->lastdest.bottom)
1012   if (dest.left != lastdest.left || dest.right != lastdest.right || dest.top != lastdest.top || dest.bottom != lastdest.bottom)
10011013   {
1002      dd->lastdest = dest;
1003      update_outer_rects(dd);
1014      lastdest = dest;
1015      update_outer_rects();
10041016   }
10051017
10061018   // clear outer rects if we need to
1007   if (dd->clearouter != 0)
1019   if (clearouter != 0)
10081020   {
1009      dd->clearouter--;
1021      clearouter--;
10101022
10111023      // clear the left edge
10121024      if (dest.left > outer.left)
r243410r243411
10461058   }
10471059
10481060   // do the blit
1049   result = IDirectDrawSurface7_Blt(target, &dest, dd->blit, &source, DDBLT_WAIT, NULL);
1061   result = IDirectDrawSurface7_Blt(target, &dest, blit, &source, DDBLT_WAIT, NULL);
10501062   if (result != DD_OK) osd_printf_verbose("DirectDraw: Error %08X blitting to the screen\n", (int)result);
10511063
10521064   // page flip if triple buffered
1053   if (window->m_fullscreen && dd->back != NULL)
1065   if (window().m_fullscreen && back != NULL)
10541066   {
1055      result = IDirectDrawSurface7_Flip(dd->primary, NULL, DDFLIP_WAIT);
1067      result = IDirectDrawSurface7_Flip(primary, NULL, DDFLIP_WAIT);
10561068      if (result != DD_OK) osd_printf_verbose("DirectDraw: Error %08X waiting for VBLANK\n", (int)result);
10571069   }
10581070}
r243410r243411
10631075//  config_adapter_mode
10641076//============================================================
10651077
1066static int config_adapter_mode(win_window_info *window)
1078int renderer_dd::config_adapter_mode()
10671079{
10681080   DDDEVICEIDENTIFIER2 identifier;
1069   dd_info *dd = (dd_info *)window->m_drawdata;
10701081   HRESULT result;
10711082
10721083   // choose the monitor number
1073   get_adapter_for_monitor(dd, window->m_monitor);
1084   get_adapter_for_monitor(window().m_monitor);
10741085
10751086   // create a temporary DirectDraw object
1076   result = (*directdrawcreateex)(dd->adapter_ptr, (LPVOID *)&dd->ddraw, WRAP_REFIID(IID_IDirectDraw7), NULL);
1087   result = (*directdrawcreateex)(adapter_ptr, (LPVOID *)&ddraw, WRAP_REFIID(IID_IDirectDraw7), NULL);
10771088   if (result != DD_OK)
10781089   {
10791090      osd_printf_verbose("DirectDraw: Error %08X during DirectDrawCreateEx call\n", (int)result);
r243410r243411
10811092   }
10821093
10831094   // get the identifier
1084   result = IDirectDraw7_GetDeviceIdentifier(dd->ddraw, &identifier, 0);
1095   result = IDirectDraw7_GetDeviceIdentifier(ddraw, &identifier, 0);
10851096   if (result != DD_OK)
10861097   {
10871098      osd_printf_error("Error getting identifier for device\n");
r243410r243411
10901101   osd_printf_verbose("DirectDraw: Configuring device %s\n", identifier.szDescription);
10911102
10921103   // get the current display mode
1093   memset(&dd->origmode, 0, sizeof(dd->origmode));
1094   dd->origmode.dwSize = sizeof(dd->origmode);
1095   result = IDirectDraw7_GetDisplayMode(dd->ddraw, &dd->origmode);
1104   memset(&origmode, 0, sizeof(origmode));
1105   origmode.dwSize = sizeof(origmode);
1106   result = IDirectDraw7_GetDisplayMode(ddraw, &origmode);
10961107   if (result != DD_OK)
10971108   {
10981109      osd_printf_verbose("DirectDraw: Error %08X getting current display mode\n", (int)result);
1099      IDirectDraw7_Release(dd->ddraw);
1110      IDirectDraw7_Release(ddraw);
11001111      return 1;
11011112   }
11021113
11031114   // choose a resolution: full screen mode case
1104   if (window->m_fullscreen)
1115   if (window().m_fullscreen)
11051116   {
11061117      // default to the current mode exactly
1107      dd->width = dd->origmode.dwWidth;
1108      dd->height = dd->origmode.dwHeight;
1109      dd->refresh = dd->origmode.dwRefreshRate;
1118      width = origmode.dwWidth;
1119      height = origmode.dwHeight;
1120      refresh = origmode.dwRefreshRate;
11101121
11111122      // if we're allowed to switch resolutions, override with something better
11121123      if (video_config.switchres)
1113         pick_best_mode(window);
1124         pick_best_mode();
11141125   }
11151126
11161127   // release the DirectDraw object
1117   IDirectDraw7_Release(dd->ddraw);
1118   dd->ddraw = NULL;
1128   IDirectDraw7_Release(ddraw);
1129   ddraw = NULL;
11191130
11201131   // if we're not changing resolutions, make sure we have a resolution we can handle
1121   if (!window->m_fullscreen || !video_config.switchres)
1132   if (!window().m_fullscreen || !video_config.switchres)
11221133   {
1123      switch (dd->origmode.ddpfPixelFormat.dwRBitMask)
1134      switch (origmode.ddpfPixelFormat.dwRBitMask)
11241135      {
11251136         case 0x00ff0000:
11261137         case 0x000000ff:
r243410r243411
11291140            break;
11301141
11311142         default:
1132            osd_printf_verbose("DirectDraw: Unknown target mode: R=%08X G=%08X B=%08X\n", (int)dd->origmode.ddpfPixelFormat.dwRBitMask, (int)dd->origmode.ddpfPixelFormat.dwGBitMask, (int)dd->origmode.ddpfPixelFormat.dwBBitMask);
1143            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);
11331144            return 1;
11341145      }
11351146   }
r243410r243411
11641175//  get_adapter_for_monitor
11651176//============================================================
11661177
1167static void get_adapter_for_monitor(dd_info *dd, win_monitor_info *monitor)
1178void renderer_dd::get_adapter_for_monitor(win_monitor_info *monitor)
11681179{
11691180   monitor_enum_info einfo;
11701181   HRESULT result;
r243410r243411
11781189   // set up the adapter
11791190   if (einfo.foundit && einfo.guid_ptr != NULL)
11801191   {
1181      dd->adapter = einfo.guid;
1182      dd->adapter_ptr = &dd->adapter;
1192      adapter = einfo.guid;
1193      adapter_ptr = &adapter;
11831194   }
11841195   else
1185      dd->adapter_ptr = NULL;
1196      adapter_ptr = NULL;
11861197}
11871198
11881199
r243410r243411
11951206{
11961207   float size_score, refresh_score, final_score;
11971208   mode_enum_info *einfo = (mode_enum_info *)context;
1198   dd_info *dd = (dd_info *)einfo->window->m_drawdata;
1209   renderer_dd *dd = dynamic_cast<renderer_dd *>(einfo->window->m_renderer);
11991210
12001211   // skip non-32 bit modes
12011212   if (desc->ddpfPixelFormat.dwRGBBitCount != 32)
r243410r243411
12481259//  pick_best_mode
12491260//============================================================
12501261
1251static void pick_best_mode(win_window_info *window)
1262void renderer_dd::pick_best_mode()
12521263{
1253   dd_info *dd = (dd_info *)window->m_drawdata;
12541264   mode_enum_info einfo;
12551265   HRESULT result;
12561266
r243410r243411
12581268   // note: technically we should not be calling this from an alternate window
12591269   // thread; however, it is only done during init time, and the init code on
12601270   // the main thread is waiting for us to finish, so it is safe to do so here
1261   window->m_target->compute_minimum_size(einfo.minimum_width, einfo.minimum_height);
1271   window().m_target->compute_minimum_size(einfo.minimum_width, einfo.minimum_height);
12621272
12631273   // use those as the target for now
12641274   einfo.target_width = einfo.minimum_width * MAX(1, video_config.prescale);
r243410r243411
12661276
12671277   // determine the refresh rate of the primary screen
12681278   einfo.target_refresh = 60.0;
1269   const screen_device *primary_screen = window->machine().config().first_screen();
1279   const screen_device *primary_screen = window().machine().config().first_screen();
12701280   if (primary_screen != NULL)
12711281      einfo.target_refresh = ATTOSECONDS_TO_HZ(primary_screen->refresh_attoseconds());
12721282   printf("Target refresh = %f\n", einfo.target_refresh);
r243410r243411
12861296   }
12871297
12881298   // fill in the rest of the data
1289   einfo.window = window;
1299   einfo.window = &window();
12901300   einfo.best_score = 0.0f;
12911301
12921302   // enumerate the modes
12931303   osd_printf_verbose("DirectDraw: Selecting video mode...\n");
1294   result = IDirectDraw7_EnumDisplayModes(dd->ddraw, DDEDM_REFRESHRATES, NULL, &einfo, enum_modes_callback);
1304   result = IDirectDraw7_EnumDisplayModes(ddraw, DDEDM_REFRESHRATES, NULL, &einfo, enum_modes_callback);
12951305   if (result != DD_OK) osd_printf_verbose("DirectDraw: Error %08X during EnumDisplayModes call\n", (int)result);
1296   osd_printf_verbose("DirectDraw: Mode selected = %4dx%4d@%3dHz\n", dd->width, dd->height, dd->refresh);
1306   osd_printf_verbose("DirectDraw: Mode selected = %4dx%4d@%3dHz\n", width, height, refresh);
12971307}
trunk/src/osd/windows/drawgdi.c
r243410r243411
1818#include "window.h"
1919
2020
21
2221//============================================================
2322//  TYPE DEFINITIONS
2423//============================================================
2524
26/* gdi_info is the information for the current screen */
27struct gdi_info
25class renderer_gdi : public osd_renderer
2826{
27public:
28   renderer_gdi(win_window_info *window)
29   : osd_renderer(window, FLAG_NONE), bmdata(NULL), bmsize(0) { }
30
31   virtual ~renderer_gdi() { }
32
33   virtual int init();
34   virtual render_primitive_list *get_primitives();
35   virtual int draw(HDC dc, int update);
36   virtual void save() {};
37   virtual void record() {};
38   virtual void toggle_fsfx() {};
39   virtual void destroy();
40
41private:
42   /* gdi_info is the information for the current screen */
2943   BITMAPINFO              bminfo;
3044   UINT8 *                 bmdata;
3145   size_t                  bmsize;
3246};
3347
3448
35
3649//============================================================
3750//  PROTOTYPES
3851//============================================================
3952
4053// core functions
4154static void drawgdi_exit(void);
42static int drawgdi_window_init(win_window_info *window);
43static void drawgdi_window_destroy(win_window_info *window);
44static render_primitive_list *drawgdi_window_get_primitives(win_window_info *window);
45static int drawgdi_window_draw(win_window_info *window, HDC dc, int update);
4655
56//============================================================
57//  drawnone_create
58//============================================================
4759
60static osd_renderer *drawgdi_create(win_window_info *window)
61{
62   return global_alloc(renderer_gdi(window));
63}
4864
65
4966//============================================================
5067//  drawgdi_init
5168//============================================================
5269
53int drawgdi_init(running_machine &machine, win_draw_callbacks *callbacks)
70int drawgdi_init(running_machine &machine, osd_draw_callbacks *callbacks)
5471{
5572   // fill in the callbacks
5673   memset(callbacks, 0, sizeof(*callbacks));
5774   callbacks->exit = drawgdi_exit;
58   callbacks->window_init = drawgdi_window_init;
59   callbacks->window_get_primitives = drawgdi_window_get_primitives;
60   callbacks->window_draw = drawgdi_window_draw;
61   callbacks->window_destroy = drawgdi_window_destroy;
75   callbacks->create = drawgdi_create;
6276   return 0;
6377}
6478
r243410r243411
7892//  drawgdi_window_init
7993//============================================================
8094
81static int drawgdi_window_init(win_window_info *window)
95int renderer_gdi::init()
8296{
83   // allocate memory for our structures
84   gdi_info *gdi = global_alloc_clear(gdi_info);
85   window->m_drawdata = gdi;
8697
8798   // fill in the bitmap info header
88   gdi->bminfo.bmiHeader.biSize            = sizeof(gdi->bminfo.bmiHeader);
89   gdi->bminfo.bmiHeader.biPlanes          = 1;
90   gdi->bminfo.bmiHeader.biBitCount        = 32;
91   gdi->bminfo.bmiHeader.biCompression     = BI_RGB;
92   gdi->bminfo.bmiHeader.biSizeImage       = 0;
93   gdi->bminfo.bmiHeader.biXPelsPerMeter   = 0;
94   gdi->bminfo.bmiHeader.biYPelsPerMeter   = 0;
95   gdi->bminfo.bmiHeader.biClrUsed         = 0;
96   gdi->bminfo.bmiHeader.biClrImportant    = 0;
99   bminfo.bmiHeader.biSize            = sizeof(bminfo.bmiHeader);
100   bminfo.bmiHeader.biPlanes          = 1;
101   bminfo.bmiHeader.biBitCount        = 32;
102   bminfo.bmiHeader.biCompression     = BI_RGB;
103   bminfo.bmiHeader.biSizeImage       = 0;
104   bminfo.bmiHeader.biXPelsPerMeter   = 0;
105   bminfo.bmiHeader.biYPelsPerMeter   = 0;
106   bminfo.bmiHeader.biClrUsed         = 0;
107   bminfo.bmiHeader.biClrImportant    = 0;
97108
98109   return 0;
99110}
r243410r243411
104115//  drawgdi_window_destroy
105116//============================================================
106117
107static void drawgdi_window_destroy(win_window_info *window)
118void renderer_gdi::destroy()
108119{
109   gdi_info *gdi = (gdi_info *)window->m_drawdata;
110120
111   // skip if nothing
112   if (gdi == NULL)
113      return;
114
115121   // free the bitmap memory
116   if (gdi->bmdata != NULL)
117      global_free_array(gdi->bmdata);
118   global_free(gdi);
119   window->m_drawdata = NULL;
122   if (bmdata != NULL)
123      global_free_array(bmdata);
120124}
121125
122126
r243410r243411
125129//  drawgdi_window_get_primitives
126130//============================================================
127131
128static render_primitive_list *drawgdi_window_get_primitives(win_window_info *window)
132render_primitive_list *renderer_gdi::get_primitives()
129133{
130134   RECT client;
131   GetClientRect(window->m_hwnd, &client);
132   window->m_target->set_bounds(rect_width(&client), rect_height(&client), window->m_monitor->get_aspect());
133   return &window->m_target->get_primitives();
135   GetClientRect(window().m_hwnd, &client);
136   window().m_target->set_bounds(rect_width(&client), rect_height(&client), window().m_monitor->get_aspect());
137   return &window().m_target->get_primitives();
134138}
135139
136140
r243410r243411
139143//  drawgdi_window_draw
140144//============================================================
141145
142static int drawgdi_window_draw(win_window_info *window, HDC dc, int update)
146int renderer_gdi::draw(HDC dc, int update)
143147{
144   gdi_info *gdi = (gdi_info *)window->m_drawdata;
145148   int width, height, pitch;
146149   RECT bounds;
147150
148151   // we don't have any special resize behaviors
149   if (window->m_resize_state == RESIZE_STATE_PENDING)
150      window->m_resize_state = RESIZE_STATE_NORMAL;
152   if (window().m_resize_state == RESIZE_STATE_PENDING)
153      window().m_resize_state = RESIZE_STATE_NORMAL;
151154
152155   // get the target bounds
153   GetClientRect(window->m_hwnd, &bounds);
156   GetClientRect(window().m_hwnd, &bounds);
154157
155158   // compute width/height/pitch of target
156159   width = rect_width(&bounds);
r243410r243411
158161   pitch = (width + 3) & ~3;
159162
160163   // make sure our temporary bitmap is big enough
161   if (pitch * height * 4 > gdi->bmsize)
164   if (pitch * height * 4 > bmsize)
162165   {
163      gdi->bmsize = pitch * height * 4 * 2;
164      global_free_array(gdi->bmdata);
165      gdi->bmdata = global_alloc_array(UINT8, gdi->bmsize);
166      bmsize = pitch * height * 4 * 2;
167      global_free_array(bmdata);
168      bmdata = global_alloc_array(UINT8, bmsize);
166169   }
167170
168171   // draw the primitives to the bitmap
169   window->m_primlist->acquire_lock();
170   software_renderer<UINT32, 0,0,0, 16,8,0>::draw_primitives(*window->m_primlist, gdi->bmdata, width, height, pitch);
171   window->m_primlist->release_lock();
172   window().m_primlist->acquire_lock();
173   software_renderer<UINT32, 0,0,0, 16,8,0>::draw_primitives(*window().m_primlist, bmdata, width, height, pitch);
174   window().m_primlist->release_lock();
172175
173176   // fill in bitmap-specific info
174   gdi->bminfo.bmiHeader.biWidth = pitch;
175   gdi->bminfo.bmiHeader.biHeight = -height;
177   bminfo.bmiHeader.biWidth = pitch;
178   bminfo.bmiHeader.biHeight = -height;
176179
177180   // blit to the screen
178181   StretchDIBits(dc, 0, 0, width, height,
179182            0, 0, width, height,
180            gdi->bmdata, &gdi->bminfo, DIB_RGB_COLORS, SRCCOPY);
183            bmdata, &bminfo, DIB_RGB_COLORS, SRCCOPY);
181184   return 0;
182185}
trunk/src/osd/windows/drawnone.c
r243410r243411
1717#include "window.h"
1818
1919
20class renderer_none : public osd_renderer
21{
22public:
23   renderer_none(win_window_info *window)
24   : osd_renderer(window, FLAG_NONE) { }
2025
26   virtual ~renderer_none() { }
27
28   virtual int init();
29   virtual render_primitive_list *get_primitives();
30   virtual int draw(HDC dc, int update);
31   virtual void save() { };
32   virtual void record() { };
33   virtual void toggle_fsfx() { };
34   virtual void destroy();
35
36private:
37};
38
2139//============================================================
2240//  PROTOTYPES
2341//============================================================
2442
2543// core functions
2644static void drawnone_exit(void);
27static int drawnone_window_init(win_window_info *window);
28static void drawnone_window_destroy(win_window_info *window);
29static render_primitive_list *drawnone_window_get_primitives(win_window_info *window);
30static int drawnone_window_draw(win_window_info *window, HDC dc, int update);
3145
46//============================================================
47//  drawnone_create
48//============================================================
3249
50osd_renderer *drawnone_create(win_window_info *window)
51{
52   return global_alloc(renderer_none(window));
53}
3354
3455//============================================================
3556//  drawnone_init
3657//============================================================
3758
38int drawnone_init(running_machine &machine, win_draw_callbacks *callbacks)
59int drawnone_init(running_machine &machine, osd_draw_callbacks *callbacks)
3960{
4061   // fill in the callbacks
4162   memset(callbacks, 0, sizeof(*callbacks));
4263   callbacks->exit = drawnone_exit;
43   callbacks->window_init = drawnone_window_init;
44   callbacks->window_get_primitives = drawnone_window_get_primitives;
45   callbacks->window_draw = drawnone_window_draw;
46   callbacks->window_destroy = drawnone_window_destroy;
64   callbacks->create = drawnone_create;
4765   return 0;
4866}
4967
r243410r243411
6381//  drawnone_window_init
6482//============================================================
6583
66static int drawnone_window_init(win_window_info *window)
84int renderer_none::init()
6785{
6886   return 0;
6987}
r243410r243411
7492//  drawnone_window_destroy
7593//============================================================
7694
77static void drawnone_window_destroy(win_window_info *window)
95void renderer_none::destroy()
7896{
7997}
8098
r243410r243411
84102//  drawnone_window_get_primitives
85103//============================================================
86104
87static render_primitive_list *drawnone_window_get_primitives(win_window_info *window)
105render_primitive_list *renderer_none::get_primitives()
88106{
89107   RECT client;
90   GetClientRect(window->m_hwnd, &client);
91   window->m_target->set_bounds(rect_width(&client), rect_height(&client), window->m_monitor->get_aspect());
92   return &window->m_target->get_primitives();
108   GetClientRect(window().m_hwnd, &client);
109   window().m_target->set_bounds(rect_width(&client), rect_height(&client), window().m_monitor->get_aspect());
110   return &window().m_target->get_primitives();
93111}
94112
95113
r243410r243411
98116//  drawnone_window_draw
99117//============================================================
100118
101static int drawnone_window_draw(win_window_info *window, HDC dc, int update)
119int renderer_none::draw(HDC dc, int update)
102120{
103121   return 0;
104122}
trunk/src/osd/windows/window.c
r243410r243411
3535#include "config.h"
3636#include "winutf8.h"
3737
38extern int drawnone_init(running_machine &machine, win_draw_callbacks *callbacks);
39extern int drawgdi_init(running_machine &machine, win_draw_callbacks *callbacks);
40extern int drawdd_init(running_machine &machine, win_draw_callbacks *callbacks);
41extern int drawd3d_init(running_machine &machine, win_draw_callbacks *callbacks);
42extern int drawbgfx_init(running_machine &machine, win_draw_callbacks *callbacks);
38extern int drawnone_init(running_machine &machine, osd_draw_callbacks *callbacks);
39extern int drawgdi_init(running_machine &machine, osd_draw_callbacks *callbacks);
40extern int drawdd_init(running_machine &machine, osd_draw_callbacks *callbacks);
41extern int drawd3d_init(running_machine &machine, osd_draw_callbacks *callbacks);
42extern int drawbgfx_init(running_machine &machine, osd_draw_callbacks *callbacks);
4343
4444
4545//============================================================
r243410r243411
107107
108108static DWORD last_update_time;
109109
110static win_draw_callbacks draw;
110static osd_draw_callbacks draw;
111111
112112static HANDLE ui_pause_event;
113113static HANDLE window_thread_ready_event;
r243410r243411
320320      m_lastclicktime(0),
321321      m_lastclickx(0),
322322      m_lastclicky(0),
323      m_drawdata(NULL),
323      m_renderer(NULL),
324324      m_machine(machine)
325325{
326326   memset(m_title,0,sizeof(m_title));
r243410r243411
504504
505505void winwindow_take_snap(void)
506506{
507   if (draw.window_record == NULL)
508      return;
509
510507   win_window_info *window;
511508
512509   assert(GetCurrentThreadId() == main_threadid);
r243410r243411
514511   // iterate over windows and request a snap
515512   for (window = win_window_list; window != NULL; window = window->m_next)
516513   {
517      (*draw.window_save)(window);
514      window->m_renderer->save();
518515   }
519516}
520517
r243410r243411
527524
528525void winwindow_toggle_fsfx(void)
529526{
530   if (draw.window_toggle_fsfx == NULL)
531      return;
532
533527   win_window_info *window;
534528
535529   assert(GetCurrentThreadId() == main_threadid);
r243410r243411
537531   // iterate over windows and request a snap
538532   for (window = win_window_list; window != NULL; window = window->m_next)
539533   {
540      (*draw.window_toggle_fsfx)(window);
534      window->m_renderer->toggle_fsfx();
541535   }
542536}
543537
r243410r243411
550544
551545void winwindow_take_video(void)
552546{
553   if (draw.window_record == NULL)
554      return;
555
556547   win_window_info *window;
557548
558549   assert(GetCurrentThreadId() == main_threadid);
r243410r243411
560551   // iterate over windows and request a snap
561552   for (window = win_window_list; window != NULL; window = window->m_next)
562553   {
563      (*draw.window_record)(window);
554      window->m_renderer->record();
564555   }
565556}
566557
r243410r243411
812803   }
813804
814805   // if we're visible and running and not in the middle of a resize, draw
815   if (m_hwnd != NULL && m_target != NULL && m_drawdata != NULL)
806   if (m_hwnd != NULL && m_target != NULL && m_renderer != NULL)
816807   {
817808      int got_lock = TRUE;
818809
r243410r243411
835826         osd_lock_release(m_render_lock);
836827
837828         // ensure the target bounds are up-to-date, and then get the primitives
838         primlist = (*draw.window_get_primitives)(this);
829         primlist = m_renderer->get_primitives();
839830
840831         // post a redraw request with the primitive list as a parameter
841832         last_update_time = timeGetTime();
r243410r243411
12411232   if (!window->m_fullscreen || window->m_fullscreen_safe)
12421233   {
12431234      // finish off by trying to initialize DirectX; if we fail, ignore it
1244      if ((*draw.window_init)(window))
1235      window->m_renderer = draw.create(window);
1236      if (window->m_renderer->init())
12451237         return 1;
12461238      ShowWindow(window->m_hwnd, SW_SHOW);
12471239   }
r243410r243411
14171409
14181410      // destroy: clean up all attached rendering bits and NULL out our hwnd
14191411      case WM_DESTROY:
1420         (*draw.window_destroy)(window);
1412         window->m_renderer->destroy();
1413         global_free(window->m_renderer);
1414         window->m_renderer = NULL;
14211415         window->m_hwnd = NULL;
14221416         return DefWindowProc(wnd, message, wparam, lparam);
14231417
r243410r243411
15011495      // otherwise, render with our drawing system
15021496      else
15031497      {
1504         (*draw.window_draw)(window, dc, update);
1498         window->m_renderer->draw(dc, update);
15051499         mtlog_add("draw_video_contents: drawing finished");
15061500      }
15071501   }
r243410r243411
18711865   window->m_fullscreen = fullscreen;
18721866
18731867   // kill off the drawers
1874   (*draw.window_destroy)(window);
1868   window->m_renderer->destroy();
1869   global_free(window->m_renderer);
1870   window->m_renderer = NULL;
18751871
18761872   // hide ourself
18771873   ShowWindow(window->m_hwnd, SW_HIDE);
r243410r243411
19271923   {
19281924      if (video_config.mode != VIDEO_MODE_NONE)
19291925         ShowWindow(window->m_hwnd, SW_SHOW);
1930      if ((*draw.window_init)(window))
1926      window->m_renderer = draw.create(window);
1927      if (window->m_renderer->init())
19311928         exit(1);
19321929   }
19331930
trunk/src/osd/windows/window.h
r243410r243411
3232//  TYPE DEFINITIONS
3333//============================================================
3434
35class win_window_info;
36
37class osd_renderer
38{
39public:
40
41   /* Generic flags */
42   static const int FLAG_NONE                = 0x0000;
43   static const int FLAG_NEEDS_OPENGL          = 0x0001;
44
45   /* SDL 1.2 flags */
46   static const int FLAG_NEEDS_DOUBLEBUF       = 0x0100;
47   static const int FLAG_NEEDS_ASYNCBLIT       = 0x0200;
48
49   osd_renderer(win_window_info *window, const int flags)
50   : m_window(window), m_flags(flags) { }
51
52   virtual ~osd_renderer() { }
53
54   win_window_info &window() { return *m_window; }
55   int flags() const { return m_flags; }
56   bool check_flag(const int flag) { return ((m_flags & flag)) == flag; }
57
58   virtual int init() = 0;
59   virtual render_primitive_list *get_primitives() = 0;
60   virtual int draw(HDC dc, int update) = 0;
61   virtual void save() = 0;
62   virtual void record() = 0;
63   virtual void toggle_fsfx() = 0;
64   virtual void destroy() = 0;
65
66private:
67   win_window_info *m_window;
68   int m_flags;
69};
70
3571class win_window_info
3672{
3773public:
r243410r243411
77113   int                 m_lastclicky;
78114
79115   // drawing data
80   void *              m_drawdata;
116   osd_renderer *      m_renderer;
81117
82118private:
83119   running_machine &   m_machine;
84120};
85121
86
87struct win_draw_callbacks
122struct osd_draw_callbacks
88123{
124   osd_renderer *(*create)(win_window_info *window);
89125   void (*exit)(void);
90
91   int (*window_init)(win_window_info *window);
92   render_primitive_list *(*window_get_primitives)(win_window_info *window);
93   int (*window_draw)(win_window_info *window, HDC dc, int update);
94   void (*window_save)(win_window_info *window);
95   void (*window_record)(win_window_info *window);
96   void (*window_toggle_fsfx)(win_window_info *window);
97   void (*window_destroy)(win_window_info *window);
98126};
99127
100128
trunk/src/tools/chdman.c
r243410r243411
16981698      astring *size_str = params.find(OPTION_SIZE);
16991699      if (size_str != NULL)
17001700      {
1701         if (sscanf(*size_str, "%"I64FMT"d", &filesize) != 1)
1701         if (sscanf(*size_str, "%" I64FMT"d", &filesize) != 1)
17021702            report_error(1, "Invalid size string");
17031703      }
17041704   }
r243410r243411
25882588         // read the hunk into the buffers
25892589         chd_error err = input_chd.read_hunk(framenum, NULL);
25902590         if (err != CHDERR_NONE)
2591            report_error(1, "Error reading hunk %" I64FMT "d from CHD file (%s): %s\n", framenum, params.find(OPTION_INPUT)->cstr(), chd_file::error_string(err));
2591         {
2592            UINT64 filepos = core_ftell(input_chd);
2593            report_error(1, "Error reading hunk %" I64FMT "d at offset %" I64FMT "d from CHD file (%s): %s\n", framenum, filepos, params.find(OPTION_INPUT)->cstr(), chd_file::error_string(err));
2594         }
25922595
25932596         // write audio
25942597         for (int chnum = 0; chnum < channels; chnum++)


Previous 199869 Revisions Next


© 1997-2024 The MAME Team