Previous 199869 Revisions Next

r34898 Friday 6th February, 2015 at 22:28:52 UTC by Angelo Salese
(Protection) note about Kozure Ookami, for future reference.
[/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]armedf.c 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 c65.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
r243409r243410
281281# uncomment to enable OpenMP optimized code
282282# OPENMP = 1
283283
284# uncomment to compile c++ code as C++11
285# CPP11 = 1
286
287284# specify optimization level or leave commented to use the default
288285# (default is OPTIMIZE = 3 normally, or OPTIMIZE = 0 with symbols)
289286# OPTIMIZE = 3
r243409r243410
528525# we compile C-only to C89 standard with GNU extensions
529526# we compile C++ code to C++98 standard with GNU extensions
530527CONLYFLAGS += -std=gnu89
531ifdef CPP11
532CPPONLYFLAGS += -x c++ -std=gnu++11
533else
534528CPPONLYFLAGS += -x c++ -std=gnu++98
535endif
536529COBJFLAGS += -x objective-c++
537530
538531# this speeds it up a bit by piping between the preprocessor/compiler/assembler
trunk/src/build/flags_clang.mak
r243409r243410
11CCOMFLAGS += \
22   -Wno-cast-align \
3   -Wno-tautological-compare
3   -Wno-tautological-compare \
4   -Wno-format-security
45
56# caused by obj/sdl64d/emu/cpu/tms57002/tms57002.inc
67CCOMFLAGS += -Wno-self-assign-field
78
8# caused by popmessage(NULL) on older clang versions
9#CCOMFLAGS += -Wno-format-security
9# caused by src/mame/video/jagblit.inc on older clang versions
10CCOMFLAGS += -Wno-constant-logical-operand
1011
1112ifneq (,$(findstring undefined,$(SANITIZE)))
1213# TODO: check if linker is clang++
r243409r243410
2021CCOMFLAGS += -fsanitize-memory-track-origins -fPIE
2122endif
2223
23ifdef CPP11
24CCOMFLAGS += -Wno-deprecated-register -Wno-c++11-narrowing
25endif
26
2724# TODO: needs to use $(CC)
2825TEST_CLANG := $(shell clang --version)
2926
3027ifeq ($(findstring 3.4,$(TEST_CLANG)),3.4)
3128CCOMFLAGS += -Wno-inline-new-delete
32
33# caused by src/mame/video/jagblit.inc
34CCOMFLAGS += -Wno-constant-logical-operand
3529endif
3630
3731ifeq ($(findstring 3.5,$(TEST_CLANG)),3.5)
3832CCOMFLAGS += -Wno-inline-new-delete
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
33# caused by src/mess/drivers/x07.c, src/osd/sdl/window.c, src/emu/sound/disc_mth.inc
4134CCOMFLAGS += -Wno-absolute-value
42
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
4339# TODO: add proper detection of XCode 6.0.1
4440# XCode 6.0.1 is built on a pre-release SVN version of clang 3.5, that doesn't support -Wno-absolute-value yet
4541CCOMFLAGS += -Wno-unknown-warning-option
r243409r243410
6056endif
6157endif
6258
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
7059ifeq ($(TARGETOS),emscripten)
7160CCOMFLAGS += -Qunused-arguments
7261endif
trunk/src/build/flags_gcc.mak
r243409r243410
66endif
77
88ifeq ($(findstring 4.8.,$(TEST_GCC)),4.8.)
9   CCOMFLAGS += -Wno-narrowing -Wno-attributes
9   CCOMFLAGS += -Wno-narrowing -Wno-attributes -Wno-unused-local-typedefs
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
15   CCOMFLAGS += -Wno-narrowing -Wno-attributes -Wno-unused-local-typedefs
1616   CCOMFLAGS += -Wno-array-bounds
1717endif
1818
trunk/src/emu/addrmap.h
r243409r243410
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 ATTR_UNUSED; \
309   typedef write##_bits##_delegate write_delegate ATTR_UNUSED; \
308   typedef read##_bits##_delegate read_delegate; \
309   typedef write##_bits##_delegate write_delegate; \
310310   address_map_entry##_bits *curentry = NULL; \
311311   (void)curentry; \
312312   map.configure(_space, _bits); \
313   typedef _class drivdata_class ATTR_UNUSED;
313   typedef _class drivdata_class;
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 ATTR_UNUSED; \
318   typedef write##_bits##_delegate write_delegate ATTR_UNUSED; \
317   typedef read##_bits##_delegate read_delegate; \
318   typedef write##_bits##_delegate write_delegate; \
319319   address_map_entry##_bits *curentry = NULL; \
320320   (void)curentry; \
321321   map.configure(AS_PROGRAM, _bits);  \
322   typedef _class drivdata_class ATTR_UNUSED;
322   typedef _class drivdata_class;
323323#define ADDRESS_MAP_END \
324324}
325325
trunk/src/emu/bus/abckb/abc99.c
r243409r243410
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
r243409r243410
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
r243409r243410
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
r243409r243410
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
r243409r243410
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
r243409r243410
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
r243409r243410
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
r243409r243410
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
r243409r243410
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
r243409r243410
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 )
r243409r243410
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
r243409r243410
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 )
r243409r243410
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
r243409r243410
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);
11981190   void x87_ficom_m16int(UINT8 modrm);
11991191   void x87_ficom_m32int(UINT8 modrm);
12001192   void x87_ficomp_m16int(UINT8 modrm);
r243409r243410
12051197   void x87_fcomp_m32real(UINT8 modrm);
12061198   void x87_fcomp_m64real(UINT8 modrm);
12071199   void x87_fcomp_sti(UINT8 modrm);
1208   void x87_fcomi_sti(UINT8 modrm);
12091200   void x87_fcomip_sti(UINT8 modrm);
1210   void x87_fucomi_sti(UINT8 modrm);
1211   void x87_fucomip_sti(UINT8 modrm);
12121201   void x87_fcompp(UINT8 modrm);
12131202   void x87_fucom_sti(UINT8 modrm);
12141203   void x87_fucomp_sti(UINT8 modrm);
trunk/src/emu/cpu/i386/x87ops.inc
r243409r243410
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
131118INLINE int floatx80_is_zero(floatx80 fx)
132119{
133120   return (((fx.high & 0x7fff) == 0) && ((fx.low << 1) == 0));
r243409r243410
19701957   CYCLES(22);
19711958}
19721959
1973/*************************************
1974*
1975* Conditional Move
1976*
1977*************************************/
19781960
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
21711961/*************************************
21721962 *
21731963 * Miscellaneous arithmetic
r243409r243410
39743764   CYCLES(4);
39753765}
39763766
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
40213767void i386_device::x87_fcomip_sti(UINT8 modrm)
40223768{
40233769   int i = modrm & 7;
r243409r243410
40633809   CYCLES(4); // TODO: correct cycle count
40643810}
40653811
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
41673812void i386_device::x87_fcompp(UINT8 modrm)
41683813{
41693814   if (X87_IS_ST_EMPTY(0) || X87_IS_ST_EMPTY(1))
r243409r243410
48634508      {
48644509         switch (modrm)
48654510         {
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;
4511            case 0xe9: ptr = &i386_device::x87_fucompp;       break;
48714512         }
48724513      }
48734514
r243409r243410
48994540      {
49004541         switch (modrm)
49014542         {
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;
49064543            case 0xe0: ptr = &i386_device::x87_fnop;          break; /* FENI */
49074544            case 0xe1: ptr = &i386_device::x87_fnop;          break; /* FDISI */
49084545            case 0xe2: ptr = &i386_device::x87_fclex;         break;
49094546            case 0xe3: ptr = &i386_device::x87_finit;         break;
49104547            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;
49134548         }
49144549      }
49154550
r243409r243410
50634698         switch (modrm)
50644699         {
50654700            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;
50674701            case 0xf0: case 0xf1: case 0xf2: case 0xf3: case 0xf4: case 0xf5: case 0xf6: case 0xf7: ptr = &i386_device::x87_fcomip_sti;    break;
50684702         }
50694703      }
trunk/src/emu/schedule.c
r243409r243410
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
r243409r243410
9797   return true;
9898}
9999
100// Empty since geometry is determined from the disk image itself
101const flex_format::format flex_format::formats[] = { {} };
102
103100const floppy_format_type FLOPPY_FLEX_FORMAT = &floppy_image_format_creator<flex_format>;
trunk/src/lib/formats/flex_dsk.h
r243409r243410
3737      UINT8 last_sec;
3838      UINT8 unused2[216];
3939   } info;
40   static const format formats[];
4140};
4241
4342extern const floppy_format_type FLOPPY_FLEX_FORMAT;
trunk/src/lib/formats/kaypro_dsk.c
r243409r243410
11// license:BSD-3-Clause
2// copyright-holders:Olivier Galibert, Robbbert
2// copyright-holders:Olivier Galibert
33/*********************************************************************
44
55    formats/kaypro_dsk.c
r243409r243410
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.
1612
1713*********************************************************************/
1814
1915#include "emu.h"
2016#include "formats/kaypro_dsk.h"
2117
22kayproii_format::kayproii_format() : upd765_format(formats)
18kayproii_format::kayproii_format() : wd177x_format(formats)
2319{
2420}
2521
r243409r243410
3531
3632const char *kayproii_format::extensions() const
3733{
38   return "kay";
34   return "dsk";
3935}
4036
37// gap info is a total guess
4138const kayproii_format::format kayproii_format::formats[] = {
4239   {   /*  191K 13cm double density single sided */
4340      floppy_image::FF_525,  floppy_image::SSDD, floppy_image::MFM,
44      2000, 10, 40, 1, 512, {}, 0, {}, 80, 16, 22, 26
41      2000, 10, 40, 1, 512, {}, 1, {}, 32, 22, 31
4542   },
4643   {}
4744};
4845
49kaypro2x_format::kaypro2x_format() : upd765_format(formats)
46kaypro2x_format::kaypro2x_format() : wd177x_format(formats)
5047{
5148}
5249
r243409r243410
6259
6360const char *kaypro2x_format::extensions() const
6461{
65   return "kay";
62   return "dsk";
6663}
6764
65// gap info is a total guess
6866const kaypro2x_format::format kaypro2x_format::formats[] = {
6967   {   /*  382K 13cm double density double sided */
7068      floppy_image::FF_525,  floppy_image::DSDD, floppy_image::MFM,
71      2000, 10, 40, 2, 512, {}, 0, {}, 80, 16, 22, 26
69      2000, 10, 80, 2, 512, {}, 1, {}, 32, 22, 31
7270   },
7371   {}
7472};
trunk/src/lib/formats/kaypro_dsk.h
r243409r243410
99#ifndef KAYPRO_DSK_H_
1010#define KAYPRO_DSK_H_
1111
12#include "upd765_dsk.h"
12#include "wd177x_dsk.h"
1313
14class kayproii_format : public upd765_format {
14class kayproii_format : public wd177x_format {
1515public:
1616   kayproii_format();
1717
r243409r243410
2323   static const format formats[];
2424};
2525
26class kaypro2x_format : public upd765_format {
26class kaypro2x_format : public wd177x_format {
2727public:
2828   kaypro2x_format();
2929
trunk/src/lib/formats/pc98_dsk.c
r243409r243410
5959   },
6060   {   /* 1200K 5 1/4 inch high density */
6161      floppy_image::FF_525, floppy_image::DSHD, floppy_image::MFM,
62      1200, 15, 80, 2, 512, {}, 1, {}, 80, 50, 22, 84
62      1200, 15, 40, 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,
r243409r243410
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, 80, 2, 512, {}, 1, {}, 80, 50, 22, 84
70      1200, 15, 40, 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
r243409r243410
66
77*********************************************************************/
88
9#include "emu.h"
10#include "formats/trd_dsk.h"
9#include <string.h>
1110
12trd_format::trd_format() : wd177x_format(formats)
13{
14}
11#include "trd_dsk.h"
12#include "basicdsk.h"
1513
16const char *trd_format::name() const
14
15static FLOPPY_IDENTIFY(trd_dsk_identify)
1716{
18   return "trd";
17   *vote = 100;
18   return FLOPPY_ERROR_SUCCESS;
1919}
2020
21const char *trd_format::description() const
21static FLOPPY_CONSTRUCT(trd_dsk_construct)
2222{
23   return "TRD floppy disk image";
24}
23   struct basicdsk_geometry geometry;
24   UINT8 data[1];
25   int heads;
26   int cylinders;
2527
26const char *trd_format::extensions() const
27{
28   return "trd";
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);
2941}
3042
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};
3943
40const floppy_format_type FLOPPY_TRD_FORMAT = &floppy_image_format_creator<trd_format>;
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
trunk/src/lib/formats/trd_dsk.h
r243409r243410
99#ifndef TRD_DSK_H
1010#define TRD_DSK_H
1111
12#include "wd177x_dsk.h"
12#include "flopimg.h"
1313
14class trd_format : public wd177x_format {
15public:
16   trd_format();
14/**************************************************************************/
1715
18   virtual const char *name() const;
19   virtual const char *description() const;
20   virtual const char *extensions() const;
16LEGACY_FLOPPY_OPTIONS_EXTERN(trd);
2117
22private:
23   static const format formats[];
24};
25
26extern const floppy_format_type FLOPPY_TRD_FORMAT;
27
2818#endif /* TRD_DSK_H */
trunk/src/mame/drivers/armedf.c
r243409r243410
412412   AM_RANGE(0x061000, 0x063fff) AM_RAM
413413//  AM_RANGE(0x07c000, 0x07c001) AM_WRITE(kozure_io_w)
414414//  AM_RANGE(0x0c0000, 0x0c0001) AM_WRITENOP /* watchdog? */
415//  AM_RANGE(0xffd000, 0xffd001) AM_WRITENOP /* ? */
415//  AM_RANGE(0xffd000, 0xffd001) AM_WRITENOP /* passes crc ROM information to MCU, I guess */
416416   AM_IMPORT_FROM( terraf_map )
417417ADDRESS_MAP_END
418418
trunk/src/mame/drivers/d9final.c
r243409r243410
77    driver by Angelo Salese & David Haywood
88
99    TODO:
10    - Don't know where the ES8712 & RTC62421b chips route;
10    - Don't know where the ES8712 & RTC62421b chips routes;
1111    - A bunch of missing port outputs;
1212    - screen disable? Start-up fading looks horrible;
1313    - Game looks IGS-esque, is there any correlation?
r243409r243410
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"),
3634      m_lo_vram(*this, "lo_vram"),
3735      m_hi_vram(*this, "hi_vram"),
38      m_cram(*this, "cram") { }
36      m_cram(*this, "cram"),
37      m_maincpu(*this, "maincpu"),
38      m_gfxdecode(*this, "gfxdecode") { }
3939
40   required_device<cpu_device> m_maincpu;
41   required_device<gfxdecode_device> m_gfxdecode;
42   
4340   required_shared_ptr<UINT8> m_lo_vram;
4441   required_shared_ptr<UINT8> m_hi_vram;
4542   required_shared_ptr<UINT8> m_cram;
46   
4743   tilemap_t *m_sc0_tilemap;
48   
4944   DECLARE_WRITE8_MEMBER(sc0_lovram);
5045   DECLARE_WRITE8_MEMBER(sc0_hivram);
5146   DECLARE_WRITE8_MEMBER(sc0_cram);
52   DECLARE_WRITE8_MEMBER(bank_w);
47   DECLARE_WRITE8_MEMBER(d9final_bank_w);
5348   DECLARE_READ8_MEMBER(prot_latch_r);
54   
5549   TILE_GET_INFO_MEMBER(get_sc0_tile_info);
56   
57   virtual void machine_start();
50   virtual void machine_reset();
5851   virtual void video_start();
59   
60   UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
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;
6155};
6256
6357
r243409r243410
7872   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);
7973}
8074
81UINT32 d9final_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
75UINT32 d9final_state::screen_update_d9final(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
8276{
8377   m_sc0_tilemap->draw(screen, bitmap, cliprect, 0,0);
8478   return 0;
r243409r243410
10296   m_sc0_tilemap->mark_tile_dirty(offset);
10397}
10498
105WRITE8_MEMBER(d9final_state::bank_w)
99WRITE8_MEMBER(d9final_state::d9final_bank_w)
106100{
107   membank("bank1")->set_entry(data & 0x7);
101   UINT8 *ROM = memregion("maincpu")->base();
102   UINT32 bankaddress;
103
104   bankaddress = 0x10000+(0x4000 * (data & 0x7));
105   membank("bank1")->set_base(&ROM[bankaddress]);
108106}
109107
110108/* game checks this after three attract cycles, otherwise coin inputs stop to work. */
r243409r243410
137135   AM_RANGE(0x40, 0x41) AM_DEVWRITE("ymsnd", ym2413_device, write)
138136   AM_RANGE(0x60, 0x60) AM_READ_PORT("DSWD")
139137   AM_RANGE(0x80, 0x80) AM_READ_PORT("IN0")
140   AM_RANGE(0xa0, 0xa0) AM_READ_PORT("IN1") AM_WRITE(bank_w)
138   AM_RANGE(0xa0, 0xa0) AM_READ_PORT("IN1") AM_WRITE(d9final_bank_w)
141139   AM_RANGE(0xe0, 0xe0) AM_READ_PORT("IN2")
142140ADDRESS_MAP_END
143141
r243409r243410
279277   GFXDECODE_ENTRY( "gfx1", 0, tiles16x8_layout, 0, 16*4 )
280278GFXDECODE_END
281279
282void d9final_state::machine_start()
280void d9final_state::machine_reset()
283281{
284   membank("bank1")->configure_entries(0, 8, memregion("maincpu")->base() + 0x10000, 0x4000);
282   UINT8 *ROM = memregion("maincpu")->base();
283
284   membank("bank1")->set_base(&ROM[0x10000]);
285285}
286286
287287static MACHINE_CONFIG_START( d9final, d9final_state )
r243409r243410
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)
301   MCFG_SCREEN_UPDATE_DRIVER(d9final_state, screen_update_d9final)
302302   MCFG_SCREEN_PALETTE("palette")
303303
304304   MCFG_GFXDECODE_ADD("gfxdecode", "palette", d9final)
r243409r243410
326326
327327
328328
329GAME( 1992, d9final, 0, d9final, d9final, driver_device, 0, ROT0, "Excellent System", "Dream 9 Final (v2.24)", GAME_SUPPORTS_SAVE )
329GAME( 1992, d9final, 0, d9final, d9final, driver_device, 0, ROT0, "Excellent System", "Dream 9 Final (v2.24)", 0 )
trunk/src/mame/drivers/gunsmoke.c
r243409r243410
578578
579579/* Game Drivers */
580580
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
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 )
trunk/src/mame/drivers/megadrvb.c
r243409r243410
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 The Hedgehog 2 (bootleg of Megadrive version)", GAME_NOT_WORKING )
889GAME( 1993, sonic2mb, 0, megadrvb,     aladmdb,  md_boot_state,  aladmdb,  ROT0, "bootleg / Sega",   "Sonic 2 (bootleg of Megadrive version)", GAME_NOT_WORKING )
trunk/src/mame/drivers/naomi.c
r243409r243410
83788378   DISK_REGION( "gdrom" )
83798379   DISK_IMAGE_READONLY( "gds-0026", 0, BAD_DUMP SHA1(253acede106b7fbf49e24458e7fda868720e9549) )
83808380
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) )
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)
83858383ROM_END
83868384
83878385
trunk/src/mame/drivers/peplus.c
r243409r243410
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
50315017ROM_START( peps0092 ) /* Normal board : Wild Cherry Slots (PS0092) - Payout 90.18% */
50325018   ROM_REGION( 0x10000, "maincpu", 0 )
50335019   ROM_LOAD( "ps0092_569-a2c.u68",   0x00000, 0x10000, CRC(d533f6d5) SHA1(9c470f7c474022445aeb45ee8c5757d1b6957a91) ) /* 3 Coins Max / 1 Line */
r243409r243410
92979283GAMEL(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 )
92989284GAMEL(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 )
92999285GAMEL(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 )
93019286GAMEL(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 */
93029287GAMEL(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 )
93039288GAMEL(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
r243409r243410
7979Sega System 16B Hardware Overview
8080---------------------------------
8181
82The games on this system include...
82The games on this system include... (there may be more??) //todo
8383Ace Attacker               (C) Sega/Jaleco, 1989
8484Alien Syndrome             (C) Sega, 1987
8585Altered Beast / Jyuohki    (C) Sega, 1988
r243409r243410
386386-----------------|--------------------------------------------------------------------------------------------------|
387387Shinobi          |A1       A2       A3       A4       A5       A6       A7       A8       A9       A10      A11     |
388388CPU  - 317-0049  |--------------------------------------------------------------------------------------------------|
3898751 - n/a       |EPR11280 EPR11281 -        EPR11282 EPR11283 -        EPR11287 EPR11288 EPR11289 -        -       |
3898751 -           |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     |
r243409r243410
430430-----------------|--------------------------------------------------------------------------------------------------|
431431Sonic Boom       |A1       A2       A3       A4       A5       A6       A7       A8       A9       A10      A11     |
432432CPU  - 317-0053  |--------------------------------------------------------------------------------------------------|
4338751 - n/a       |EPR11340 EPR11341 -        EPR11342 EPR11343 -        EPR11347 EPR11348 EPR11349 -        -       |
4338751 -           |EPR11340 EPR11341 -        EPR11342 EPR11343 -        EPR11347 EPR11348 EPR11349 -        -       |
434434                 |--------------------------------------------------------------------------------------------------|
435435                 |                                                                                                  |
436436                 |B1       B2       B3       B4       B5       B6       B7       B8       B9       B10      B11     |
r243409r243410
441441-----------------|--------------------------------------------------------------------------------------------------|
442442Passing Shot     |A1       A2       A3       A4       A5       A6       A7       A8       A9       A10      A11     |
443443CPU  - 317-0080  |--------------------------------------------------------------------------------------------------|
4448751 - n/a       |EPR11870 -        -        EPR11871 -        -        EPR11857 EPR11858 EPR11859 EPR11860 EPR11861|
4448751 -           |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     |
r243409r243410
452452-----------------|--------------------------------------------------------------------------------------------------|
453453Bullet           |A1       A2       A3       A4       A5       A6       A7       A8       A9       A10      A11     |
454454CPU  - 317-0041  |--------------------------------------------------------------------------------------------------|
4558751 - n/a       |EPR11007 EPR11008 EPR11009 EPR11010 EPR11011 EPR11012 EPR10997 EPR10998 -        -        -       |
4558751 -           |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     |
r243409r243410
463463-----------------|--------------------------------------------------------------------------------------------------|
464464Tetris           |A1       A2       A3       A4       A5       A6       A7       A8       A9       A10      A11     |
465465CPU  - 317-0091  |--------------------------------------------------------------------------------------------------|
4668751 - n/a       |EPR12163 -        -        EPR12164 -        -        EPR12168 -        -        -        -       |
4668751 -           |EPR12163 -        -        EPR12164 -        -        EPR12168 -        -        -        -       |
467467                 |--------------------------------------------------------------------------------------------------|
468468                 |                                                                                                  |
469469                 |B1       B2       B3       B4       B5       B6       B7       B8       B9       B10      B11     |
r243409r243410
474474-----------------|--------------------------------------------------------------------------------------------------|
475475Wonder Boy III   |A1       A2       A3       A4       A5       A6       A7       A8       A9       A10      A11     |
476476CPU  - 317-0085  |--------------------------------------------------------------------------------------------------|
4778751 - n/a       |EPR12198 EPR12199 -        EPR12100 EPR12101 -        EPR12127 -        -        -        -       |
4778751 -           |EPR12198 EPR12199 -        EPR12100 EPR12101 -        EPR12127 -        -        -        -       |
478478                 |--------------------------------------------------------------------------------------------------|
479479                 |                                                                                                  |
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|
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|
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                 |                                                                                                  |
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|
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|
494494-----------------|--------------------------------------------------------------------------------------------------|
495                  J6 jumper tied from lower left side of 256 jumper to upper right side of 512 jumper like this: /
495
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                 |                                                                                                  |
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|
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|
505505-----------------|--------------------------------------------------------------------------------------------------|
506506
507507-----------------|--------------------------------------------------------------------------------------------------|
r243409r243410
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
595  S1-S16 - Jumpers to configure ROM sizes               //usage TODO
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
r243409r243410
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
717  S1-S18 - Jumpers to configure ROM sizes                                               //usage TODO
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
r243409r243410
737737-----------------|--------------------------------------------------------------------------------------------------------------------------------------|
738738Golden Axe       |A1       A2       A3       A4       A5       A6       A7       A8       A10      A11      A12               A14      A15      A16     |
739739CPU  - 317-0121  |--------------------------------------------------------------------------------------------------------------------------------------|
7408751 - n/a       |-        -        -        -        EPR12539 EPR12519 EPR12540 EPR12521 EPR12390 MPR12384 -                 EPR12385 EPR12386 EPR12387|
7408751 -           |-        -        -        -        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     |
r243409r243410
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     |
r243409r243410
858858-----------------|--------------------------------------------------------------------------------------------------------------------------------------|
859859Tetris           |A1       A2       A3       A4       A5       A6       A7       A8       A10      A11      A12               A14      A15      A16     |
860860CPU  - 317-0092  |--------------------------------------------------------------------------------------------------------------------------------------|
8618751 - n/a       |-        -        -        -        EPR12192 -        EPR12193 -        EPR12168 -        -                 EPR12165 EPR12166 EPR12167|
8618751 -           |-        -        -        -        EPR12192 -        EPR12193 -        EPR12168 -        -                 EPR12165 EPR12166 EPR12167|
862862                 |--------------------------------------------------------------------------------------------------------------------------------------|
863863                 |                                                                                                                                      |
864864                 |B1       B2       B3       B4       B5       B6       B7       B8       B10      B11      B12      B13      B14      B15      B16     |
865S2 S3 S6 S7 S9   |--------------------------------------------------------------------------------------------------------------------------------------|
866S11 S13 S15 S17  |EPR12194 -        -        -        EPR12195 -        -        -        -        -        -        -        -        -        -       |
865                 |--------------------------------------------------------------------------------------------------------------------------------------|
866                 |EPR      -        -        -        EPR      -        -        -        -        -        -        -        -        -        -       |
867867-----------------|--------------------------------------------------------------------------------------------------------------------------------------|
868                  Sega part number for B1 & B5 unknown
868869
869870***************************************************************************/
870871
r243409r243410
36453646   ROM_LOAD( "opr-11673.a12", 0x30000, 0x20000, CRC(400c4a36) SHA1(de4bdfa91734410e0a7f6a16bf8336db172f458a) )
36463647
36473648   ROM_REGION( 0x1000, "mcu", 0 )  // Intel i8751 protection MCU
3648   ROM_LOAD( "317-0078.c2", 0x00000, 0x1000, NO_DUMP )
3649   ROM_LOAD( "317-0078.mcu", 0x00000, 0x1000, NO_DUMP )
36493650ROM_END
36503651
36513652//*************************************************************************************************************************
r243409r243410
36883689   ROM_LOAD( "opr-11673.a12", 0x30000, 0x20000, CRC(400c4a36) SHA1(de4bdfa91734410e0a7f6a16bf8336db172f458a) )
36893690
36903691   ROM_REGION( 0x1000, "mcu", 0 )  // Intel i8751 protection MCU
3691   ROM_LOAD( "317-0077.c2", 0x00000, 0x1000, NO_DUMP )
3692   ROM_LOAD( "317-0077.mcu", 0x00000, 0x1000, NO_DUMP )
36923693ROM_END
36933694
36943695//*************************************************************************************************************************
r243409r243410
37313732   ROM_LOAD( "opr-11673.a12", 0x30000, 0x20000, CRC(400c4a36) SHA1(de4bdfa91734410e0a7f6a16bf8336db172f458a) )
37323733
37333734   ROM_REGION( 0x1000, "mcu", 0 )  // Intel i8751 protection MCU
3734   ROM_LOAD( "317-0076.c2", 0x00000, 0x1000, NO_DUMP )
3735   ROM_LOAD( "317-0076.mcu", 0x00000, 0x1000, NO_DUMP )
37353736ROM_END
37363737
37373738//*************************************************************************************************************************
r243409r243410
46944695   ROM_REGION( 0x10000, "soundcpu", 0 ) // sound CPU
46954696   ROM_LOAD( "epr-11916.a10", 0x0000, 0x8000, CRC(7ab541cf) SHA1(feb88022ca1796d020e53e95ad345159bd415530) )
46964697
4697   ROM_REGION( 0x1000, "mcu", 0 )  // Intel i8751 protection MCU
4698   ROM_LOAD( "317-0095.c2", 0x00000, 0x1000, NO_DUMP )
4698   ROM_REGION( 0x1000, "mcu", 0 )  // protection MCU
4699   ROM_LOAD( "317-0095.bin", 0x00000, 0x1000, NO_DUMP )
46994700ROM_END
47004701
47014702
r243409r243410
48534854   ROM_LOAD16_BYTE( "epr-12680.a3", 0x180001, 0x20000, CRC(f321452c) SHA1(cdccd8facc2941745f05fba25ad7d76b445eb873) )
48544855   ROM_LOAD16_BYTE( "epr-12699.b12",0x180000, 0x20000, CRC(ac329586) SHA1(98994f41ee2f0fa5cd800f565b277ba21f2bb0c3) )
48554856
4857
48564858   ROM_REGION( 0x90000, "soundcpu", 0 ) // sound CPU
48574859   ROM_LOAD( "epr-12685.a10", 0x00000, 0x08000, CRC(5d0c16d7) SHA1(7ab13376c2a1da0566689ccbc258f94d1f4de487) )
48584860   ROM_LOAD( "mpr-12686.a11", 0x10000, 0x20000, CRC(f451705e) SHA1(2b3d1b3ffbc6ba2285c4141e6fd3447252a31c8b) )
r243409r243410
48694871//
48704872ROM_START( exctleag )
48714873   ROM_REGION( 0x60000, "maincpu", 0 ) // 68000 code
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) )
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) )
48784880
48794881   ROM_REGION( 0x2000, "maincpu:key", 0 ) // decryption key
48804882   ROM_LOAD( "317-0079.key", 0x0000, 0x2000, CRC(effefa1c) SHA1(f42e87f60c9589862ea2c05a29b1b15dc7194051) )
r243409r243410
48854887   ROM_LOAD( "epr-11944.b11", 0x20000, 0x10000, CRC(a75cae80) SHA1(17c148a33b09b5403e68f5d96e506545c2ced206) )
48864888
48874889   ROM_REGION16_BE( 0x80000, "sprites", 0 ) // sprites
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) )
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) )
48964898
48974899   ROM_REGION( 0x50000, "soundcpu", 0 ) // sound CPU
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) )
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) )
49014903   ROM_LOAD( "epr-11142.a10", 0x30000, 0x8000, CRC(25d26c66) SHA1(2485afb859f84a9cc90b2091e9ae4eef263f42b3) )
49024904   ROM_LOAD( "epr-11143.a11", 0x40000, 0x8000, CRC(848b7b77) SHA1(8903a39f8f0ffb4ce32117d33282876196516c30) )
49034905ROM_END
r243409r243410
50395041   ROM_LOAD( "epr-12390.ic8", 0x00000, 0x08000, CRC(399fc5f5) SHA1(6f290b36dc71ff4759598e2a9c185a8945a3c9e7) )
50405042   ROM_LOAD( "mpr-12384.ic6", 0x10000, 0x20000, CRC(6218d8e7) SHA1(5a745c750efb4a61716f99befb7ed14cc84e9973) )
50415043
5042   ROM_REGION( 0x1000, "mcu", 0 )  // Intel i8751 protection MCU
5043   ROM_LOAD( "317-0123a.c2", 0x00000, 0x1000, NO_DUMP )
5044   ROM_REGION( 0x1000, "mcu", 0 )  // protection MCU
5045   ROM_LOAD( "317-0123a.bin", 0x00000, 0x1000, NO_DUMP )
50445046ROM_END
50455047
50465048//*************************************************************************************************************************
r243409r243410
51995201   ROM_LOAD( "epr-12390.a10", 0x00000, 0x08000, CRC(399fc5f5) SHA1(6f290b36dc71ff4759598e2a9c185a8945a3c9e7) )
52005202   ROM_LOAD( "mpr-12384.a11", 0x10000, 0x20000, CRC(6218d8e7) SHA1(5a745c750efb4a61716f99befb7ed14cc84e9973) )
52015203
5202   ROM_REGION( 0x1000, "mcu", 0 )  // Intel i8751 protection MCU
5203   ROM_LOAD( "317-0112.c2", 0x00000, 0x1000, NO_DUMP )
5204   ROM_REGION( 0x1000, "mcu", 0 )  // protection MCU
5205   ROM_LOAD( "317-0112.bin", 0x00000, 0x1000, NO_DUMP )
52045206ROM_END
52055207
52065208//*************************************************************************************************************************
r243409r243410
60146016//
60156017ROM_START( suprleag )
60166018   ROM_REGION( 0x60000, "maincpu", 0 ) // 68000 code
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) )
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) )
60236025
60246026   ROM_REGION( 0x2000, "maincpu:key", 0 ) // decryption key
60256027   ROM_LOAD( "317-0045.key", 0x0000, 0x2000, CRC(0594cc2e) SHA1(8aec3fffd00cbfd50d7cfb92e4748e2653fbb504) )
60266028
60276029   ROM_REGION( 0x30000, "gfx1", 0 ) // tiles
6028   ROM_LOAD( "epr-11136.b9", 0x00000, 0x10000, CRC(c3860ce4) SHA1(af7618f3b5a0e8d6374877c7815ba69fff218a45) )
6030   ROM_LOAD( "epr-11136.b09", 0x00000, 0x10000, CRC(c3860ce4) SHA1(af7618f3b5a0e8d6374877c7815ba69fff218a45) )
60296031   ROM_LOAD( "epr-11137.b10", 0x10000, 0x10000, CRC(92d96187) SHA1(45138795992b9842d5b0c86a96b300445bf12060) )
60306032   ROM_LOAD( "epr-11138.b11", 0x20000, 0x10000, CRC(c01dc773) SHA1(b27da906186e1272cdd6f8d5e5a979f6623255ac) )
60316033
60326034   ROM_REGION16_BE( 0x80000, "sprites", 0 ) // sprites
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) )
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) )
60416043
60426044   ROM_REGION( 0x50000, "soundcpu", 0 ) // sound CPU
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) )
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) )
60466048   ROM_LOAD( "epr-11142.a10", 0x30000, 0x08000, CRC(25d26c66) SHA1(2485afb859f84a9cc90b2091e9ae4eef263f42b3) )
60476049   ROM_LOAD( "epr-11143.a11", 0x40000, 0x08000, CRC(848b7b77) SHA1(8903a39f8f0ffb4ce32117d33282876196516c30) )
60486050ROM_END
r243409r243410
62206222   ROM_LOAD( "opr-12329.a11", 0x10000, 0x10000, CRC(ed9a686d) SHA1(da433033d501ee871429ee676b3972b14179df9f) )     // speech
62216223   ROM_LOAD( "opr-12330.a12", 0x20000, 0x10000, CRC(fb762bca) SHA1(ff9191c5ec38c711ebb7c2ad043f62b6d7e2203c) )
62226224
6223   ROM_REGION( 0x1000, "mcu", 0 )  // Intel i8751 protection MCU
6224   ROM_LOAD( "317-0104.c2", 0x00000, 0x1000, NO_DUMP )
6225   ROM_REGION( 0x1000, "mcu", 0 )  // protection MCU
6226   ROM_LOAD( "317-0104.bin", 0x00000, 0x1000, NO_DUMP )
62256227ROM_END
62266228
62276229//*************************************************************************************************************************
r243409r243410
62326234//
62336235ROM_START( tturfu )
62346236   ROM_REGION( 0x40000, "maincpu", 0 ) // 68000 code
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) )
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) )
62396241
62406242   ROM_REGION( 0x30000, "gfx1", 0 ) // tiles
62416243   ROM_LOAD( "epr-12268.a14", 0x00000, 0x10000, CRC(e0dac07f) SHA1(c7f6de42eb93a8f34afdc300628735b5f40a34c2) )
r243409r243410
62596261   ROM_LOAD( "epr-12274.a10", 0x30000, 0x8000, CRC(8207f0c4) SHA1(169914861a52fa731a305e1ee2d230aa0d0d97fe) )
62606262   ROM_LOAD( "epr-12275.a11", 0x40000, 0x8000, CRC(182f3c3d) SHA1(1482fe08a05a721e315b1a3aa5bef4dddc72e26e) )
62616263
6262   ROM_REGION( 0x1000, "mcu", 0 )  // Intel i8751 protection MCU
6263   ROM_LOAD( "317-0099.c2", 0x00000, 0x1000, CRC(f676e3e4) SHA1(b71bad46c8b5f7328fd8d48f18624a620f0d34ce) )
6264   ROM_REGION( 0x1000, "mcu", 0 )  // protection MCU
6265   ROM_LOAD( "317-0099.bin", 0x00000, 0x1000, CRC(f676e3e4) SHA1(b71bad46c8b5f7328fd8d48f18624a620f0d34ce) )
62646266ROM_END
62656267
62666268
r243409r243410
62946296   ROM_REGION( 0x10000, "soundcpu", 0 ) // sound CPU
62956297   ROM_LOAD( "epr-12127.a10", 0x0000, 0x8000, CRC(0bb901bb) SHA1(c81b198df8e3b0ec568032c76addf0d1a1711194) )
62966298
6297   ROM_REGION( 0x1000, "mcu", 0 )  // Intel i8751 protection MCU
6298   ROM_LOAD( "317-0098.c2", 0x00000, 0x1000, NO_DUMP )
6299   ROM_REGION( 0x1000, "mcu", 0 )  // protection MCU
6300   ROM_LOAD( "317-0098.bin", 0x00000, 0x1000, NO_DUMP )
62996301ROM_END
63006302
63016303
r243409r243410
63846386ROM_START( wb32 )
63856387   ROM_REGION( 0x40000, "maincpu", 0 ) // 68000 code
63866388   ROM_LOAD16_BYTE( "epr-12098.a1", 0x000001, 0x10000, CRC(d998e5e5) SHA1(a7398b7338a33451a650c2f1d382dad2e5130528) )
6387   ROM_LOAD16_BYTE( "epr-12100.a4", 0x000000, 0x10000, CRC(f5ca4abc) SHA1(1331db10cf99905fb13c1606a3f4d8bbf3d681b6) )
6389   ROM_LOAD16_BYTE( "epr-12100.a6", 0x000000, 0x10000, CRC(f5ca4abc) SHA1(1331db10cf99905fb13c1606a3f4d8bbf3d681b6) )
63886390   ROM_LOAD16_BYTE( "epr-12099.a2", 0x020001, 0x10000, CRC(3e243b45) SHA1(2a079553d1b61aaf18025847570003b79c8d6edf) )
63896391   ROM_LOAD16_BYTE( "epr-12101.a5", 0x020000, 0x10000, CRC(6146492b) SHA1(93515578a6ccf770944fea86d2f3200fa08f5075) )
63906392
r243409r243410
64686470   ROM_LOAD( "mpr-12148.a11", 0x10000, 0x20000, CRC(fb9a7f29) SHA1(7ba79c18ab4e586be2deccd78e4479d55eb75a7e) )
64696471   ROM_LOAD( "mpr-12149.a12", 0x30000, 0x20000, CRC(d6617b19) SHA1(aa36d257eaa52c8c871a39aaa2f29c203525dbaf) )
64706472
6471   ROM_REGION( 0x1000, "mcu", 0 )  // Intel i8751 protection MCU
6472   ROM_LOAD( "317-0103.c2", 0x00000, 0x1000, CRC(aa0710f5) SHA1(61ba8d23d045806b0a7b75184766be00f872cc72) )
6473   ROM_REGION( 0x1000, "mcu", 0 )  // protection MCU
6474   ROM_LOAD( "317-0103.bin", 0x00000, 0x1000, CRC(aa0710f5) SHA1(61ba8d23d045806b0a7b75184766be00f872cc72) )
64736475ROM_END
64746476
64756477//*************************************************************************************************************************
r243409r243410
65636565//  Sega operated this game on actual System 16 PCBs for various events,
65646566//  it was also included in the PS2 Sega Ages collection Vol 33.
65656567//  Various bootlegs were sourced from this version. The dump will have to
6566//  be verified if the official PCB ever gets into MAME-friendly hands.
6568//  be verified if the official PCB ever gets into MAME friendly hands.
65676569//
65686570//  There is also a demo version of the game available on the PC, but
65696571//  attempting to use those ROMs on a real PCB / emulator will result
trunk/src/mame/drivers/sidearms.c
r243409r243410
768768   ROM_LOAD( "63s081.3j",    0x0300, 0x0020, CRC(c5817816) SHA1(cc642daafa0bcb160ee04e74e2d168fd44087608) )    // unknown
769769ROM_END
770770
771ROM_START( sidearmsu )
771ROM_START( sidearmsr )
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 */
818773   ROM_LOAD( "03",           0x00000, 0x08000, CRC(9a799c45) SHA1(cf6836108506929ee2449546a4867a7cbf00bcc8) )        /* CODE */
819774   ROM_LOAD( "a_14e.rom",    0x10000, 0x08000, CRC(4925ed03) SHA1(b11dbd9889db89cff008ca21beb6b1b70d983e16) )        /* 0+1 */
820775   ROM_LOAD( "a_12e.rom",    0x18000, 0x08000, CRC(81d0ece7) SHA1(5c1d154f9c1de6b5f5d7abf5d413e9c493461e6f) )        /* 2+3 */
r243409r243410
11511106   m_gameid = 3;
11521107}
11531108
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 )
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 )
11621113GAME( 1988, turtshipj,turtship, turtship, turtship, sidearms_state, turtship, ROT0,   "Philko (Pacific Games license)", "Turtle Ship (Japan)", 0 )
1163GAME( 1988, turtshipk,turtship, turtship, turtship, sidearms_state, turtship, ROT0,   "Philko",                         "Turtle Ship (Korea)", 0 )
1164
1114GAME( 1988, turtshipk,turtship, turtship, turtship, sidearms_state, turtship, ROT0,   "Philko", "Turtle Ship (Korea)", 0 )
11651115GAME( 1989, dyger,    0,        turtship, dyger, sidearms_state,    dyger,    ROT270, "Philko", "Dyger (Korea set 1)", 0 )
11661116GAME( 1989, dygera,   dyger,    turtship, dyger, sidearms_state,    dyger,    ROT270, "Philko", "Dyger (Korea set 2)", 0 )
1167
11681117GAME( 1989, twinfalc, 0,        whizz,    whizz, sidearms_state,    whizz,    ROT0,   "Philko (Poara Enterprises license)", "Twin Falcons", 0 )
1169GAME( 1989, whizz,    twinfalc, whizz,    whizz, sidearms_state,    whizz,    ROT0,   "Philko",                             "Whizz", 0 )
1118GAME( 1989, whizz,    twinfalc, whizz,    whizz, sidearms_state,    whizz,    ROT0,   "Philko", "Whizz", 0 )
trunk/src/mame/drivers/silvmil.c
r243409r243410
287287   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_COIN2 )
288288   PORT_BIT( 0xfc00, IP_ACTIVE_LOW, IPT_UNKNOWN )
289289
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")
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")
305321   PORT_DIPSETTING(      0x1000, DEF_STR( 4C_1C ) )
306322   PORT_DIPSETTING(      0x1400, DEF_STR( 3C_1C ) )
307323   PORT_DIPSETTING(      0x0000, DEF_STR( 4C_2C ) ) /* Works the same as 2C/1C */
r243409r243410
310326   PORT_DIPSETTING(      0x0800, DEF_STR( 2C_2C ) ) /* Works the same as 1C/1C */
311327   PORT_DIPSETTING(      0x1c00, DEF_STR( 1C_1C ) )
312328   PORT_DIPSETTING(      0x0c00, DEF_STR( 1C_2C ) )
313   PORT_DIPNAME( 0x2000, 0x2000, "Coin Box" )      PORT_DIPLOCATION("SW2:6") /* Always displays total credits - No separate Credit display per player */
329   PORT_DIPNAME( 0x2000, 0x2000, "Coin Box" )      PORT_DIPLOCATION("SW1:6") /* Always displays total credits - No separate Credit display per player */
314330   PORT_DIPSETTING(      0x2000, "1" ) /* Both players use coins from either Coin 1 or Coin 2 */
315331   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 */
316   PORT_DIPNAME( 0x4000, 0x4000, DEF_STR( Lives ) )      PORT_DIPLOCATION("SW2:7")
332   PORT_DIPNAME( 0x4000, 0x4000, DEF_STR( Lives ) )      PORT_DIPLOCATION("SW1:7")
317333   PORT_DIPSETTING(      0x0000, "2" )
318334   PORT_DIPSETTING(      0x4000, "3" )
319   PORT_SERVICE_DIPLOC(  0x8000, IP_ACTIVE_LOW, "SW2:8" ) /* Verified */
335   PORT_SERVICE_DIPLOC(  0x8000, IP_ACTIVE_LOW, "SW1:8" ) /* Verified */
320336INPUT_PORTS_END
321337
322338
trunk/src/mame/drivers/toki.c
r243409r243410
4242#include "sound/3812intf.h"
4343#include "includes/toki.h"
4444
45WRITE16_MEMBER(toki_state::tokib_soundcommand_w)
45WRITE16_MEMBER(toki_state::tokib_soundcommand16_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::pip_r)
51READ16_MEMBER(toki_state::pip16_r)
5252{
5353   return ~0;
5454}
5555
5656
5757
58WRITE_LINE_MEMBER(toki_state::tokib_adpcm_int)
58WRITE_LINE_MEMBER(toki_state::toki_adpcm_int)
5959{
6060   m_msm->data_w(m_msm5205next);
6161   m_msm5205next >>= 4;
r243409r243410
6565      m_audiocpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE);
6666}
6767
68WRITE8_MEMBER(toki_state::tokib_adpcm_control_w)
68WRITE8_MEMBER(toki_state::toki_adpcm_control_w)
6969{
7070   int bankaddress;
7171   UINT8 *RAM = memregion("audiocpu")->base();
r243409r243410
7878   m_msm->reset_w(data & 0x08);
7979}
8080
81WRITE8_MEMBER(toki_state::tokib_adpcm_data_w)
81WRITE8_MEMBER(toki_state::toki_adpcm_data_w)
8282{
8383   m_msm5205next = data;
8484}
r243409r243410
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_soundcommand_w)
117   AM_RANGE(0x075000, 0x075001) AM_WRITE(tokib_soundcommand16_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(pip_r)  /* sound related, if we return 0 the code writes */
122   AM_RANGE(0x0c000e, 0x0c000f) AM_READ(pip16_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
r243409r243410
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(tokib_adpcm_control_w) /* MSM5205 + ROM bank */
133   AM_RANGE(0xe400, 0xe400) AM_WRITE(tokib_adpcm_data_w)
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)
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)
r243409r243410
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, tokib_adpcm_int)) /* interrupt function */
466   MCFG_MSM5205_VCLK_CB(WRITELINE(toki_state, toki_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
r243409r243410
4141   tilemap_t *m_foreground_layer;
4242   tilemap_t *m_text_layer;
4343
44   DECLARE_WRITE16_MEMBER(tokib_soundcommand_w);
45   DECLARE_READ16_MEMBER(pip_r);
44   DECLARE_WRITE16_MEMBER(tokib_soundcommand16_w);
45   DECLARE_READ16_MEMBER(pip16_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(tokib_adpcm_control_w);
51   DECLARE_WRITE8_MEMBER(tokib_adpcm_data_w);
52   DECLARE_WRITE_LINE_MEMBER(tokib_adpcm_int);
50   DECLARE_WRITE8_MEMBER(toki_adpcm_control_w);
51   DECLARE_WRITE8_MEMBER(toki_adpcm_data_w);
52   DECLARE_WRITE_LINE_MEMBER(toki_adpcm_int);
5353
5454   DECLARE_DRIVER_INIT(tokib);
5555   DECLARE_DRIVER_INIT(jujuba);
trunk/src/mame/machine/315-5838_317-0229_comp.c
r243409r243410
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
r243409r243410
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
r243409r243410
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
r243409r243410
30223022lwingsj         // 11/1986 (c) 1986
30233023lwingsb         // 11/1986 (c) 1986 (bootleg)
30243024sidearms        // 12/1986 (c) 1986 (World)
3025sidearmsu       // 12/1986 (c) 1986 + Romstar license (US)
3026sidearmsur1     // 12/1986 (c) 1986 + Romstar license (US)
3025sidearmsr       // 12/1986 (c) 1986 + Romstar license (US)
30273026sidearmsj       // 12/1986 (c) 1986 (Japan)
30283027turtship        // (c) 1988 Philco (NOT A CAPCOM GAME but runs on modified Sidearms hardware)
30293028turtshipj       // (c) 1988 Philco (NOT A CAPCOM GAME but runs on modified Sidearms hardware)
r243409r243410
1121211211peps0043        // (c) 1996 IGT - International Game Technology
1121311212peps0045        // (c) 1996 IGT - International Game Technology
1121411213peps0047        // (c) 1996 IGT - International Game Technology
11215peps0090        // (c) 1996 IGT - International Game Technology
1121611214peps0092        // (c) 1996 IGT - International Game Technology
1121711215peps0206        // (c) 1996 IGT - International Game Technology
1121811216peps0207        // (c) 1996 IGT - International Game Technology
trunk/src/mess/drivers/atm.c
r243409r243410
141141   if (m_beta->started())
142142   {
143143      m_beta->enable();
144      m_beta->clear_status();
144145   }
145146   space.set_direct_update_handler(direct_update_delegate(FUNC(atm_state::atm_direct), this));
146147
trunk/src/mess/drivers/c65.c
r243409r243410
400400
401401WRITE8_MEMBER(c65_state::cia0_portb_w)
402402{
403
403404}
404405
405406READ8_MEMBER(c65_state::dummy_r)
r243409r243410
418419   AM_RANGE(0x0d300, 0x0d3ff) AM_RAM_WRITE(PalBlue_w) AM_SHARE("bluepal") // 0x0d300, 0x0d3ff Blue Palette
419420   // 0x0d400, 0x0d4*f Right SID
420421   // 0x0d440, 0x0d4*f Left  SID
421   // 0x0d600, 0x0d6** UART
422   AM_RANGE(0x0d600, 0x0d6ff) AM_RAM // 0x0d600, 0x0d6** UART
422423   AM_RANGE(0x0d700, 0x0d702) AM_WRITE(DMAgic_w) AM_SHARE("dmalist") // 0x0d700, 0x0d7** DMAgic
423424   //AM_RANGE(0x0d703, 0x0d703) AM_READ(DMAgic_r)
424425   // 0x0d800, 0x0d8** Color matrix
trunk/src/mess/drivers/hx20.c
r243409r243410
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
r243409r243410
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
r243409r243410
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    ToDo:
12    Things that need doing:
1313
1414    - See about getting keyboard to work as a serial device.
1515    - Need dump of 87C51 cpu in the keyboard.
1616
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
17    - Only kayproii boots up, the remainder have floppy-disk problems.
2118
19    - The DSK format needs to be supported. It is commented out until the code gets written.
20
2221    - Hard Disk not emulated.
2322      The controller is a WD1002 (original version, for Winchester drives).
2423
r243409r243410
163162
164163************************************************************/
165164
166FLOPPY_FORMATS_MEMBER( kaypro_state::kayproii_floppy_formats )
167   FLOPPY_KAYPROII_FORMAT
168FLOPPY_FORMATS_END
165//FLOPPY_FORMATS_MEMBER( kaypro_state::kayproii_floppy_formats )
166//  FLOPPY_KAYPROII_FORMAT
167//FLOPPY_FORMATS_END
169168
170FLOPPY_FORMATS_MEMBER( kaypro_state::kaypro2x_floppy_formats )
171   FLOPPY_KAYPRO2X_FORMAT
172FLOPPY_FORMATS_END
169//FLOPPY_FORMATS_MEMBER( kaypro_state::kaypro2x_floppy_formats )
170//  FLOPPY_KAYPRO2X_FORMAT
171//FLOPPY_FORMATS_END
173172
174173static SLOT_INTERFACE_START( kaypro_floppies )
175   SLOT_INTERFACE( "drive0", FLOPPY_525_DD )
176   SLOT_INTERFACE( "drive1", FLOPPY_525_DD )
174   SLOT_INTERFACE( "525dd", FLOPPY_525_DD )
177175SLOT_INTERFACE_END
178176
179177
r243409r243410
182180   MCFG_CPU_ADD("maincpu", Z80, XTAL_20MHz / 8)
183181   MCFG_CPU_PROGRAM_MAP(kaypro_map)
184182   MCFG_CPU_IO_MAP(kayproii_io)
185   MCFG_CPU_VBLANK_INT_DRIVER("screen", kaypro_state, kay_kbd_interrupt)  /* this doesn't actually exist, it is to run the keyboard */
183   MCFG_CPU_VBLANK_INT_DRIVER("screen", kaypro_state, kay_kbd_interrupt)  /* this doesn't actually exist, it is to run the keyboard */
186184   MCFG_CPU_CONFIG(kayproii_daisy_chain)
187185
188186   MCFG_MACHINE_START_OVERRIDE(kaypro_state, kayproii )
r243409r243410
232230   MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(kaypro_state, fdc_intrq_w))
233231   MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(kaypro_state, fdc_drq_w))
234232   MCFG_WD_FDC_FORCE_READY
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)
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)
237237   MCFG_SOFTWARE_LIST_ADD("flop_list","kayproii")
238238MACHINE_CONFIG_END
239239
r243409r243410
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 )
r243409r243410
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")
r243409r243410
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, "drive0", kaypro_state::kaypro2x_floppy_formats)
299   MCFG_FLOPPY_DRIVE_ADD("fdc:1", kaypro_floppies, "drive1", kaypro_state::kaypro2x_floppy_formats)
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)
300302MACHINE_CONFIG_END
301303
302304static MACHINE_CONFIG_DERIVED( omni2, kaypro4 )
r243409r243410
429431
430432/*    YEAR  NAME      PARENT    COMPAT  MACHINE   INPUT    CLASS         INIT         COMPANY                 FULLNAME */
431433COMP( 1982, kayproii,   0,        0,    kayproii, kay_kbd, kaypro_state, kaypro, "Non Linear Systems",  "Kaypro II - 2/83" , 0 )
432COMP( 1983, kaypro4,    kayproii, 0,    kaypro4,  kay_kbd, kaypro_state, kaypro, "Non Linear Systems",  "Kaypro 4 - 4/83" , 0 ) // model 81-004
434COMP( 1983, kaypro4,    kayproii, 0,    kaypro4,  kay_kbd, kaypro_state, kaypro, "Non Linear Systems",  "Kaypro 4 - 4/83" , GAME_NOT_WORKING ) // model 81-004
433435COMP( 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
434COMP( 198?, omni2,      kayproii, 0,    omni2,    kay_kbd, kaypro_state, kaypro, "Non Linear Systems",  "Omni II Logic Analyzer" , 0 )
436COMP( 198?, omni2,      kayproii, 0,    omni2,    kay_kbd, kaypro_state, kaypro, "Non Linear Systems",  "Omni II" , GAME_NOT_WORKING )
435437COMP( 1984, kaypro2x,   0,        0,    kaypro2x, kay_kbd, kaypro_state, kaypro, "Non Linear Systems",  "Kaypro 2x" , GAME_NOT_WORKING ) // model 81-025
436438COMP( 1984, kaypro4a,   kaypro2x, 0,    kaypro2x, kay_kbd, kaypro_state, kaypro, "Non Linear Systems",  "Kaypro 4 - 4/84" , GAME_NOT_WORKING ) // model 81-015
437439// Kaypro 4/84 plus 88 goes here, model 81-015 with an added 8088 daughterboard and rom
trunk/src/mess/drivers/pc9801.c
r243409r243410
1313    - Finish DIP-Switches support
1414    - text scrolling
1515    - GRCG+
16    - EGC
1617    - rewrite using slot devices
1718    - some later SWs put "Invalid command byte 05" (Absolutely Mahjong on Epson logo)
1819    - investigate on POR bit
r243409r243410
7778    - Armored Flagship Atragon: needs HDD install
7879    - Arquephos: needs extra sound board(s)?
7980    - Asoko no Koufuku: black screen with BGM, waits at 0x225f6;
81    - Aura Battler Dumbine: upd7220: unimplemented FIGD, has layer clearance bugs on gameplay;
8082    - Band-Kun: (how to run this without installing?)
8183    - Battle Chess: wants some dip-switches to be on in DSW4, too slow during IA thinking?
8284    - Bishoujo Audition: Moans with a "(program) ended. remove the floppy disk and turn off the poewr."
r243409r243410
104106    - Uchiyama Aki no Chou Bangai: keyboard irq is fussy (sometimes it doesn't register a key press);
105107    - Uno: uses EGC
106108    - Viper V16 Demo: moans with a JP message;
107    - Windows 2: EGC drawing issue (byte wide writes?)
108109
109110    per-game TODO (PC-9821):
110111    - Battle Skin Panic: gfx bugs at the Gainax logo, it crashes after it;
r243409r243410
114115    - Animahjong V3 makes advantage of the possibility of installing 2 sound boards, where SFX and BGMs are played on separate chips.
115116    - Apple Club 1/2 needs data disks to load properly;
116117    - Beast Lord: needs a titan.fnt, in MS-DOS
117    - To deprotect BASIC modules set 0xcd7 in ram to 0
118118
119119========================================================================================
120120
r243409r243410
550550      INT16 count;
551551      UINT16 leftover[4];
552552      bool first;
553      bool init;
554553   } m_egc;
555554
556555   /* PC9821 specific */
r243409r243410
589588   DECLARE_WRITE16_MEMBER(upd7220_grcg_w);
590589   void egc_blit_w(UINT32 offset, UINT16 data, UINT16 mem_mask);
591590   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);
r243409r243410
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);
675673public:
676674   DECLARE_MACHINE_START(pc9801_common);
677675   DECLARE_MACHINE_START(pc9801f);
r243409r243410
13321330   m_video_ram_2[(offset>>1)+0x04000+m_vram_bank*0x10000] = (ram & (0xff00 >> mask)) | (data << mask);
13331331}
13341332
1335UINT16 pc9801_state::egc_shift(int plane, UINT16 val)
1333inline UINT16 pc9801_state::egc_do_partial_op(int plane, UINT16 src, UINT16 pat, UINT16 dst)
13361334{
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;
1335   UINT16 out = 0;
1336   int src_off, dst_off;
1337   UINT16 src_tmp = src;
1338
13401339   if(m_egc.regs[6] & 0x1000)
13411340   {
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      }
1341      src_off = 15 - (m_egc.regs[6] & 0xf);
1342      dst_off = 15 - ((m_egc.regs[6] >> 4) & 0xf);
13521343   }
13531344   else
13541345   {
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      }
1346      src_off = m_egc.regs[6] & 0xf;
1347      dst_off = (m_egc.regs[6] >> 4) & 0xf;
13651348   }
1366   return out;
1367}
13681349
1369UINT16 pc9801_state::egc_do_partial_op(int plane, UINT16 src, UINT16 pat, UINT16 dst)
1370{
1371   UINT16 out = 0;
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   }
13721362
13731363   for(int i = 7; i >= 0; i--)
13741364   {
r243409r243410
13851375{
13861376   UINT16 mask = m_egc.regs[4] & mem_mask, out = 0;
13871377   bool dir = !(m_egc.regs[6] & 0x1000);
1388   int dst_off = (m_egc.regs[6] >> 4) & 0xf, src_off = m_egc.regs[6] & 0xf;
1378   int dst_off = (m_egc.regs[6] >> 4) & 0xf;
13891379   offset &= 0x13fff;
13901380
1391   if(!m_egc.init && (src_off > dst_off))
1381   if((((m_egc.regs[2] >> 11) & 3) == 1) || ((((m_egc.regs[2] >> 11) & 3) == 2) && !BIT(m_egc.regs[2], 10)))
13921382   {
1393      if(BIT(m_egc.regs[2], 10))
1383      UINT16 end_mask = 0xffff, start_mask = 0xffff;
1384      // mask off the bits before the start
1385      if(m_egc.first)
13941386      {
13951387         m_egc.leftover[0] = m_egc.leftover[1] = m_egc.leftover[2] = m_egc.leftover[3] = 0;
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];
1388         start_mask = dir ? ~((1 << dst_off) - 1) : ((1 << (15 - dst_off)) - 1);
13991389      }
1400      m_egc.init = true;
1401      return;
1402   }
14031390
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)
1391      // mask off the bits past the end of the blit
1392      if(m_egc.count < 16)
14181393      {
1419         if(dir)
1420            end_mask <<= dst_off;
1421         else
1422            end_mask >>= dst_off;
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         }
14231403      }
1424      mask &= end_mask;
1404      mask &= end_mask & start_mask;
14251405   }
14261406
14271407   for(int i = 0; i < 4; i++)
r243409r243410
14301410      {
14311411         UINT16 src = m_egc.src[i] & mem_mask, pat = m_egc.pat[i];
14321412         if(BIT(m_egc.regs[2], 10))
1433            src = egc_shift(i, data);
1413            src = data;
14341414
14351415         if((m_egc.regs[2] & 0x300) == 0x200)
14361416            pat = m_video_ram_2[offset + (((i + 1) & 3) * 0x4000)];
r243409r243410
14621442   }
14631443   if(mem_mask != 0xffff)
14641444   {
1445      dst_off &= 7;
14651446      if(m_egc.first)
1466         m_egc.count -= 8 - (dst_off & 7);
1447         m_egc.count -= dir ? 8 - dst_off : (dst_off + 1);
14671448      else
14681449         m_egc.count -= 8;
14691450   }
14701451   else
14711452   {
14721453      if(m_egc.first)
1473         m_egc.count -= 16 - dst_off;
1454         m_egc.count -= dir ? 16 - dst_off : (dst_off + 1);
14741455      else
14751456         m_egc.count -= 16;
14761457   }
r243409r243410
14801461   if(m_egc.count <= 0)
14811462   {
14821463      m_egc.first = true;
1483      m_egc.init = false;
14841464      m_egc.count = (m_egc.regs[7] & 0xfff) + 1;
14851465   }
14861466}
r243409r243410
14951475      m_egc.pat[2] = m_video_ram_2[plane_off + (0x4000 * 3)];
14961476      m_egc.pat[3] = m_video_ram_2[plane_off];
14971477   }
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
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   }
15011485   if(BIT(m_egc.regs[2], 13))
15021486      return m_video_ram_2[offset];
15031487   else
1504      return m_egc.src[(m_egc.regs[1] >> 8) & 3];
1488      return m_video_ram_2[plane_off + (((m_egc.regs[1] >> 8) + 1) & 3) * 0x4000];
15051489}
15061490
15071491READ16_MEMBER(pc9801_state::upd7220_grcg_r)
r243409r243410
19221906      case 7:
19231907         m_egc.count = (m_egc.regs[7] & 0xfff) + 1;
19241908         m_egc.first = true;
1925         m_egc.init = false;
19261909         break;
19271910   }
19281911}
r243409r243410
29862969   save_item(NAME(m_sasi_data));
29872970   save_item(NAME(m_sasi_data_enable));
29882971   save_item(NAME(m_sasi_ctrl));
2989   save_item(NAME(m_vrtc_irq_mask));
29902972}
29912973
29922974MACHINE_START_MEMBER(pc9801_state,pc9801f)
trunk/src/mess/drivers/pentagon.c
r243409r243410
186186   {
187187      if (strcmp(machine().system().name, "pent1024")==0)
188188         m_beta->enable();
189      m_beta->clear_status();
189190   }
190191   space.set_direct_update_handler(direct_update_delegate(FUNC(pentagon_state::pentagon_direct), this));
191192
trunk/src/mess/drivers/pt68k4.c
r243409r243410
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)
r243409r243410
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
r243409r243410
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();
339340   space.set_direct_update_handler(direct_update_delegate(FUNC(scorpion_state::scorpion_direct), this));
340341
341342   memset(messram,0,256*1024);
trunk/src/mess/drivers/ti74.c
r243409r243410
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
r243409r243410
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)")
r243409r243410
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")
r243409r243410
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")
r243409r243410
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")
r243409r243410
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")
r243409r243410
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
r243409r243410
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
r243409r243410
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
r243409r243410
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
r243409r243410
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
r243409r243410
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")
r243409r243410
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")
r243409r243410
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("+/-")
r243409r243410
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
r243409r243410
2121   };
2222
2323   kaypro_state(const machine_config &mconfig, device_type type, const char *tag)
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")
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")
3737   {}
3838
3939   DECLARE_WRITE_LINE_MEMBER(write_centronics_busy);
r243409r243410
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);
6869   DECLARE_READ8_MEMBER(kaypro_sio_r);
6970   DECLARE_WRITE8_MEMBER(kaypro_sio_w);
7071   MC6845_UPDATE_ROW(kaypro2x_update_row);
r243409r243410
7778   UINT8 *m_p_videoram;
7879   kay_kbd_t *m_kbd;
7980   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
8285private:
83   bool m_is_motor_off;
84   UINT8 m_fdc_rq;
8586   UINT8 m_system_port;
8687   UINT16 m_mc6845_video_address;
8788   floppy_image_device *m_floppy;
8889   void mc6845_cursor_configure();
8990   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;
r243409r243410
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;
102104};
103105
104106
trunk/src/mess/machine/apollo.c
r243409r243410
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
r243409r243410
1414
1515*/
1616#include "emu.h"
17#include "imagedev/flopdrv.h"
1718#include "formats/trd_dsk.h"
1819#include "machine/beta.h"
1920
r243409r243410
2627const device_type BETA_DISK = &device_creator<beta_disk_device>;
2728
2829beta_disk_device::beta_disk_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
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")
30   : device_t(mconfig, BETA_DISK, "Beta Disk Interface", tag, owner, clock, "betadisk", __FILE__),
31   m_betadisk_status(0),
32   m_betadisk_active(0)
3633{
3734}
3835
r243409r243410
4239
4340void beta_disk_device::device_start()
4441{
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);
4550}
4651
4752//-------------------------------------------------
r243409r243410
6772   m_betadisk_active = 0;
6873}
6974
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
7096READ8_MEMBER(beta_disk_device::status_r)
7197{
7298   if (m_betadisk_active==1) {
73      return m_wd179x->status_r(space, 0);
99      return m_wd179x->status_r(space, offset);
74100   } else {
75101      return 0xff;
76102   }
r243409r243410
79105READ8_MEMBER(beta_disk_device::track_r)
80106{
81107   if (m_betadisk_active==1) {
82      return m_wd179x->track_r(space, 0);
108      return m_wd179x->track_r(space, offset);
83109   } else {
84110      return 0xff;
85111   }
r243409r243410
88114READ8_MEMBER(beta_disk_device::sector_r)
89115{
90116   if (m_betadisk_active==1) {
91      return m_wd179x->sector_r(space, 0);
117      return m_wd179x->sector_r(space, offset);
92118   } else {
93119      return 0xff;
94120   }
r243409r243410
97123READ8_MEMBER(beta_disk_device::data_r)
98124{
99125   if (m_betadisk_active==1) {
100      return m_wd179x->data_r(space, 0);
126      return m_wd179x->data_r(space, offset);
101127   } else {
102128      return 0xff;
103129   }
r243409r243410
106132READ8_MEMBER(beta_disk_device::state_r)
107133{
108134   if (m_betadisk_active==1) {
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;
135      return m_betadisk_status;
113136   } else {
114137      return 0xff;
115138   }
r243409r243410
117140
118141WRITE8_MEMBER(beta_disk_device::param_w)
119142{
143   const char *floppy_tags[4] = { FLOPPY_0, FLOPPY_1, FLOPPY_2, FLOPPY_3 };
144
120145   if (m_betadisk_active == 1)
121146   {
122      floppy_connector* connectors[] = { m_floppy0, m_floppy1, m_floppy2, m_floppy3 };
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();
123152
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      }
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);
141158   }
142159}
143160
144161WRITE8_MEMBER(beta_disk_device::command_w)
145162{
146163   if (m_betadisk_active==1) {
147      m_wd179x->cmd_w(space, 0, data);
164      m_wd179x->command_w(space, offset, data);
148165   }
149166}
150167
151168WRITE8_MEMBER(beta_disk_device::track_w)
152169{
153170   if (m_betadisk_active==1) {
154      m_wd179x->track_w(space, 0, data);
171      m_wd179x->track_w(space, offset, data);
155172   }
156173}
157174
158175WRITE8_MEMBER(beta_disk_device::sector_w)
159176{
160177   if (m_betadisk_active==1) {
161      m_wd179x->sector_w(space, 0, data);
178      m_wd179x->sector_w(space, offset, data);
162179   }
163180}
164181
165182WRITE8_MEMBER(beta_disk_device::data_w)
166183{
167184   if (m_betadisk_active==1) {
168      m_wd179x->data_w(space, 0, data);
185      m_wd179x->data_w(space, offset, data);
169186   }
170187}
171188
172FLOPPY_FORMATS_MEMBER(beta_disk_device::floppy_formats)
173   FLOPPY_TRD_FORMAT
174FLOPPY_FORMATS_END
189static const floppy_interface beta_floppy_interface =
190{
191   FLOPPY_STANDARD_5_25_DSDD,
192   LEGACY_FLOPPY_OPTIONS_NAME(trd),
193   NULL
194};
175195
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
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))
182201
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)
202   MCFG_LEGACY_FLOPPY_4_DRIVES_ADD(beta_floppy_interface)
189203MACHINE_CONFIG_END
190204
191205ROM_START( beta_disk )
trunk/src/mess/machine/beta.h
r243409r243410
1010#ifndef __BETA_H__
1111#define __BETA_H__
1212
13#include "machine/wd_fdc.h"
13#include "machine/wd17xx.h"
1414
1515
1616#define BETA_DISK_TAG   "beta"
r243409r243410
3232   DECLARE_WRITE8_MEMBER(track_w);
3333   DECLARE_WRITE8_MEMBER(sector_w);
3434   DECLARE_WRITE8_MEMBER(data_w);
35   DECLARE_FLOPPY_FORMATS(floppy_formats);
3635
36   DECLARE_WRITE_LINE_MEMBER(wd179x_intrq_w);
37   DECLARE_WRITE_LINE_MEMBER(wd179x_drq_w);
38
3739   int is_active();
3840   void enable();
3941   void disable();
42   void clear_status();
4043
44   UINT8 m_betadisk_status;
4145   UINT8 m_betadisk_active;
4246
4347protected:
r243409r243410
4852   virtual machine_config_constructor device_mconfig_additions() const;
4953
5054private:
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;
55   // internal state
56   wd2793_device *m_wd179x;
5657};
5758
5859extern const device_type BETA_DISK;
trunk/src/mess/machine/kaypro.c
r243409r243410
1313
1414************************************************************/
1515
16WRITE_LINE_MEMBER(kaypro_state::kaypro_interrupt)
17{
18   m_maincpu->set_input_line(0, state);
19}
20
1621WRITE_LINE_MEMBER( kaypro_state::write_centronics_busy )
1722{
1823   m_centronics_busy = state;
r243409r243410
4348
4449   membank("bankr0")->set_entry(BIT(data, 7));
4550   membank("bank3")->set_entry(BIT(data, 7));
46   m_is_motor_off = BIT(data, 6);
4751
4852   m_floppy = NULL;
4953   if (BIT(data, 0))
r243409r243410
5862   if (m_floppy)
5963   {
6064      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
6265   }
6366
6467   output_set_value("ledA", BIT(data, 0));     /* LEDs in artwork */
r243409r243410
104107
105108   membank("bankr0")->set_entry(BIT(data, 7));
106109   membank("bank3")->set_entry(BIT(data, 7));
107   m_is_motor_off = !BIT(data, 4);
108110
109111   m_floppy = NULL;
110112   if (!BIT(data, 0))
r243409r243410
114116      m_floppy = m_floppy1->get_device();
115117
116118   m_fdc->set_floppy(m_floppy);
117   m_fdc->dden_w(BIT(data, 5));
119   //m_fdc->dden_w(BIT(data, 5)); // not connected
118120
119121   if (m_floppy)
120122   {
r243409r243410
193195
194196void kaypro_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
195197{
196   bool halt;
197198   switch (id)
198199   {
199200   case TIMER_FLOPPY:
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      {
201      if (m_maincpu->state_int(Z80_HALT))
208202         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
219203      break;
220204   default:
221205      assert_always(FALSE, "Unknown id in kaypro_state::device_timer");
r243409r243410
224208
225209WRITE_LINE_MEMBER( kaypro_state::fdc_intrq_w )
226210{
227   m_fdc_rq = (m_fdc_rq & 0x82) | state;
211   if (state)
212      timer_set(attotime::zero, TIMER_FLOPPY);
213   else
214      m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE);
228215}
229216
230217WRITE_LINE_MEMBER( kaypro_state::fdc_drq_w )
231218{
232   m_fdc_rq = (m_fdc_rq & 0x81) | (state << 1);
219   if (state)
220      timer_set(attotime::zero, TIMER_FLOPPY);
221   else
222      m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE);
223
233224}
234225
235226
r243409r243410
250241   membank("bankw0")->set_entry(0); // always write to ram
251242   membank("bank3")->set_entry(1); // point at video ram
252243   m_system_port = 0x80;
253   m_fdc_rq = 0;
254244   m_maincpu->reset();
255   timer_set(attotime::from_hz(1), TIMER_FLOPPY);   /* kick-start the nmi timer */
256245}
257246
258247
trunk/src/mess/machine/pc1512kb.c
r243409r243410
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
r243409r243410
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
r243409r243410
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
r243409r243410
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
r243409r243410
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
r243409r243410
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
r243409r243410
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
r243409r243410
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
r243409r243410
279279   SDL_SysWMinfo wminfo;
280280   SDL_VERSION(&wminfo.version);
281281#if (SDLMAME_SDL2)
282   SDL_GetWindowWMInfo(sdl_window_list->sdl_window(), &wminfo);
282   SDL_GetWindowWMInfo(sdl_window_list->m_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
r243409r243410
118118
119119private:
120120    Uint32              m_sdl_access;
121    SDL_Renderer *      m_sdl_renderer;
121    SDL_Renderer *      m_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
r243409r243410
143143{
144144public:
145145    sdl_info13(sdl_window_info *w)
146    : osd_renderer(w, FLAG_NONE), m_blittimer(0), m_sdl_renderer(NULL),
146    : osd_renderer(w), m_blittimer(0), m_renderer(NULL),
147147      m_last_hofs(0), m_last_vofs(0),
148      m_last_width(0), m_last_height(0),
148      m_resize_pending(0), m_resize_width(0), m_resize_height(0),
149149      m_last_blit_time(0), m_last_blit_pixels(0)
150150    {}
151151
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);
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);
155157   /* virtual */ void destroy_all_textures();
156158   /* virtual */ void destroy();
157159   /* virtual */ void clear();
r243409r243410
162164    texture_info *texture_update(const render_primitive &prim);
163165
164166   INT32           m_blittimer;
167   UINT32          m_extra_flags;
165168
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;
169   SDL_Renderer *  m_renderer;
174170   simple_list<texture_info>  m_texlist;                // list of active textures
175171
176172   float           m_last_hofs;
177173   float           m_last_vofs;
178174
179   int            m_last_width;
180   int            m_last_height;
175   // resize information
181176
177   UINT8           m_resize_pending;
178   UINT32          m_resize_width;
179   UINT32          m_resize_height;
180
182181   // Stats
183182   INT64           m_last_blit_time;
184183   INT64           m_last_blit_pixels;
184
185   // Original display_mode
186   SDL_DisplayMode m_original_mode;
185187};
186188
187189struct copy_info_t {
r243409r243410
200202   copy_info_t           *next;
201203};
202204
203
204205//============================================================
205206//  PROTOTYPES
206207//============================================================
r243409r243410
385386
386387   SDL_SetTextureBlendMode(m_texture_id, m_sdl_blendmode);
387388   set_coloralphamode(m_texture_id, &prim->color);
388   SDL_RenderCopy(m_sdl_renderer,  m_texture_id, NULL, &target_rect);
389   SDL_RenderCopy(m_renderer,  m_texture_id, NULL, &target_rect);
389390}
390391
391392void sdl_info13::render_quad(texture_info *texture, const render_primitive *prim, const int x, const int y)
r243409r243410
419420      UINT32 sb = (UINT32)(255.0f * prim->color.b);
420421      UINT32 sa = (UINT32)(255.0f * prim->color.a);
421422
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);
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);
425426   }
426427}
427428
r243409r243410
453454}
454455
455456//============================================================
456//  drawsdl_init
457//  drawsdl2_init
457458//============================================================
458459
459460static void add_list(copy_info_t **head, copy_info_t *element, Uint32 bm)
r243409r243410
517518   else
518519      osd_printf_verbose("Loaded opengl shared library: %s\n", stemp ? stemp : "<default>");
519520
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
520534   return 0;
521535}
522536
523537
524538//============================================================
525//  drawsdl_exit
539//  drawsdl2_exit
526540//============================================================
527541
528542static void drawsdl2_exit(void)
r243409r243410
572586// a
573587//============================================================
574588
575int sdl_info13::create()
589int sdl_info13::create(int width, int height)
576590{
577#if (SDLMAME_SDL2)
578   // create renderer
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    */
579597
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)
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 )
585613   {
586      SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "1");
614      osd_printf_error("Window creation failed: %s\n", SDL_GetError());
615      return 1;
587616   }
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   }
588638   else
589639   {
590      SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "0");
640      //SDL_SetWindowDisplayMode(window().m_sdl_window, NULL); // Use desktop
591641   }
642   // create renderer
592643
593644   if (video_config.waitvsync)
594      m_sdl_renderer = SDL_CreateRenderer(window().sdl_window(), -1, SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_ACCELERATED);
645      m_renderer = SDL_CreateRenderer(window().m_sdl_window, -1, SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_ACCELERATED);
595646   else
596      m_sdl_renderer = SDL_CreateRenderer(window().sdl_window(), -1, SDL_RENDERER_ACCELERATED);
647      m_renderer = SDL_CreateRenderer(window().m_sdl_window, -1, SDL_RENDERER_ACCELERATED);
597648
598   if (!m_sdl_renderer)
649   if (!m_renderer)
599650   {
600651      fatalerror("Error on creating renderer: %s\n", SDL_GetError());
601652   }
602653
603654   //SDL_SelectRenderer(window().sdl_window);
604655
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
605664   m_blittimer = 3;
606665
607   SDL_RenderPresent(m_sdl_renderer);
666   SDL_RenderPresent(m_renderer);
608667   osd_printf_verbose("Leave sdl_info13::create\n");
609
610#else
611
612#endif
613668   return 0;
614669}
615670
616
617671//============================================================
618//  sdl_info::destroy
672//  sdl_info::resize
619673//============================================================
620674
621void sdl_info13::destroy()
675void sdl_info13::resize(int width, int height)
622676{
623   destroy_all_textures();
624}
677   m_resize_pending = 1;
678   m_resize_height = height;
679   m_resize_width = width;
625680
626//============================================================
627//  sdl_info::clear
628//============================================================
681   window().m_width = width;
682   window().m_height = height;
629683
630void sdl_info13::clear()
631{
632   m_blittimer = 2;
684   m_blittimer = 3;
685
633686}
634687
635
636688//============================================================
637689//  drawsdl_xy_to_render_target
638690//============================================================
r243409r243410
642694
643695   *xt = x - m_last_hofs;
644696   *yt = y - m_last_vofs;
645   if (*xt<0 || *xt >= window().blitwidth())
697   if (*xt<0 || *xt >= window().m_blitwidth)
646698      return 0;
647   if (*yt<0 || *yt >= window().blitheight())
699   if (*yt<0 || *yt >= window().m_blitheight)
648700      return 0;
649701   return 1;
650702}
651703
652704//============================================================
653//  drawsdl_destroy_all_textures
705//  sdl_info::get_primitives
654706//============================================================
655707
656void sdl_info13::destroy_all_textures()
708void sdl_info13::set_target_bounds()
657709{
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();
710   window().m_target->set_bounds(window().m_blitwidth, window().m_blitheight, window().monitor()->aspect());
666711}
667712
668713//============================================================
r243409r243410
681726      return 0;
682727   }
683728
684   if ((window().width() != m_last_width) || (window().height() != m_last_height))
729   if (m_resize_pending)
685730   {
686      m_last_width = window().width();
687      m_last_height = window().height();
688      SDL_RenderSetViewport(m_sdl_renderer, NULL);
689      m_blittimer = 3;
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
690737   }
738
691739   //SDL_SelectRenderer(window().sdl_window);
692740
693741   if (m_blittimer > 0)
694742   {
695743      /* SDL Underlays need alpha = 0 ! */
696      SDL_SetRenderDrawBlendMode(m_sdl_renderer, SDL_BLENDMODE_NONE);
744      SDL_SetRenderDrawBlendMode(m_renderer, SDL_BLENDMODE_NONE);
697745      //SDL_SetRenderDrawColor(0,0,0,255);
698      SDL_SetRenderDrawColor(m_sdl_renderer, 0,0,0,0);
699      SDL_RenderFillRect(m_sdl_renderer, NULL);
746      SDL_SetRenderDrawColor(m_renderer, 0,0,0,0);
747      SDL_RenderFillRect(m_renderer, NULL);
700748      m_blittimer--;
701749   }
702750
r243409r243410
714762      }
715763      else
716764      {
717         ch = window().height();
718         cw = window().width();
765         ch = window().m_height;
766         cw = window().m_width;
719767      }
720768
721769      if (video_config.centerv)
722770      {
723         vofs = (ch - window().blitheight()) / 2.0f;
771         vofs = (ch - window().m_blitheight) / 2.0f;
724772      }
725773      if (video_config.centerh)
726774      {
727         hofs = (cw - window().blitwidth()) / 2.0f;
775         hofs = (cw - window().m_blitwidth) / 2.0f;
728776      }
729777   }
730778
r243409r243410
746794            sb = (int)(255.0f * prim->color.b);
747795            sa = (int)(255.0f * prim->color.a);
748796
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,
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,
752800                  prim->bounds.x1 + hofs, prim->bounds.y1 + vofs);
753801            break;
754802         case render_primitive::QUAD:
r243409r243410
768816
769817   m_last_blit_pixels = blit_pixels;
770818   m_last_blit_time = -osd_ticks();
771   SDL_RenderPresent(m_sdl_renderer);
819   SDL_RenderPresent(m_renderer);
772820   m_last_blit_time += osd_ticks();
773821
774822   return 0;
r243409r243410
776824
777825
778826//============================================================
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//============================================================
779858//  texture handling
780859//============================================================
781860
r243409r243410
794873      if ((m_is_rotated == bi->blitter->m_is_rot)
795874            && (m_sdl_blendmode == bi->bm_mask))
796875      {
797         if (RendererSupportsFormat(m_sdl_renderer, bi->dst_fmt, m_sdl_access, bi->dstname))
876         if (RendererSupportsFormat(m_renderer, bi->dst_fmt, m_sdl_access, bi->dstname))
798877         {
799878            int perf = bi->perf;
800879            if (perf == 0)
r243409r243410
814893   {
815894      if ((m_is_rotated == bi->blitter->m_is_rot)
816895         && (m_sdl_blendmode == bi->bm_mask))
817         if (RendererSupportsFormat(m_sdl_renderer, bi->dst_fmt, m_sdl_access, bi->dstname))
896         if (RendererSupportsFormat(m_renderer, bi->dst_fmt, m_sdl_access, bi->dstname))
818897            return bi;
819898   }
820899   //FIXME: crash implement a -do nothing handler */
r243409r243410
852931texture_info::texture_info(SDL_Renderer *renderer, const render_texinfo &texsource, const quad_setup_data &setup, UINT32 flags)
853932{
854933   // fill in the core data
855   m_sdl_renderer = renderer;
934   m_renderer = renderer;
856935   m_hash = texture_compute_hash(texsource, flags);
857936   m_flags = flags;
858937   m_texinfo = texsource;
r243409r243410
901980
902981   m_copyinfo = compute_size_type();
903982
904   m_texture_id = SDL_CreateTexture(m_sdl_renderer, m_copyinfo->dst_fmt, m_sdl_access,
983   m_texture_id = SDL_CreateTexture(m_renderer, m_copyinfo->dst_fmt, m_sdl_access,
905984         m_setup.rotwidth, m_setup.rotheight);
906985
907986   if (!m_texture_id)
r243409r243410
10741153   // if we didn't find one, create a new texture
10751154   if (texture == NULL && prim.texture.base != NULL)
10761155   {
1077      texture = global_alloc(texture_info(m_sdl_renderer, prim.texture, setup, prim.flags));
1156      texture = global_alloc(texture_info(m_renderer, prim.texture, setup, prim.flags));
10781157      /* add us to the texture list */
10791158      m_texlist.prepend(*texture);
10801159
r243409r243410
10931172   return texture;
10941173}
10951174
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
r243409r243410
7474{
7575public:
7676    sdl_info_bgfx(sdl_window_info *w)
77    : osd_renderer(w, FLAG_NONE), m_blittimer(0), m_renderer(NULL),
77    : osd_renderer(w), 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),
7980      m_last_blit_time(0), m_last_blit_pixels(0)
8081    {}
8182
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);
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);
8588   /* virtual */ void destroy_all_textures();
8689   /* virtual */ void destroy();
8790   /* virtual */ void clear();
r243409r243410
99102   float           m_last_hofs;
100103   float           m_last_vofs;
101104
105   // resize information
106
107   UINT8           m_resize_pending;
108   UINT32          m_resize_width;
109   UINT32          m_resize_height;
110
102111   // Stats
103112   INT64           m_last_blit_time;
104113   INT64           m_last_blit_pixels;
r243409r243410
134143//  sdl_info_bgfx::create
135144//============================================================
136145
137int sdl_info_bgfx::create()
146int sdl_info_bgfx::create(int width, int height)
138147{
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   }
139192   // create renderer
140193
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
141211   m_blittimer = 3;
142212
143   bgfx::sdlSetWindow(window().sdl_window());
213   SDL_RenderPresent(m_renderer);
214   
215   bgfx::sdlSetWindow(window().m_sdl_window);
144216   bgfx::init();
145   bgfx::reset(window().width(), window().height(), BGFX_RESET_VSYNC);
217   bgfx::reset(window().m_width, window().m_height, BGFX_RESET_VSYNC);
146218   
147219   // Enable debug text.
148220   bgfx::setDebug(BGFX_DEBUG_STATS);// BGFX_DEBUG_TEXT);
r243409r243410
151223}
152224
153225//============================================================
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//============================================================
154242//  drawsdl_xy_to_render_target
155243//============================================================
156244
r243409r243410
158246{
159247   *xt = x - m_last_hofs;
160248   *yt = y - m_last_vofs;
161   if (*xt<0 || *xt >= window().blitwidth())
249   if (*xt<0 || *xt >= window().m_blitwidth)
162250      return 0;
163   if (*yt<0 || *yt >= window().blitheight())
251   if (*yt<0 || *yt >= window().m_blitheight)
164252      return 0;
165253   return 1;
166254}
167255
168256//============================================================
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//============================================================
169266//  sdl_info_bgfx::draw
170267//============================================================
171268
r243409r243410
178275      , 0
179276      );
180277   // Set view 0 default viewport.
181   bgfx::setViewRect(0, 0, 0, window().blitwidth(), window().blitheight());
278   bgfx::setViewRect(0, 0, 0, window().m_blitwidth, window().m_blitheight);
182279
183280   // This dummy draw call is here to make sure that view 0 is cleared
184281   // if no other draw calls are submitted to view 0.
r243409r243410
211308
212309   destroy_all_textures();
213310
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   
214320   // Shutdown bgfx.
215321   bgfx::shutdown();
216322}
trunk/src/osd/sdl/drawogl.c
r243409r243410
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 width, GLsizei height);
61typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEEXTPROC) (GLenum m_target, GLenum internalformat, GLsizei m_width, GLsizei m_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
r243409r243410
156156//  TYPES
157157//============================================================
158158
159//============================================================
160//  Textures
161//============================================================
159struct texture_info;
162160
163161/* texture_info holds information about a texture */
164class texture_info
162struct texture_info
165163{
166public:
167164   texture_info()
168   :    hash(0), flags(0), rawwidth(0), rawheight(0),
165   : hash(0), flags(0), rawwidth(0), rawheight(0),
169166      rawwidth_create(0), rawheight_create(0),
170167      type(0), format(0), borderpix(0), xprescale(0), yprescale(0), nocopy(0),
171168      texture(0), texTarget(0), texpow2(0), mpass_dest_idx(0), pbo(0), data(NULL),
r243409r243410
222219{
223220public:
224221   sdl_info_ogl(sdl_window_info *window)
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),
222   : osd_renderer(window), m_blittimer(0), m_extra_flags(0),
228223#if (SDLMAME_SDL2)
229224      m_gl_context_id(0),
230225#else
226      m_sdlsurf(NULL),
231227#endif
232228      m_initialized(0),
233229      m_last_blendmode(0),
r243409r243410
252248         m_texVerticex[i] = 0.0f;
253249   }
254250
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);
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);
258256   /* virtual */ void destroy_all_textures();
259257   /* virtual */ void destroy();
260258   /* virtual */ void clear();
r243409r243410
278276   void texture_all_disable();
279277
280278   INT32           m_blittimer;
281   int             m_screen_width;
282   int             m_screen_height;
283   int            m_last_width;
284   int            m_last_height;
279   UINT32          m_extra_flags;
285280
281
286282#if (SDLMAME_SDL2)
283   // Original display_mode
284   SDL_DisplayMode m_original_mode;
285
287286   SDL_GLContext   m_gl_context_id;
288287#else
288   // SDL surface
289   SDL_Surface         *m_sdlsurf;
289290#endif
290291
291292   int             m_initialized;        // is everything well initialized, i.e. all GL stuff etc.
r243409r243410
392393
393394// core functions
394395
395//============================================================
396//  STATIC VARIABLES
397//============================================================
398
399396static void drawogl_exit(void);
400397static void load_gl_lib(running_machine &machine);
401398
r243409r243410
443440static int dll_loaded = 0;
444441
445442//============================================================
446//  drawsdl_init
443//  drawogl_init
447444//============================================================
448445
449446static osd_renderer *drawogl_create(sdl_window_info *window)
r243409r243410
459456
460457   dll_loaded = 0;
461458
462   load_gl_lib(machine);
463459   if (SDLMAME_SDL2)
464460   {
465461      osd_printf_verbose("Using SDL multi-window OpenGL driver (SDL 2.0+)\n");
462      load_gl_lib(machine);
466463   }
467464   else
468465      osd_printf_verbose("Using SDL single-window OpenGL driver (SDL 1.2)\n");
r243409r243410
711708// a
712709//============================================================
713710
714int sdl_info_ogl::create()
711int sdl_info_ogl::create(int width, int height)
715712{
713#if (SDLMAME_SDL2)
716714
717#if (SDLMAME_SDL2)
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   }
718774   // create renderer
719775
720   m_gl_context_id = SDL_GL_CreateContext(window().sdl_window());
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);
721788   if  (!m_gl_context_id)
722789   {
723790      osd_printf_error("OpenGL not supported on this driver: %s\n", SDL_GetError());
r243409r243410
727794   SDL_GL_SetSwapInterval(video_config.waitvsync ? 2 : 0);
728795
729796#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
730829#endif
731830
732   m_screen_width = 0;
733   m_screen_height = 0;
734
735831   m_blittimer = 0;
736832   m_surf_w = 0;
737833   m_surf_h = 0;
r243409r243410
756852   return 0;
757853}
758854
759
760855//============================================================
761//  sdl_info::destroy
856//  sdl_info::resize
762857//============================================================
763858
764void sdl_info_ogl::destroy()
859void sdl_info_ogl::resize(int width, int height)
765860{
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);
766868
767   // free the memory in the window
869   m_sdlsurf = SDL_SetVideoMode(width, height, 0,
870         SDL_SWSURFACE | SDL_ANYFORMAT | m_extra_flags);
768871
769   destroy_all_textures();
770
771#if (SDLMAME_SDL2)
772   SDL_GL_DeleteContext(m_gl_context_id);
872   window().m_width = m_sdlsurf->w;
873   window().m_height = m_sdlsurf->h;
773874#endif
875   m_init_context = 1;
774876
775877}
776878
777879//============================================================
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//============================================================
788880//  drawsdl_xy_to_render_target
789881//============================================================
790882
791883int sdl_info_ogl::xy_to_render_target(int x, int y, int *xt, int *yt)
792884{
793
794885   *xt = x - m_last_hofs;
795886   *yt = y - m_last_vofs;
796   if (*xt<0 || *xt >= window().blitwidth())
887   if (*xt<0 || *xt >= window().m_blitwidth)
797888      return 0;
798   if (*yt<0 || *yt >= window().blitheight())
889   if (*yt<0 || *yt >= window().m_blitheight)
799890      return 0;
800891   return 1;
801892}
802893
803894//============================================================
804//  drawsdl_destroy_all_textures
895//  sdl_info::get_primitives
805896//============================================================
806897
807void sdl_info_ogl::destroy_all_textures()
898void sdl_info_ogl::set_target_bounds()
808899{
809   texture_info *texture = NULL;
810   int lock=FALSE;
811   int i;
900   window().m_target->set_bounds(window().m_blitwidth, window().m_blitheight, window().monitor()->aspect());
901}
812902
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}
887903//============================================================
888904//  loadGLExtensions
889905//============================================================
r243409r243410
11021118
11031119   if ( m_useglsl )
11041120   {
1105      if ( window().prescale() != 1 )
1121      if ( window().m_prescale != 1 )
11061122      {
11071123         m_useglsl = 0;
11081124         if (_once)
r243409r243410
11951211}
11961212
11971213//============================================================
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//============================================================
11981244//  sdl_info::draw
11991245//============================================================
12001246
r243409r243410
12111257      return 0;
12121258   }
12131259
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();
12181260#if (SDLMAME_SDL2)
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);
1261   SDL_GL_MakeCurrent(window().m_sdl_window, m_gl_context_id);
12261262#else
12271263   if (!m_init_context)
12281264   {
r243409r243410
12311267      {
12321268         if (window().index() == 0)
12331269         {
1234            if ((screen->width() != m_screen_width) || (screen->height() != m_screen_height))
1270            if ((screen->width() != window().m_screen_width) || (screen->height() != window().m_screen_height))
12351271            {
1236               m_screen_width = screen->width();
1237               m_screen_height = screen->height();
1272               window().m_screen_width = screen->width();
1273               window().m_screen_height = screen->height();
12381274
12391275               // force all textures to be regenerated
12401276               destroy_all_textures();
r243409r243410
12851321   }
12861322
12871323   if ( !m_initialized ||
1288         window().width()!= m_surf_w || window().height()!= m_surf_h )
1324         window().m_width!= m_surf_w || window().m_height!= m_surf_h )
12891325   {
12901326      if ( !m_initialized )
12911327      {
12921328         loadGLExtensions();
12931329      }
12941330
1295      m_surf_w=window().width();
1296      m_surf_h=window().height();
1331      m_surf_w=window().m_width;
1332      m_surf_h=window().m_height;
12971333
12981334      // we're doing nothing 3d, so the Z-buffer is currently not interesting
12991335      glDisable(GL_DEPTH_TEST);
r243409r243410
13341370      //   |_________|
13351371      // (0,h)     (w,h)
13361372
1337      glViewport(0.0, 0.0, (GLsizei)window().width(), (GLsizei)window().height());
1373      glViewport(0.0, 0.0, (GLsizei)window().m_width, (GLsizei)window().m_height);
13381374      glMatrixMode(GL_PROJECTION);
13391375      glLoadIdentity();
1340      glOrtho(0.0, (GLdouble)window().width(), (GLdouble)window().height(), 0.0, 0.0, -1.0);
1376      glOrtho(0.0, (GLdouble)window().m_width, (GLdouble)window().m_height, 0.0, 0.0, -1.0);
13411377      glMatrixMode(GL_MODELVIEW);
13421378      glLoadIdentity();
13431379
r243409r243410
13641400      }
13651401      else
13661402      {
1367         ch = window().height();
1368         cw = window().width();
1403         ch = window().m_height;
1404         cw = window().m_width;
13691405      }
13701406
13711407      if (video_config.centerv)
13721408      {
1373         vofs = (ch - window().blitheight()) / 2.0f;
1409         vofs = (ch - window().m_blitheight) / 2.0f;
13741410      }
13751411      if (video_config.centerh)
13761412      {
1377         hofs = (cw - window().blitwidth()) / 2.0f;
1413         hofs = (cw - window().m_blitwidth) / 2.0f;
13781414      }
13791415   }
13801416
r243409r243410
14501486               set_blendmode(sdl, PRIMFLAG_GET_BLENDMODE(prim->flags));
14511487
14521488               // compute the effective width based on the direction of the line
1453               effwidth = prim->width();
1489               effwidth = prim->m_width;
14541490               if (effwidth < 0.5f)
14551491                  effwidth = 0.5f;
14561492
r243409r243410
15551591                     // 1:1 tex coord CCW (0/0) (1/0) (1/1) (0/1) on texture dimensions
15561592                     m_texVerticex[0]=(GLfloat)0.0;
15571593                     m_texVerticex[1]=(GLfloat)0.0;
1558                     m_texVerticex[2]=(GLfloat)window().width();
1594                     m_texVerticex[2]=(GLfloat)window().m_width;
15591595                     m_texVerticex[3]=(GLfloat)0.0;
1560                     m_texVerticex[4]=(GLfloat)window().width();
1561                     m_texVerticex[5]=(GLfloat)window().height();
1596                     m_texVerticex[4]=(GLfloat)window().m_width;
1597                     m_texVerticex[5]=(GLfloat)window().m_height;
15621598                     m_texVerticex[6]=(GLfloat)0.0;
1563                     m_texVerticex[7]=(GLfloat)window().height();
1599                     m_texVerticex[7]=(GLfloat)window().m_height;
15641600                  }
15651601
15661602                  if(i>0) // first fetch already done
r243409r243410
16061642#if (!SDLMAME_SDL2)
16071643   SDL_GL_SwapBuffers();
16081644#else
1609   SDL_GL_SwapWindow(window().sdl_window());
1645   SDL_GL_SwapWindow(window().m_sdl_window);
16101646#endif
16111647   return 0;
16121648}
r243409r243410
17641800      texture->xprescale--;
17651801   while (texture->yprescale > 1 && height_create * texture->yprescale > m_texture_max_height)
17661802      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);
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);
17691805
17701806   width  *= texture->xprescale;
17711807   height *= texture->yprescale;
r243409r243410
19441980{
19451981   int uniform_location;
19461982   int i;
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);
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);
19491985
19501986   assert ( texture->type==TEXTURE_TYPE_SHADER );
19511987
r243409r243410
19922028      pfn_glUniform2fvARB(uniform_location, 1, &(color_texture_pow2_sz[0]));
19932029      GL_CHECK_ERROR_NORMAL();
19942030
1995      GLfloat screen_texture_sz[2] = { (GLfloat)window().blitwidth(), (GLfloat)window().blitheight() };
2031      GLfloat screen_texture_sz[2] = { (GLfloat)window().m_blitwidth, (GLfloat)window().m_blitheight };
19962032      uniform_location = pfn_glGetUniformLocationARB(m_glsl_program[i], "screen_texture_sz");
19972033      pfn_glUniform2fvARB(uniform_location, 1, &(screen_texture_sz[0]));
19982034      GL_CHECK_ERROR_NORMAL();
r243409r243410
20482084      }
20492085
20502086      osd_printf_verbose("GL texture: mpass screen-bmp 2x %dx%d (pow2 %dx%d)\n",
2051         window().width(), window().height(), surf_w_pow2, surf_h_pow2);
2087         window().m_width, window().m_height, surf_w_pow2, surf_h_pow2);
20522088   }
20532089
20542090   // GL_TEXTURE0
r243409r243410
21272163   texture->texinfo.seqid = -1; // force set data
21282164   if (PRIMFLAG_GET_SCREENTEX(flags))
21292165   {
2130      texture->xprescale = window().prescale();
2131      texture->yprescale = window().prescale();
2166      texture->xprescale = window().m_prescale;
2167      texture->yprescale = window().m_prescale;
21322168   }
21332169   else
21342170   {
r243409r243410
27582794   }
27592795   else if ( texture->type == TEXTURE_TYPE_SHADER && shaderIdx>m_glsl_program_mb2sc )
27602796   {
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);
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);
27632799
2764      ustop  = (float)(window().width()) / (float)surf_w_pow2;
2765      vstop  = (float)(window().height()) / (float)surf_h_pow2;
2800      ustop  = (float)(window().m_width) / (float)surf_w_pow2;
2801      vstop  = (float)(window().m_height) / (float)surf_h_pow2;
27662802   }
27672803   else
27682804   {
r243409r243410
30503086   }
30513087}
30523088
3089void sdl_info_ogl::destroy_all_textures()
3090{
3091   texture_info *texture = NULL;
3092   int lock=FALSE;
3093   int i;
30533094
3095   if ( !m_initialized )
3096      return;
30543097
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
r243409r243410
5050{
5151public:
5252
53   sdl_info(sdl_window_info *w, int extra_flags)
54   : osd_renderer(w, extra_flags),
53   sdl_info(sdl_window_info *w)
54   : osd_renderer(w),
55   m_blittimer(0),
56   m_extra_flags(0),
57
5558   #if (SDLMAME_SDL2)
5659   m_sdl_renderer(NULL),
5760   m_texture_id(NULL),
5861   #else
62   m_sdlsurf(NULL),
5963   m_yuvsurf(NULL),
6064   #endif
6165   m_yuv_lookup(NULL),
r243409r243410
6569   m_last_hofs(0),
6670   m_last_vofs(0),
6771   m_old_blitwidth(0),
68   m_old_blitheight(0),
69   m_last_width(0),
70   m_last_height(0)
72   m_old_blitheight(0)
7173   { }
7274
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);
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);
7680   /* virtual */ void destroy_all_textures();
7781   /* virtual */ void destroy();
7882   /* virtual */ void clear();
r243409r243410
8993#endif
9094
9195   INT32               m_blittimer;
96   UINT32              m_extra_flags;
9297
9398#if (SDLMAME_SDL2)
99   // Original display_mode
100   SDL_DisplayMode    m_original_mode;
101
94102   SDL_Renderer        *m_sdl_renderer;
95103   SDL_Texture         *m_texture_id;
96104#else
105   // SDL surface
106   SDL_Surface         *m_sdlsurf;
97107   SDL_Overlay         *m_yuvsurf;
98108#endif
99109
r243409r243410
108118   int                 m_last_vofs;
109119   int                 m_old_blitwidth;
110120   int                 m_old_blitheight;
111   int                 m_last_width;
112   int                 m_last_height;
113121};
114122
115123struct sdl_scale_mode
r243409r243410
157165
158166static const sdl_scale_mode scale_modes[] =
159167{
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 },
168      { "none",    0, 0, 1, 1, SDL_DOUBLEBUF, 0, 0 },
169      { "async",   0, 0, 1, 1, SDL_DOUBLEBUF | SDL_ASYNCBLIT, 0, 0 },
162170      { "yv12",    1, 1, 1, 1, 0,              SDL_YV12_OVERLAY, yuv_RGB_to_YV12 },
163171      { "yv12x2",  1, 1, 2, 2, 0,              SDL_YV12_OVERLAY, yuv_RGB_to_YV12X2 },
164172      { "yuy2",    1, 1, 1, 1, 0,              SDL_YUY2_OVERLAY, yuv_RGB_to_YUY2 },
r243409r243410
171179      { "none",    0, 0, 1, 1, DRAW2_SCALEMODE_NEAREST, 0, 0 },
172180      { "hwblit",  1, 0, 1, 1, DRAW2_SCALEMODE_LINEAR, 0, 0 },
173181      { "hwbest",  1, 0, 1, 1, DRAW2_SCALEMODE_BEST, 0, 0 },
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 },
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 },
179186      { NULL }
180187};
181188#endif
r243409r243410
214221   return -1;
215222}
216223
224//============================================================
225//  drawsdl_init
226//============================================================
217227
218228static osd_renderer *drawsdl_create(sdl_window_info *window)
219229{
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
230   return global_alloc(sdl_info(window));
227231}
228232
229//============================================================
230//  drawsdl_init
231//============================================================
232233
233234int drawsdl_init(sdl_draw_info *callbacks)
234235{
r243409r243410
253254}
254255
255256//============================================================
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//============================================================
256266//  setup_texture for window
257267//============================================================
258268
r243409r243410
279289      int m_hw_scale_width =0;
280290      int m_hw_scale_height = 0;
281291
282      window().target()->compute_minimum_size(m_hw_scale_width, m_hw_scale_height);
292      window().m_target->compute_minimum_size(m_hw_scale_width, m_hw_scale_height);
283293      if (video_config.prescale)
284294      {
285295         m_hw_scale_width *= video_config.prescale;
r243409r243410
315325   const sdl_scale_mode *sdl_sm = &scale_modes[video_config.scale_mode];
316326   int minimum_width, minimum_height;
317327
318   window().target()->compute_minimum_size(minimum_width, minimum_height);
328   window().m_target->compute_minimum_size(minimum_width, minimum_height);
319329
320330   if (video_config.prescale)
321331   {
r243409r243410
339349   m_yuv_bitmap = global_alloc_array(UINT16, minimum_width*minimum_height);
340350
341351   m_yuvsurf = SDL_CreateYUVOverlay(minimum_width * sdl_sm->mult_w, minimum_height * sdl_sm->mult_h,
342         sdl_sm->pixel_format, window().sdl_surface());
352         sdl_sm->pixel_format, m_sdlsurf);
343353
344354   if ( m_yuvsurf == NULL ) {
345355      osd_printf_error("SDL: Couldn't create SDL_yuv_overlay: %s\n", SDL_GetError());
r243409r243410
419429// a
420430//============================================================
421431
422int sdl_info::create()
432int sdl_info::create(int width, int height)
423433{
434   const sdl_scale_mode *sm = &scale_modes[video_config.scale_mode];
424435
425436#if (SDLMAME_SDL2)
426   const sdl_scale_mode *sm = &scale_modes[video_config.scale_mode];
427437
428   // create renderer
438   osd_printf_verbose("Enter sdl_info::create\n");
429439
430440   /* set hints ... */
431441   SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, sm->sdl_scale_mode);
432442
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);
433447
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);
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);
438456
439   if (!m_sdl_renderer)
457   if (!window().m_sdl_window )
440458   {
441      fatalerror("Error on creating renderer: %s\n", SDL_GetError());
459      osd_printf_error("Unable to create window: %s\n", SDL_GetError());
460      return 1;
442461   }
443462
463   if (window().fullscreen() && video_config.switchres)
444464   {
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   {
445513      struct SDL_RendererInfo render_info;
446514
447515      SDL_GetRendererInfo(m_sdl_renderer, &render_info);
r243409r243410
465533      }
466534   }
467535
468   setup_texture(window().width(), window().height());
536   setup_texture(width, height);
469537#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
470555#endif
471556
472557   m_yuv_lookup = NULL;
r243409r243410
478563}
479564
480565//============================================================
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//============================================================
481602//  sdl_info::destroy
482603//============================================================
483604
484605void sdl_info::destroy()
485606{
486607
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
487633   // free the memory in the window
488634
489   destroy_all_textures();
490
491635   if (m_yuv_lookup != NULL)
492636   {
493637      global_free_array(m_yuv_lookup);
r243409r243410
501645}
502646
503647//============================================================
504//  sdl_info::clear
648//  sdl_info::draw
505649//============================================================
506650
507651void sdl_info::clear()
508652{
509   //FIXME: Handled in sdl_info::draw as well
510653   m_blittimer = 3;
511654}
512655
r243409r243410
516659
517660int sdl_info::xy_to_render_target(int x, int y, int *xt, int *yt)
518661{
662//   const sdl_scale_mode *sm = &scale_modes[video_config.scale_mode];
663
519664   *xt = x - m_last_hofs;
520665   *yt = y - m_last_vofs;
521   if (*xt<0 || *xt >= window().blitwidth())
666   if (*xt<0 || *xt >= window().m_blitwidth)
522667      return 0;
523   if (*yt<0 || *yt >= window().blitheight())
668   if (*yt<0 || *xt >= window().m_blitheight)
524669      return 0;
525670   return 1;
526671}
527672
528673//============================================================
529//  drawsdl_destroy_all_textures
674//  drawsdl_window_get_primitives
530675//============================================================
531676
532void sdl_info::destroy_all_textures()
677void sdl_info::set_target_bounds()
533678{
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
679   window().m_target->set_bounds(window().m_blitwidth, window().m_blitheight, window().monitor()->aspect());
544680}
545681
546
547682//============================================================
548//  sdl_info::draw
683//  drawsdl_window_draw
549684//============================================================
550685
551686int sdl_info::draw(UINT32 dc, int update)
r243409r243410
565700      return 0;
566701   }
567702
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
583703   // lock it if we need it
584704#if (!SDLMAME_SDL2)
585705
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;
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;
591711//  amask = sdlsurf->format->Amask;
592712
593   if (window().blitwidth() != m_old_blitwidth || window().blitheight() != m_old_blitheight)
713   if (window().m_blitwidth != m_old_blitwidth || window().m_blitheight != m_old_blitheight)
594714   {
595715      if (sm->is_yuv)
596716         yuv_overlay_init();
597      m_old_blitwidth = window().blitwidth();
598      m_old_blitheight = window().blitheight();
717      m_old_blitwidth = window().m_blitwidth;
718      m_old_blitheight = window().m_blitheight;
599719      m_blittimer = 3;
600720   }
601721
602   if (SDL_MUSTLOCK(window().sdl_surface()))
603      SDL_LockSurface(window().sdl_surface());
722   if (SDL_MUSTLOCK(m_sdlsurf))
723      SDL_LockSurface(m_sdlsurf);
604724
605725   // Clear if necessary
606726   if (m_blittimer > 0)
607727   {
608      memset(window().sdl_surface()->pixels, 0, window().height() * window().sdl_surface()->pitch);
728      memset(m_sdlsurf->pixels, 0, window().m_height * m_sdlsurf->pitch);
609729      m_blittimer--;
610730   }
611731
r243409r243410
623743#endif
624744   }
625745   else
626      surfptr = (UINT8 *)window().sdl_surface()->pixels;
746      surfptr = (UINT8 *)m_sdlsurf->pixels;
627747#else
628748   //SDL_SelectRenderer(window().sdl_window);
629749
630   if (window().blitwidth() != m_old_blitwidth || window().blitheight() != m_old_blitheight)
750   if (window().m_blitwidth != m_old_blitwidth || window().m_blitheight != m_old_blitheight)
631751   {
632      //SDL_RenderSetViewport(m_sdl_renderer, NULL);
752      SDL_RenderSetViewport(m_sdl_renderer, NULL);
633753
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();
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;
639758      m_blittimer = 3;
640759   }
641760
r243409r243410
663782#endif
664783   // get ready to center the image
665784   vofs = hofs = 0;
666   blitwidth = window().blitwidth();
667   blitheight = window().blitheight();
785   blitwidth = window().m_blitwidth;
786   blitheight = window().m_blitheight;
668787
669788   // figure out what coordinate system to use for centering - in window mode it's always the
670789   // SDL surface size.  in fullscreen the surface covers all monitors, so center according to
r243409r243410
676795   }
677796   else
678797   {
679      ch = window().height();
680      cw = window().width();
798      ch = window().m_height;
799      cw = window().m_width;
681800   }
682801
683802   // do not crash if the window's smaller than the blit area
r243409r243410
687806   }
688807   else if (video_config.centerv)
689808   {
690      vofs = (ch - window().blitheight()) / 2;
809      vofs = (ch - window().m_blitheight) / 2;
691810   }
692811
693812   if (blitwidth > cw)
r243409r243410
696815   }
697816   else if (video_config.centerh)
698817   {
699      hofs = (cw - window().blitwidth()) / 2;
818      hofs = (cw - window().m_blitwidth) / 2;
700819   }
701820
702821   m_last_hofs = hofs;
r243409r243410
710829      if (!sm->is_yuv)
711830      {
712831         surfptr += ((vofs * pitch) + (hofs * bpp));
713         mamewidth = blitwidth; //sdl_surface()->w;
714         mameheight = blitheight; //sdl_surface()->h;
832         mamewidth = blitwidth; //m_sdlsurf->w;
833         mameheight = blitheight; //m_sdlsurf->h;
715834      }
716835      else
717836      {
r243409r243410
736855
737856   for (render_primitive *prim = window().m_primlist->first(); prim != NULL; prim = prim->next())
738857   {
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);
858      prim->bounds.x0 *= fw;
859      prim->bounds.x1 *= fw;
860      prim->bounds.y0 *= fh;
861      prim->bounds.y1 *= fh;
743862   }
744863
745864   // render to it
r243409r243410
784903
785904   // unlock and flip
786905#if (!SDLMAME_SDL2)
787   if (SDL_MUSTLOCK(window().sdl_surface())) SDL_UnlockSurface(window().sdl_surface());
906   if (SDL_MUSTLOCK(m_sdlsurf)) SDL_UnlockSurface(m_sdlsurf);
788907   if (!sm->is_yuv)
789908   {
790      SDL_Flip(window().sdl_surface());
909      SDL_Flip(m_sdlsurf);
791910   }
792911   else
793912   {
trunk/src/osd/sdl/input.c
r243409r243410
14731473//  sdlinput_get_focus_window
14741474//============================================================
14751475
1476sdl_window_info *sdlinput_get_focus_window()
1476sdl_window_info *sdlinput_get_focus_window(running_machine &machine)
14771477{
14781478   if (focus_window)  // only be set on SDL >= 1.3
14791479      return focus_window;
r243409r243410
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->sdl_window() == window)
1550      if (w->m_sdl_window == window)
15511551      {
15521552         return w;
15531553      }
r243409r243410
15661566      {
15671567         if (w->m_resize_width && w->m_resize_height && ((now - w->m_last_resize) > osd_ticks_per_second() / 10))
15681568         {
1569            w->resize(w->m_resize_width, w->m_resize_height);
1569            w->window_resize(w->m_resize_width, w->m_resize_height);
15701570            w->m_resize_width = 0;
15711571            w->m_resize_height = 0;
15721572         }
r243409r243410
15761576
15771577#endif
15781578
1579void sdlinput_process_events_buf()
1579void sdlinput_process_events_buf(running_machine &machine)
15801580{
15811581   SDL_Event event;
15821582
r243409r243410
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->target(), event.key.keysym.sym);
1763            ui_input_push_char_event(machine, sdl_window_list->m_target, event.key.keysym.sym);
17641764#else
1765         ui_input_push_char_event(machine, sdl_window_list->target(), (unicode_char) event.key.keysym.unicode);
1765         ui_input_push_char_event(machine, sdl_window_list->m_target, (unicode_char) event.key.keysym.unicode);
17661766#endif
17671767         break;
17681768      case SDL_KEYUP:
r243409r243410
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->target(), cx, cy);
1867               ui_input_push_mouse_down_event(machine, window->m_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->target(), cx, cy);
1874                  ui_input_push_mouse_double_click_event(machine, window->m_target, cx, cy);
18751875               }
18761876               else
18771877               {
r243409r243410
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->target(), cx, cy);
1901               ui_input_push_mouse_up_event(machine, window->m_target, cx, cy);
19021902            }
19031903         }
19041904         break;
r243409r243410
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->target(), cx, cy);
1925               ui_input_push_mouse_move_event(machine, window->m_target, cx, cy);
19261926         }
19271927         break;
19281928      case SDL_JOYBALLMOTION:
r243409r243410
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->target());
1940            ui_input_push_mouse_leave_event(machine, window->m_target);
19411941         }
19421942         break;
19431943      case SDL_QUIT:
19441944         machine.schedule_exit();
19451945         break;
19461946      case SDL_VIDEORESIZE:
1947         sdl_window_list->resize(event.resize.w, event.resize.h);
1947         sdl_window_list->window_resize(event.resize.w, event.resize.h);
19481948         break;
19491949#else
19501950      case SDL_TEXTINPUT:
19511951         if (*event.text.text)
19521952         {
1953            printf("char %c\n", *event.text.text);
19531954            sdl_window_info *window = GET_FOCUS_WINDOW(&event.text);
19541955            unicode_char result;
19551956            if (window != NULL )
19561957            {
19571958               osd_uchar_from_osdchar(&result, event.text.text, 1);
1958               ui_input_push_char_event(machine, window->target(), result);
1959               ui_input_push_char_event(machine, window->m_target, result);
19591960            }
19601961         }
19611962         break;
r243409r243410
19721973            machine.schedule_exit();
19731974            break;
19741975         case  SDL_WINDOWEVENT_LEAVE:
1975            ui_input_push_mouse_leave_event(machine, window->target());
1976            ui_input_push_mouse_leave_event(machine, window->m_target);
19761977            app_has_mouse_focus = 0;
19771978            break;
19781979         case SDL_WINDOWEVENT_MOVED:
1979            window->clear();
1980            window->window_clear();
19801981            focus_window = window;
19811982            break;
19821983         case SDL_WINDOWEVENT_RESIZED:
r243409r243410
19961997#endif
19971998               {
19981999                  //printf("event data1,data2 %d x %d %ld\n", event.window.data1, event.window.data2, sizeof(SDL_Event));
1999                  if (event.window.data1 != window->width() || event.window.data2 != window->height())
2000                     window->resize(event.window.data1, event.window.data2);
2000                  if (event.window.data1 != window->m_width || event.window.data2 != window->m_height)
2001                     window->window_resize(event.window.data1, event.window.data2);
20012002               }
20022003            }
20032004            focus_window = window;
r243409r243410
20282029//============================================================
20292030
20302031
2031void  sdlinput_release_keys()
2032void  sdlinput_release_keys(running_machine &machine)
20322033{
20332034   // FIXME: SDL >= 1.3 will nuke the window event buffer when
20342035   // a window is closed. This will leave keys in a pressed
r243409r243410
20522053//  sdlinput_should_hide_mouse
20532054//============================================================
20542055
2055int sdlinput_should_hide_mouse()
2056int sdlinput_should_hide_mouse(running_machine &machine)
20562057{
20572058   // if we are paused, no
20582059   if (input_paused)
trunk/src/osd/sdl/input.h
r243409r243410
1919//============================================================
2020
2121void sdlinput_poll(running_machine &machine);
22int  sdlinput_should_hide_mouse();
22int  sdlinput_should_hide_mouse(running_machine &machine);
2323
24sdl_window_info *sdlinput_get_focus_window();
24sdl_window_info *sdlinput_get_focus_window(running_machine &machine);
2525
26void  sdlinput_process_events_buf();
27void  sdlinput_release_keys();
26void  sdlinput_process_events_buf(running_machine &machine);
27void  sdlinput_release_keys(running_machine &machine);
2828
2929#endif /* __SDLINPUT_H__ */
trunk/src/osd/sdl/video.c
r243409r243410
113113      sdl_window_config conf;
114114      memset(&conf, 0, sizeof(conf));
115115      get_resolution(options().resolution(), options().resolution(index), &conf, TRUE);
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())
116      if (sdlwindow_video_window_create(machine(), index, sdl_monitor_info::pick_monitor(options(), index), &conf))
121117         return false;
122118   }
123119
r243409r243410
312308   {
313309//      profiler_mark(PROFILER_BLIT);
314310      for (window = sdl_window_list; window != NULL; window = window->m_next)
315         window->update();
311         window->video_window_update(machine());
316312//      profiler_mark(PROFILER_END);
317313   }
318314
r243409r243410
544540
545541static void check_osd_inputs(running_machine &machine)
546542{
547   sdl_window_info *window = sdlinput_get_focus_window();
543   sdl_window_info *window = sdlinput_get_focus_window(machine);
548544
549545   // check for toggling fullscreen mode
550546   if (ui_input_pressed(machine, IPT_OSD_1))
r243409r243410
553549
554550      while (curwin != (sdl_window_info *)NULL)
555551      {
556         curwin->toggle_full_screen();
552         curwin->toggle_full_screen(machine);
557553         curwin = curwin->m_next;
558554      }
559555   }
r243409r243410
582578   #endif
583579
584580   if (ui_input_pressed(machine, IPT_OSD_6))
585      window->modify_prescale(-1);
581      window->modify_prescale(machine, -1);
586582
587583   if (ui_input_pressed(machine, IPT_OSD_7))
588      window->modify_prescale(1);
584      window->modify_prescale(machine, 1);
589585}
590586
591587//============================================================
trunk/src/osd/sdl/window.c
r243409r243410
100100
101101struct worker_param {
102102   worker_param()
103   : m_window(NULL), m_list(NULL), m_resize_new_width(0), m_resize_new_height(0)
103   : m_window(NULL), m_list(NULL), m_machine(NULL), m_resize_new_width(0), m_resize_new_height(0)
104104   {
105105   }
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)
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)
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   }
110114   worker_param(sdl_window_info *awindow, int anew_width, int anew_height)
111   : m_window(awindow), m_list(NULL), m_resize_new_width(anew_width), m_resize_new_height(anew_height)
115   : m_window(awindow), m_list(NULL), m_machine(NULL), m_resize_new_width(anew_width), m_resize_new_height(anew_height)
112116   {
113117   }
114118   worker_param(sdl_window_info *awindow)
115   : m_window(awindow), m_list(NULL), m_resize_new_width(0), m_resize_new_height(0)
119   : m_window(awindow), m_list(NULL), m_machine(NULL), m_resize_new_width(0), m_resize_new_height(0)
116120   {
117121   }
122   running_machine &machine() const { assert(m_machine != NULL); return *m_machine; }
118123   sdl_window_info *window() const { assert(m_window != NULL); return m_window; }
119124   render_primitive_list *list() const { return m_list; }
120125   int new_width() const { return m_resize_new_width; }
r243409r243410
124129private:
125130   sdl_window_info *m_window;
126131   render_primitive_list *m_list;
132   running_machine *m_machine;
127133   int m_resize_new_width;
128134   int m_resize_new_height;
129135};
r243409r243410
133139//  PROTOTYPES
134140//============================================================
135141
142static void sdlwindow_update_cursor_state(running_machine &machine, sdl_window_info *window);
136143static void sdlwindow_sync(void);
137144
145static void set_starting_view(running_machine &machine, int index, sdl_window_info *window, const char *defview, const char *view);
146
138147//============================================================
139148//  execute_async
140149//============================================================
r243409r243410
266275         SDL_HINT_RENDER_VSYNC,
267276         SDL_HINT_VIDEO_X11_XVIDMODE, SDL_HINT_VIDEO_X11_XINERAMA,
268277         SDL_HINT_VIDEO_X11_XRANDR, SDL_HINT_GRAB_KEYBOARD,
278         SDL_HINT_MOUSE_RELATIVE_MODE_WARP,
269279         SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS, SDL_HINT_IDLE_TIMER_DISABLED,
270280         SDL_HINT_ORIENTATIONS,
271281         SDL_HINT_XINPUT_ENABLED, SDL_HINT_GAMECONTROLLERCONFIG,
r243409r243410
275285         SDL_HINT_RENDER_DIRECT3D_THREADSAFE, SDL_HINT_VIDEO_ALLOW_SCREENSAVER,
276286         SDL_HINT_ACCELEROMETER_AS_JOYSTICK, SDL_HINT_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK,
277287         SDL_HINT_VIDEO_WIN_D3DCOMPILER, SDL_HINT_VIDEO_WINDOW_SHARE_PIXEL_FORMAT,
278         SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES, SDL_HINT_MOUSE_RELATIVE_MODE_WARP,
288         SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES,
279289#endif
280290#if SDL_VERSION_ATLEAST(2, 0, 3)
281291         SDL_HINT_RENDER_DIRECT3D11_DEBUG, SDL_HINT_VIDEO_HIGHDPI_DISABLED,
r243409r243410
345355   {
346356      sdl_window_info *temp = sdl_window_list;
347357      sdl_window_list = temp->m_next;
348      temp->destroy();
358      temp->video_window_destroy(machine());
349359      // free the window itself
350360      global_free(temp);
351361   }
r243409r243410
454464      newwidth = window_width;
455465
456466   if ((m_blitwidth != newwidth) || (m_blitheight != newheight))
457      clear();
467      window_clear();
458468
459469   m_blitwidth = newwidth;
460470   m_blitheight = newheight;
r243409r243410
470480{
471481   worker_param *      wp = (worker_param *) param;
472482   sdl_window_info *   window = wp->window();
473   int width = wp->new_width();
474   int height = wp->new_height();
475483
476484   ASSERT_WINDOW_THREAD();
477485
478486   window->renderer().destroy_all_textures();
487   window->renderer().resize(wp->new_width(), wp->new_height());
479488
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);
489   window->blit_surface_size(wp->new_width(), wp->new_height());
485490
486   window->m_sdlsurf = SDL_SetVideoMode(width, height, 0,
487         SDL_SWSURFACE | SDL_ANYFORMAT | window->m_extra_flags);
491   window->window_clear();
488492
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
497493   osd_free(wp);
498494   return NULL;
499495}
500496
501void sdl_window_info::resize(INT32 width, INT32 height)
497void sdl_window_info::window_resize(INT32 width, INT32 height)
502498{
503499   ASSERT_MAIN_THREAD();
504500
505   if (width == this->width() && height == this->height())
501   if (width == this->m_width && height == this->m_height)
506502      return;
507503
508504   execute_async_wait(&sdlwindow_resize_wt, worker_param(this, width, height));
r243409r243410
526522   return NULL;
527523}
528524
529void sdl_window_info::clear()
525void sdl_window_info::window_clear()
530526{
531527   worker_param wp;
532528
r243409r243410
558554   // If we are going fullscreen (leaving windowed) remember our windowed size
559555   if (!window->fullscreen())
560556   {
561      window->m_windowed_width = window->width();
562      window->m_windowed_height = window->height();
557      window->m_windowed_width = window->m_width;
558      window->m_windowed_height = window->m_height;
563559   }
564560
565561   window->renderer().destroy();
562   sdlinput_release_keys(wp->machine());
566563
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
586564   // toggle the window mode
587565   window->set_fullscreen(!window->fullscreen());
588566
r243409r243410
591569   return NULL;
592570}
593571
594void sdl_window_info::toggle_full_screen()
572void sdl_window_info::toggle_full_screen(running_machine &machine)
595573{
596574   ASSERT_MAIN_THREAD();
597575
598   execute_async_wait(&sdlwindow_toggle_full_screen_wt, worker_param(this));
576   execute_async_wait(&sdlwindow_toggle_full_screen_wt, worker_param(machine, this));
599577}
600578
601579OSDWORK_CALLBACK( sdl_window_info::destroy_all_textures_wt )
r243409r243410
610588   return NULL;
611589}
612590
613void sdl_window_info::modify_prescale(int dir)
591void sdl_window_info::modify_prescale(running_machine &machine, int dir)
614592{
615   worker_param wp = worker_param(this);
616   int new_prescale = prescale();
593   worker_param wp = worker_param(machine, this);
594   int new_prescale = m_prescale;
617595
618   if (dir > 0 && prescale() < 3)
619      new_prescale = prescale() + 1;
620   if (dir < 0 && prescale() > 1)
621      new_prescale = prescale() - 1;
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;
622600
623   if (new_prescale != prescale())
601   if (new_prescale != m_prescale)
624602   {
625603      if (m_fullscreen && video_config.switchres)
626604      {
r243409r243410
636614         execute_async_wait(destroy_all_textures_wt, wp);
637615         m_prescale = new_prescale;
638616      }
639      machine().ui().popup_time(1, "Prescale %d", prescale());
617      machine.ui().popup_time(1, "Prescale %d", m_prescale);
640618   }
641619}
642620
r243409r243410
645623//  (main or window thread)
646624//============================================================
647625
648void sdl_window_info::update_cursor_state()
626static void sdlwindow_update_cursor_state(running_machine &machine, sdl_window_info *window)
649627{
650628#if (USE_XINPUT)
651629   // Hack for wii-lightguns:
r243409r243410
660638#if (SDLMAME_SDL2)
661639   // do not do mouse capture if the debugger's enabled to avoid
662640   // the possibility of losing control
663   if (!(machine().debug_flags & DEBUG_FLAG_OSD_ENABLED))
641   if (!(machine.debug_flags & DEBUG_FLAG_OSD_ENABLED))
664642   {
665643      //FIXME: SDL1.3: really broken: the whole SDL code
666644      //       will only work correct with relative mouse movements ...
667      if (!fullscreen() && !sdlinput_should_hide_mouse())
645      if (!window->fullscreen() && !sdlinput_should_hide_mouse(machine))
668646      {
669647         SDL_ShowCursor(SDL_ENABLE);
670         if (SDL_GetWindowGrab(sdl_window() ))
671            SDL_SetWindowGrab(sdl_window(), SDL_FALSE);
648         if (SDL_GetWindowGrab(window->m_sdl_window ))
649            SDL_SetWindowGrab(window->m_sdl_window, SDL_FALSE);
672650         SDL_SetRelativeMouseMode(SDL_FALSE);
673651      }
674652      else
675653      {
676654         SDL_ShowCursor(SDL_DISABLE);
677         if (!SDL_GetWindowGrab(sdl_window()))
678            SDL_SetWindowGrab(sdl_window(), SDL_TRUE);
655         if (!SDL_GetWindowGrab(window->m_sdl_window))
656            SDL_SetWindowGrab(window->m_sdl_window, SDL_TRUE);
679657         SDL_SetRelativeMouseMode(SDL_TRUE);
680658      }
681659      SDL_SetCursor(NULL); // Force an update in case the underlying driver has changed visibility
r243409r243410
684662#else
685663   // do not do mouse capture if the debugger's enabled to avoid
686664   // the possibility of losing control
687   if (!(machine().debug_flags & DEBUG_FLAG_OSD_ENABLED))
665   if (!(machine.debug_flags & DEBUG_FLAG_OSD_ENABLED))
688666   {
689      if ( fullscreen() || sdlinput_should_hide_mouse() )
667      if ( window->fullscreen() || sdlinput_should_hide_mouse(machine) )
690668      {
691669         SDL_ShowCursor(SDL_DISABLE);
692670         if (!SDL_WM_GrabInput(SDL_GRAB_QUERY))
r243409r243410
707685#endif
708686}
709687
710OSDWORK_CALLBACK( sdl_window_info::update_cursor_state_wt )
688static OSDWORK_CALLBACK( sdlwindow_update_cursor_state_wt )
711689{
712690   worker_param *      wp = (worker_param *) param;
713   sdl_window_info *   window = wp->window();
691   //sdl_window_info *   window = wp->window;
714692
715   window->update_cursor_state();
693   sdlwindow_update_cursor_state(wp->machine(), wp->window());
716694
717695   osd_free(wp);
718696   return NULL;
r243409r243410
728706//  (main thread)
729707//============================================================
730708
731int sdl_window_info::window_init()
709int sdlwindow_video_window_create(running_machine &machine, int index, sdl_monitor_info *monitor, const sdl_window_config *config)
732710{
711   sdl_window_info *window;
733712   worker_param *wp = (worker_param *) osd_malloc(sizeof(worker_param));
734713   int result;
735714
736715   ASSERT_MAIN_THREAD();
737716
717   // allocate a new window object
718   window = global_alloc(sdl_window_info(&machine, monitor, index, config));
719
738720   // set the initial maximized state
739721   // FIXME: Does not belong here
740   sdl_options &options = downcast<sdl_options &>(m_machine.options());
741   m_startmaximized = options.maximize();
722   sdl_options &options = downcast<sdl_options &>(machine.options());
723   window->m_startmaximized = options.maximize();
742724
743725   // add us to the list
744   *last_window_ptr = this;
745   last_window_ptr = &this->m_next;
726   *last_window_ptr = window;
727   last_window_ptr = &window->m_next;
746728
747   set_renderer(draw.create(this));
729   window->set_renderer(draw.create(window));
748730
749731   // create an event that we can use to skip blitting
750   m_rendered_event = osd_event_alloc(FALSE, TRUE);
732   window->m_rendered_event = osd_event_alloc(FALSE, TRUE);
751733
752734   // load the layout
753   m_target = m_machine.render().target_alloc();
735   window->m_target = machine.render().target_alloc();
754736
755737   // set the specific view
756   set_starting_view(m_machine, m_index, options.view(), options.view(m_index));
738   set_starting_view(machine, index, window, options.view(), options.view(index));
757739
758740   // make the window title
759741   if (video_config.numscreens == 1)
760      sprintf(m_title, "%s: %s [%s]", emulator_info::get_appname(), m_machine.system().description, m_machine.system().name);
742      sprintf(window->m_title, "%s: %s [%s]", emulator_info::get_appname(), machine.system().description, machine.system().name);
761743   else
762      sprintf(m_title, "%s: %s [%s] - Screen %d", emulator_info::get_appname(), m_machine.system().description, m_machine.system().name, m_index);
744      sprintf(window->m_title, "%s: %s [%s] - Screen %d", emulator_info::get_appname(), machine.system().description, machine.system().name, index);
763745
764   wp->set_window(this);
746   wp->set_window(window);
765747
766748   // FIXME: pass error back in a different way
767749   if (multithreading_enabled)
r243409r243410
783765   return 0;
784766
785767error:
786   destroy();
768   window->video_window_destroy(machine);
769   // free the window itself
770   global_free(window);
787771   return 1;
788772}
789773
r243409r243410
803787   // free the textures etc
804788   window->renderer().destroy();
805789
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
822790   // release all keys ...
823   sdlinput_release_keys();
791   sdlinput_release_keys(wp->machine());
824792
825793
826794   osd_free(wp);
827795   return NULL;
828796}
829797
830void sdl_window_info::destroy()
798void sdl_window_info::video_window_destroy(running_machine &machine)
831799{
832800   sdl_window_info **prevptr;
833801
r243409r243410
848816      }
849817
850818   // free the textures etc
851   execute_async_wait(&sdlwindow_video_window_destroy_wt, worker_param(this));
819   execute_async_wait(&sdlwindow_video_window_destroy_wt, worker_param(machine, this));
852820
853821   // free the render target, after the textures!
854822   this->machine().render().target_free(m_target);
r243409r243410
875843   m_target->compute_minimum_size(minimum_width, minimum_height);
876844
877845   // use those as the target for now
878   target_width = minimum_width * MAX(1, prescale());
879   target_height = minimum_height * MAX(1, prescale());
846   target_width = minimum_width * MAX(1, m_prescale);
847   target_height = minimum_height * MAX(1, m_prescale);
880848
881849   // if we're not stretching, allow some slop on the minimum since we can handle it
882850   {
r243409r243410
942910   m_target->compute_minimum_size(minimum_width, minimum_height);
943911
944912   // use those as the target for now
945   target_width = minimum_width * MAX(1, prescale());
946   target_height = minimum_height * MAX(1, prescale());
913   target_width = minimum_width * MAX(1, m_prescale);
914   target_height = minimum_height * MAX(1, m_prescale);
947915
948916   // if we're not stretching, allow some slop on the minimum since we can handle it
949917   {
r243409r243410
1011979//  (main thread)
1012980//============================================================
1013981
1014void sdl_window_info::update()
982void sdl_window_info::video_window_update(running_machine &machine)
1015983{
1016984   osd_ticks_t     event_wait_ticks;
1017985   ASSERT_MAIN_THREAD();
r243409r243410
1019987   // adjust the cursor state
1020988   //sdlwindow_update_cursor_state(machine, window);
1021989
1022   execute_async(&update_cursor_state_wt, worker_param(this));
990   execute_async(&sdlwindow_update_cursor_state_wt, worker_param(machine, this));
1023991
1024992   // if we're visible and running and not in the middle of a resize, draw
1025993   if (m_target != NULL)
r243409r243410
10351003
10361004         if (!this->m_fullscreen)
10371005         {
1038            blit_surface_size(width(), height());
1006            blit_surface_size(m_width, m_height);
10391007            //Don't resize window without user interaction;
10401008            //window_resize(blitwidth, blitheight);
10411009         }
10421010         else if (video_config.switchres)
10431011         {
10441012            this->pick_best_mode(&tempwidth, &tempheight);
1045            resize(tempwidth, tempheight);
1013            window_resize(tempwidth, tempheight);
10461014         }
10471015      }
10481016
r243409r243410
10631031         }
10641032
10651033         // ensure the target bounds are up-to-date, and then get the primitives
1034         renderer().set_target_bounds();
10661035
1067         m_target->set_bounds(m_blitwidth, m_blitheight, monitor()->aspect());
1068
10691036         render_primitive_list &primlist = m_target->get_primitives();
10701037
10711038         // and redraw now
10721039
1073         execute_async(&draw_video_contents_wt, worker_param(this, primlist));
1040         execute_async(&draw_video_contents_wt, worker_param(machine, this, primlist));
10741041      }
10751042   }
10761043}
r243409r243410
10811048//  (main thread)
10821049//============================================================
10831050
1084void sdl_window_info::set_starting_view(running_machine &machine, int index, const char *defview, const char *view)
1051static void set_starting_view(running_machine &machine, int index, sdl_window_info *window, const char *defview, const char *view)
10851052{
10861053   int viewindex;
10871054
r243409r243410
10921059      view = defview;
10931060
10941061   // query the video system to help us pick a view
1095   viewindex = target()->configured_view(view, index, video_config.numscreens);
1062   viewindex = window->m_target->configured_view(view, index, video_config.numscreens);
10961063
10971064   // set the view
1098   target()->set_view(viewindex);
1099   m_start_viewscreen=viewindex;
1065   window->m_target->set_view(viewindex);
1066   window->m_start_viewscreen=viewindex;
11001067}
11011068
11021069
r243409r243410
11521119      }
11531120   }
11541121
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
12771122   // initialize the drawing backend
1278   if (window->renderer().create())
1123   if (window->renderer().create(tempwidth, tempheight))
12791124      return (void *) &result[1];
12801125
12811126   // Make sure we have a consistent state
r243409r243410
13431188   ASSERT_REDRAW_THREAD();
13441189
13451190   // Some configurations require events to be polled in the worker thread
1346   sdlinput_process_events_buf();
1191   sdlinput_process_events_buf(wp->machine());
13471192
13481193   window->m_primlist = wp->list();
13491194
trunk/src/osd/sdl/window.h
r243409r243410
3737class osd_renderer
3838{
3939public:
40   osd_renderer(sdl_window_info *window)
41   : m_window(window) { }
4042
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
5443   virtual ~osd_renderer() { }
5544
5645   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; }
5946
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;
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;
6352   virtual void destroy_all_textures() = 0;
6453   virtual void destroy() = 0;
6554   virtual void clear() = 0;
6655
6756private:
6857   sdl_window_info *m_window;
69   int m_flags;
7058};
7159
7260#define OSDWORK_CALLBACK(name)  void *name(void *param, ATTR_UNUSED int threadid)
r243409r243410
7462class sdl_window_info
7563{
7664public:
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),
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),
8071      m_start_viewscreen(0),
81      // Following three are used by input code to defer resizes
8272#if (SDLMAME_SDL2)
73      m_sdl_window(NULL),
8374      m_resize_width(0),
8475      m_resize_height(0),
8576      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
9377#else
94      m_sdlsurf(NULL),
78      m_screen_width(0), m_screen_height(0),
9579#endif
9680      m_machine(a_machine), m_monitor(a_monitor), m_fullscreen(0), m_index(0)
9781   {
r243409r243410
11498      global_free(m_renderer);
11599   }
116100
117   int window_init();
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();
118106
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);
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);
126110
127   running_machine &machine() const { return m_machine; }
111   running_machine &machine() const { assert(m_machine != NULL); return *m_machine; }
128112   sdl_monitor_info *monitor() const { return m_monitor; }
129113   int fullscreen() const { return m_fullscreen; }
130114
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);
131119   int index() const { return m_index; }
132120
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; }
121   int xy_to_render_target(int x, int y, int *xt, int *yt);
141122
142   int   blitwidth() const { return m_blitwidth; }
143   int blitheight() const { return m_blitheight; }
144   int prescale() const { return m_prescale; }
145
146123   // Pointer to next window
147124   sdl_window_info *   m_next;
148125
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:
160126   // window handle and info
161127   char                m_title[256];
162   int                 m_startmaximized;
163128
164129   // diverse flags
165130   int                 m_minwidth, m_minheight;
166131   int                 m_maxwidth, m_maxheight;
167   int                 m_refresh;
168132   int                 m_depth;
133   int                 m_refresh;
169134   int                 m_windowed_width;
170135   int                 m_windowed_height;
136   int                 m_startmaximized;
171137
172138   // rendering info
173139   osd_event *         m_rendered_event;
174140   render_target *     m_target;
141   render_primitive_list *m_primlist;
175142
176   // cache of physical width() and height()
143   // cache of physical m_width and m_height
177144   int                 m_width;
178145   int                 m_height;
179146
180   // current m_blitwidth and height()
147   // current m_blitwidth and m_height
181148   int                 m_blitwidth;
182149   int                 m_blitheight;
183150
151   int                 m_start_viewscreen;
184152
153   // GL specific
185154   int                 m_prescale;
186155
187156#if (SDLMAME_SDL2)
188157   // Needs to be here as well so we can identify window
189158   SDL_Window          *m_sdl_window;
190   // Original display_mode
191   SDL_DisplayMode m_original_mode;
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;
192163#else
193   // SDL surface
194   SDL_Surface         *m_sdlsurf;
164   int                 m_screen_width;
165   int                 m_screen_height;
195166#endif
196167
197   int             m_extra_flags;
198
199168   void set_renderer(osd_renderer *renderer)
200169   {
201170      m_renderer = renderer;
r243409r243410
206175   osd_renderer &renderer() { return *m_renderer; }
207176private:
208177   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; }
216178
217
218
219
220179   // Pointer to machine
221   running_machine &   m_machine;
180   running_machine *   m_machine;
222181   // monitor info
223182   sdl_monitor_info *  m_monitor;
224183   int                 m_fullscreen;
r243409r243410
233192   static OSDWORK_CALLBACK( sdlwindow_toggle_full_screen_wt );
234193   static OSDWORK_CALLBACK( sdlwindow_clear_surface_wt );
235194   static OSDWORK_CALLBACK( destroy_all_textures_wt );
236   static OSDWORK_CALLBACK( update_cursor_state_wt );
237195
238196   void measure_fps(UINT32 dc, int update);
239197
r243409r243410
256214//  PROTOTYPES
257215//============================================================
258216
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
259220//============================================================
260221// PROTOTYPES - drawsdl.c
261222//============================================================
trunk/src/osd/windows/d3dhlsl.c
r243409r243410
224224   if (!master_enable || !d3dintf->post_fx_available)
225225      return;
226226
227   renderer *d3d = dynamic_cast<renderer *>(window->m_renderer);
227   renderer *d3d = (renderer *)window->m_drawdata;
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)
r243409r243410
276276   if (!master_enable || !d3dintf->post_fx_available)
277277      return;
278278
279   renderer *d3d = dynamic_cast<renderer *>(window->m_renderer);
279   renderer *d3d = (renderer *)window->m_drawdata;
280280
281281   D3DLOCKED_RECT rect;
282282
r243409r243410
326326   if (!master_enable || !d3dintf->post_fx_available)
327327      return;
328328
329   renderer *d3d = dynamic_cast<renderer *>(window->m_renderer);
329   renderer *d3d = (renderer *)window->m_drawdata;
330330
331331   D3DLOCKED_RECT rect;
332332
r243409r243410
519519   if (!master_enable || !d3dintf->post_fx_available)
520520      return;
521521
522   renderer *d3d = dynamic_cast<renderer *>(window->m_renderer);
522   renderer *d3d = (renderer *)window->m_drawdata;
523523
524524   // stop any existing recording
525525   end_avi_recording();
r243409r243410
678678   if (!master_enable || !d3dintf->post_fx_available)
679679      return;
680680
681   renderer *d3d = dynamic_cast<renderer *>(window->m_renderer);
681   renderer *d3d = (renderer *)window->m_drawdata;
682682
683683   if(texture != NULL)
684684   {
r243409r243410
820820   if (!master_enable || !d3dintf->post_fx_available)
821821      return;
822822
823   renderer *d3d = dynamic_cast<renderer *>(window->m_renderer);
823   renderer *d3d = (renderer *)window->m_drawdata;
824824
825825   // get a pointer to the vertex buffer
826826   fsfx_vertices = (vertex *)vertbuf;
r243409r243410
892892   if (!master_enable || !d3dintf->post_fx_available)
893893      return 0;
894894
895   renderer *d3d = dynamic_cast<renderer *>(window->m_renderer);
895   renderer *d3d = (renderer *)window->m_drawdata;
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);
r243409r243410
10661066   if (!master_enable || !d3dintf->post_fx_available)
10671067      return;
10681068
1069   renderer *d3d = dynamic_cast<renderer *>(window->m_renderer);
1069   renderer *d3d = (renderer *)window->m_drawdata;
10701070
10711071   curr_effect = default_effect;
10721072
r243409r243410
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 = dynamic_cast<renderer *>(window->m_renderer);
1104   renderer *d3d = (renderer *)window->m_drawdata;
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);
r243409r243410
11461146void shaders::blit(surface *dst, texture *src, surface *new_dst, D3DPRIMITIVETYPE prim_type,
11471147                  UINT32 prim_index, UINT32 prim_count)
11481148{
1149   renderer *d3d = dynamic_cast<renderer *>(window->m_renderer);
1149   renderer *d3d = (renderer *)window->m_drawdata;
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);
r243409r243410
12311231   if (!master_enable || !d3dintf->post_fx_available)
12321232      return;
12331233
1234   renderer *d3d = dynamic_cast<renderer *>(window->m_renderer);
1234   renderer *d3d = (renderer *)window->m_drawdata;
12351235   texture_info *texture = poly->get_texture();
12361236
12371237   if(PRIMFLAG_GET_SCREENTEX(d3d->get_last_texture_flags()) && texture != NULL)
r243409r243410
13081308
13091309void shaders::ntsc_pass(render_target *rt, vec2f &sourcedims, vec2f &delta)
13101310{
1311   renderer *d3d = dynamic_cast<renderer *>(window->m_renderer);
1311   renderer *d3d = (renderer *)window->m_drawdata;
13121312   UINT num_passes = 0;
13131313
13141314   if(options->yiq_enable)
r243409r243410
13701370
13711371void shaders::color_convolution_pass(render_target *rt, vec2f &texsize, vec2f &sourcedims)
13721372{
1373   renderer *d3d = dynamic_cast<renderer *>(window->m_renderer);
1373   renderer *d3d = (renderer *)window->m_drawdata;
13741374   UINT num_passes = 0;
13751375
13761376   curr_effect = color_effect;
r243409r243410
13981398
13991399void shaders::prescale_pass(render_target *rt, vec2f &texsize, vec2f &sourcedims)
14001400{
1401   renderer *d3d = dynamic_cast<renderer *>(window->m_renderer);
1401   renderer *d3d = (renderer *)window->m_drawdata;
14021402   UINT num_passes = 0;
14031403
14041404   curr_effect = prescale_effect;
r243409r243410
14261426
14271427void shaders::deconverge_pass(render_target *rt, vec2f &texsize, vec2f &delta, vec2f &sourcedims)
14281428{
1429   renderer *d3d = dynamic_cast<renderer *>(window->m_renderer);
1429   renderer *d3d = (renderer *)window->m_drawdata;
14301430   UINT num_passes = 0;
14311431
14321432   curr_effect = deconverge_effect;
r243409r243410
14541454
14551455void shaders::defocus_pass(render_target *rt, vec2f &texsize)
14561456{
1457   renderer *d3d = dynamic_cast<renderer *>(window->m_renderer);
1457   renderer *d3d = (renderer *)window->m_drawdata;
14581458   UINT num_passes = 0;
14591459
14601460   // Defocus pass 1
r243409r243410
15031503
15041504void shaders::phosphor_pass(render_target *rt, cache_target *ct, vec2f &texsize, bool focus_enable)
15051505{
1506   renderer *d3d = dynamic_cast<renderer *>(window->m_renderer);
1506   renderer *d3d = (renderer *)window->m_drawdata;
15071507   UINT num_passes = 0;
15081508
15091509   curr_effect = phosphor_effect;
r243409r243410
15611561
15621562void shaders::avi_post_pass(render_target *rt, vec2f &texsize, vec2f &delta, vec2f &sourcedims, poly_info *poly, int vertnum)
15631563{
1564   renderer *d3d = dynamic_cast<renderer *>(window->m_renderer);
1564   renderer *d3d = (renderer *)window->m_drawdata;
15651565   UINT num_passes = 0;
15661566
15671567   curr_effect = post_effect;
r243409r243410
16161616
16171617void shaders::screen_post_pass(render_target *rt, vec2f &texsize, vec2f &delta, vec2f &sourcedims, poly_info *poly, int vertnum)
16181618{
1619   renderer *d3d = dynamic_cast<renderer *>(window->m_renderer);
1619   renderer *d3d = (renderer *)window->m_drawdata;
16201620   UINT num_passes = 0;
16211621
16221622   curr_effect = post_effect;
r243409r243410
16501650
16511651void shaders::raster_bloom_pass(render_target *rt, vec2f &texsize, vec2f &delta, poly_info *poly, int vertnum)
16521652{
1653   renderer *d3d = dynamic_cast<renderer *>(window->m_renderer);
1653   renderer *d3d = (renderer *)window->m_drawdata;
16541654   UINT num_passes = 0;
16551655
16561656   curr_effect = downsample_effect;
r243409r243410
17551755      return;
17561756
17571757   UINT num_passes = 0;
1758   renderer *d3d = dynamic_cast<renderer *>(window->m_renderer);
1758   renderer *d3d = (renderer *)window->m_drawdata;
17591759   curr_texture = poly->get_texture();
17601760
17611761   if(PRIMFLAG_GET_SCREENTEX(d3d->get_last_texture_flags()) && curr_texture != NULL)
r243409r243410
20802080      return NULL;
20812081   }
20822082
2083   renderer *d3d = dynamic_cast<renderer *>(window->m_renderer);
2083   renderer *d3d = (renderer *)window->m_drawdata;
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 = dynamic_cast<renderer *>(window->m_renderer);
2090   renderer *d3d = (renderer *)window->m_drawdata;
20912091   if (!add_render_target(d3d, NULL, d3d->get_width(), d3d->get_height(), 1, 1))
20922092   {
20932093      vector_enable = false;
r243409r243410
22022202
22032203   enumerate_screens();
22042204
2205   renderer *d3d = dynamic_cast<renderer *>(window->m_renderer);
2205   renderer *d3d = (renderer *)window->m_drawdata;
22062206
22072207   int hlsl_prescale_x = prescale_force_x;
22082208   int hlsl_prescale_y = prescale_force_y;
r243409r243410
29942994   }
29952995
29962996   shaders *shadersys = m_shader->m_shaders;
2997   renderer *d3d = dynamic_cast<renderer *>(shadersys->window->m_renderer);
2997   renderer *d3d = (renderer *)shadersys->window->m_drawdata;
29982998   hlsl_options *options = shadersys->options;
29992999
30003000   switch(m_id)
r243409r243410
34223422   UINT32 origflags = file.openflags();
34233423
34243424   // handle defaults
3425   const char *snapname = templ ? templ : d3d->window().machine().options().snap_name();
3425   const char *snapname = templ ? templ : d3d->get_window()->machine().options().snap_name();
34263426
34273427   if (snapname == NULL || snapname[0] == 0)
34283428      snapname = "%g/%i";
r243409r243410
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->window().machine().root_device());
3472         image_interface_iterator iter(d3d->get_window()->machine().root_device());
34733473         for (device_image_interface *image = iter.first(); image != NULL; iter.next())
34743474         {
34753475            // get the device name
r243409r243410
35063506
35073507   // substitute path and gamename up front
35083508   snapstr.replace(0, "/", PATH_SEPARATOR);
3509   snapstr.replace(0, "%g", d3d->window().machine().basename());
3509   snapstr.replace(0, "%g", d3d->get_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
r243409r243410
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
4525//============================================================
4626//  PROTOTYPES
4727//============================================================
4828
4929// core functions
5030static 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);
5135
52//============================================================
53//  drawnone_create
54//============================================================
5536
56osd_renderer *drawbgfx_create(win_window_info *window)
57{
58   return global_alloc(renderer_bgfx(window));
59}
6037
6138//============================================================
6239//  drawbgfx_init
6340//============================================================
6441
65int drawbgfx_init(running_machine &machine, osd_draw_callbacks *callbacks)
42int drawbgfx_init(running_machine &machine, win_draw_callbacks *callbacks)
6643{
6744   // fill in the callbacks
6845   memset(callbacks, 0, sizeof(*callbacks));
6946   callbacks->exit = drawbgfx_exit;
70   callbacks->create = drawbgfx_create;
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;
7151   return 0;
7252}
7353
r243409r243410
8767//  drawbgfx_window_init
8868//============================================================
8969
90int renderer_bgfx::init()
70static int drawbgfx_window_init(win_window_info *window)
9171{
9272   RECT client;
93   GetClientRect(window().m_hwnd, &client);
73   GetClientRect(window->m_hwnd, &client);
9474
95   bgfx::winSetHwnd(window().m_hwnd);
75   bgfx::winSetHwnd(window->m_hwnd);
9676   bgfx::init();
9777   bgfx::reset(rect_width(&client), rect_height(&client), BGFX_RESET_VSYNC);
9878   
9979   // Enable debug text.
10080   bgfx::setDebug(BGFX_DEBUG_STATS);// BGFX_DEBUG_TEXT);
10181
82   window->m_drawdata = window->m_hwnd;
10283   return 0;
10384}
10485
r243409r243410
10889//  drawbgfx_window_destroy
10990//============================================================
11091
111void renderer_bgfx::destroy()
92static void drawbgfx_window_destroy(win_window_info *window)
11293{
11394   // Shutdown bgfx.
11495   bgfx::shutdown();
96   window->m_drawdata = NULL;
11597}
11698
11799
r243409r243410
120102//  drawbgfx_window_get_primitives
121103//============================================================
122104
123render_primitive_list *renderer_bgfx::get_primitives()
105static render_primitive_list *drawbgfx_window_get_primitives(win_window_info *window)
124106{
125107   RECT client;
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();
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();   
129111}
130112
131113
r243409r243410
134116//  drawbgfx_window_draw
135117//============================================================
136118
137int renderer_bgfx::draw(HDC dc, int update)
119static int drawbgfx_window_draw(win_window_info *window, HDC dc, int update)
138120{
139121   RECT client;
140   GetClientRect(window().m_hwnd, &client);
122   GetClientRect(window->m_hwnd, &client);
141123
142124   bgfx::setViewClear(0
143125      , BGFX_CLEAR_COLOR|BGFX_CLEAR_DEPTH
r243409r243410
152134   // if no other draw calls are submitted to view 0.
153135   bgfx::submit(0);
154136
155   window().m_primlist->acquire_lock();
137   window->m_primlist->acquire_lock();
156138
157139   // now draw
158   for (render_primitive *prim = window().m_primlist->first(); prim != NULL; prim = prim->next())
140   for (render_primitive *prim = window->m_primlist->first(); prim != NULL; prim = prim->next())
159141   {
160142      switch (prim->type)
161143      {
r243409r243410
237219      }
238220   }
239221
240   window().m_primlist->release_lock();
222   window->m_primlist->release_lock();   
241223   // Advance to next frame. Rendering thread will be kicked to
242224   // process submitted rendering primitives.
243225   bgfx::frame();
trunk/src/osd/windows/drawd3d.c
r243409r243410
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);
182189
190
183191//============================================================
184192//  drawd3d_window_init
185193//============================================================
186194
187int d3d::renderer::init()
195static int drawd3d_window_init(win_window_info *window)
188196{
189   if (!initialize())
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())
190202   {
191      destroy();
203      drawd3d_window_destroy(window);
192204      osd_printf_error("Unable to initialize Direct3D.\n");
193205      return 1;
194206   }
r243409r243410
206218      (*d3dintf->d3d.release)(d3dintf);
207219}
208220
209void d3d::renderer::toggle_fsfx()
221static void drawd3d_window_toggle_fsfx(win_window_info *window)
210222{
211   set_restarting(true);
223   d3d::renderer *d3d = (d3d::renderer *)window->m_drawdata;
224   d3d->set_restarting(true);
212225}
213226
214void d3d::renderer::record()
227static void drawd3d_window_record(win_window_info *window)
215228{
216   get_shaders()->window_record();
229   d3d::renderer *d3d = (d3d::renderer *)window->m_drawdata;
230   d3d->get_shaders()->window_record();
217231}
218232
219void d3d::renderer::save()
233static void drawd3d_window_save(win_window_info *window)
220234{
221   get_shaders()->window_save();
235   d3d::renderer *d3d = (d3d::renderer *)window->m_drawdata;
236   d3d->get_shaders()->window_save();
222237}
223238
224239
r243409r243410
227242//  drawd3d_window_destroy
228243//============================================================
229244
230void d3d::renderer::destroy()
245static void drawd3d_window_destroy(win_window_info *window)
231246{
232   if (get_shaders() != NULL && get_shaders()->recording())
233      get_shaders()->window_record();
247   d3d::renderer *d3d = (d3d::renderer *)window->m_drawdata;
234248
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;
235259}
236260
237261
r243409r243410
240264//  drawd3d_window_get_primitives
241265//============================================================
242266
243render_primitive_list *d3d::renderer::get_primitives()
267static render_primitive_list *drawd3d_window_get_primitives(win_window_info *window)
244268{
269   d3d::renderer *d3d = (d3d::renderer *)window->m_drawdata;
245270   RECT client;
246271
247   GetClientRectExceptMenu(window().m_hwnd, &client, window().m_fullscreen);
272   GetClientRectExceptMenu(window->m_hwnd, &client, window->m_fullscreen);
248273   if (rect_width(&client) > 0 && rect_height(&client) > 0)
249274   {
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());
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());
252277   }
253   return &window().m_target->get_primitives();
278   return &window->m_target->get_primitives();
254279}
255280
256//============================================================
257//  drawnone_create
258//============================================================
259
260static osd_renderer *drawd3d_create(win_window_info *window)
281int drawd3d_init(running_machine &machine, win_draw_callbacks *callbacks)
261282{
262   return global_alloc(d3d::renderer(window));
263}
264
265int drawd3d_init(running_machine &machine, osd_draw_callbacks *callbacks)
266{
267283   d3dintf = NULL;
268284
269285   // Use Direct3D9
r243409r243410
279295   // fill in the callbacks
280296   memset(callbacks, 0, sizeof(*callbacks));
281297   callbacks->exit = drawd3d_exit;
282   callbacks->create = drawd3d_create;
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;
283305   return 0;
284306}
285307
r243409r243410
287309//  drawd3d_window_draw
288310//============================================================
289311
290int d3d::renderer::draw(HDC dc, int update)
312static int drawd3d_window_draw(win_window_info *window, HDC dc, int update)
291313{
292   int check = pre_window_draw_check();
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();
293321   if (check >= 0)
294322      return check;
295323
296   begin_frame();
297   process_primitives();
298   end_frame();
324   d3d->begin_frame();
325   d3d->process_primitives();
326   d3d->end_frame();
299327
300328   return 0;
301329}
r243409r243410
468496   osd_printf_verbose("Direct3D: YUV format = %s\n", (m_yuv_format == D3DFMT_YUY2) ? "YUY2" : (m_yuv_format == D3DFMT_UYVY) ? "UYVY" : "RGB");
469497
470498   // set the max texture size
471   d3d->window().m_target->set_max_texture_size(m_texture_max_width, m_texture_max_height);
499   d3d->get_window()->m_target->set_max_texture_size(m_texture_max_width, m_texture_max_height);
472500   osd_printf_verbose("Direct3D: Max texture size = %dx%d\n", (int)m_texture_max_width, (int)m_texture_max_height);
473501}
474502
r243409r243410
480508{
481509   // experimental: load a PNG to use for vector rendering; it is treated
482510   // as a brightness map
483   emu_file file(m_renderer->window().machine().options().art_path(), OPEN_FLAG_READ);
511   emu_file file(m_renderer->get_window()->machine().options().art_path(), OPEN_FLAG_READ);
484512   render_load_png(m_vector_bitmap, file, NULL, "vector.png");
485513   if (m_vector_bitmap.valid())
486514   {
r243409r243410
622650}
623651
624652renderer::renderer(win_window_info *window)
625   : osd_renderer(window, FLAG_NONE)
626653{
627654   m_device = NULL;
628655   m_restarting = false;
656   m_window = window;
629657   m_shaders = NULL;
630658   m_numverts = 0;
631659   m_numpolys = 0;
r243409r243410
644672      return false;
645673
646674   // create the device immediately for the full screen case (defer for window mode)
647   if (window().m_fullscreen && device_create())
675   if (m_window->m_fullscreen && device_create())
648676      return false;
649677
650678   return true;
r243409r243410
653681int renderer::pre_window_draw_check()
654682{
655683   // if we're in the middle of resizing, leave things alone
656   if (window().m_resize_state == RESIZE_STATE_RESIZING)
684   if (m_window->m_resize_state == RESIZE_STATE_RESIZING)
657685      return 0;
658686
659687   // if we're restarting the renderer, leave things alone
r243409r243410
678706   }
679707
680708   // in window mode, we need to track the window size
681   if (!window().m_fullscreen || m_device == NULL)
709   if (!m_window->m_fullscreen || m_device == NULL)
682710   {
683711      // if the size changes, skip this update since the render target will be out of date
684712      if (update_window_size())
r243409r243410
694722
695723void texture_manager::update_textures()
696724{
697   for (render_primitive *prim = m_renderer->window().m_primlist->first(); prim != NULL; prim = prim->next())
725   for (render_primitive *prim = m_renderer->get_window()->m_primlist->first(); prim != NULL; prim = prim->next())
698726   {
699727      if (prim->texture.base != NULL)
700728      {
r243409r243410
731759
732760   m_shaders->begin_frame();
733761
734   window().m_primlist->acquire_lock();
762   m_window->m_primlist->acquire_lock();
735763
736764   // first update any textures
737765   m_texture_manager->update_textures();
r243409r243410
752780   m_line_count = 0;
753781
754782   // loop over primitives
755   for (render_primitive *prim = window().m_primlist->first(); prim != NULL; prim = prim->next())
783   for (render_primitive *prim = m_window->m_primlist->first(); prim != NULL; prim = prim->next())
756784      if (prim->type == render_primitive::LINE && PRIMFLAG_GET_VECTOR(prim->flags))
757785         m_line_count++;
758786}
r243409r243410
760788void renderer::process_primitives()
761789{
762790   // Rotating index for vector time offsets
763   for (render_primitive *prim = window().m_primlist->first(); prim != NULL; prim = prim->next())
791   for (render_primitive *prim = m_window->m_primlist->first(); prim != NULL; prim = prim->next())
764792   {
765793      switch (prim->type)
766794      {
r243409r243410
790818
791819void renderer::end_frame()
792820{
793   window().m_primlist->release_lock();
821   m_window->m_primlist->release_lock();
794822
795823   // flush any pending polygons
796824   primitive_flush_pending();
r243409r243410
865893   m_presentation.BackBufferCount               = video_config.triplebuf ? 2 : 1;
866894   m_presentation.MultiSampleType               = D3DMULTISAMPLE_NONE;
867895   m_presentation.SwapEffect                    = D3DSWAPEFFECT_DISCARD;
868   m_presentation.hDeviceWindow                 = window().m_hwnd;
869   m_presentation.Windowed                      = !window().m_fullscreen || win_has_menu(&window());
896   m_presentation.hDeviceWindow                 = m_window->m_hwnd;
897   m_presentation.Windowed                      = !m_window->m_fullscreen || win_has_menu(m_window);
870898   m_presentation.EnableAutoDepthStencil        = FALSE;
871899   m_presentation.AutoDepthStencilFormat        = D3DFMT_D16;
872900   m_presentation.Flags                         = 0;
873901   m_presentation.FullScreen_RefreshRateInHz    = m_refresh;
874   m_presentation.PresentationInterval          = ((video_config.triplebuf && window().m_fullscreen) ||
902   m_presentation.PresentationInterval          = ((video_config.triplebuf && m_window->m_fullscreen) ||
875903                                       video_config.waitvsync || video_config.syncrefresh) ?
876904                                       D3DPRESENT_INTERVAL_ONE : D3DPRESENT_INTERVAL_IMMEDIATE;
877905
878906   // create the D3D device
879   result = (*d3dintf->d3d.create_device)(d3dintf, m_adapter, D3DDEVTYPE_HAL, window().m_focus_hwnd,
907   result = (*d3dintf->d3d.create_device)(d3dintf, m_adapter, D3DDEVTYPE_HAL, m_window->m_focus_hwnd,
880908               D3DCREATE_SOFTWARE_VERTEXPROCESSING | D3DCREATE_FPU_PRESERVE, &m_presentation, &m_device);
881909   if (result != D3D_OK)
882910   {
r243409r243410
899927   osd_printf_verbose("Direct3D: Device created at %dx%d\n", m_width, m_height);
900928
901929   // set the gamma if we need to
902   if (window().m_fullscreen)
930   if (m_window->m_fullscreen)
903931   {
904932      // only set the gamma if it's not 1.0f
905      windows_options &options = downcast<windows_options &>(window().machine().options());
933      windows_options &options = downcast<windows_options &>(m_window->machine().options());
906934      float brightness = options.full_screen_brightness();
907935      float contrast = options.full_screen_contrast();
908936      float gamma = options.full_screen_gamma();
r243409r243410
10641092   int retval = 0;
10651093
10661094   m_shaders = global_alloc_clear(shaders);
1067   m_shaders->init(d3dintf, &window());
1095   m_shaders->init(d3dintf, m_window);
10681096
10691097   DWORD tempcaps;
10701098   HRESULT result = (*d3dintf->d3d.get_caps_dword)(d3dintf, m_adapter, D3DDEVTYPE_HAL, CAPS_MAX_PS30_INSN_SLOTS, &tempcaps);
r243409r243410
12031231   }
12041232
12051233   // choose a resolution: window mode case
1206   if (!window().m_fullscreen || !video_config.switchres || win_has_menu(&window()))
1234   if (!m_window->m_fullscreen || !video_config.switchres || win_has_menu(m_window))
12071235   {
12081236      RECT client;
12091237
12101238      // bounds are from the window client rect
1211      GetClientRectExceptMenu(window().m_hwnd, &client, window().m_fullscreen);
1239      GetClientRectExceptMenu(m_window->m_hwnd, &client, m_window->m_fullscreen);
12121240      m_width = client.right - client.left;
12131241      m_height = client.bottom - client.top;
12141242
r243409r243410
12191247      // make sure it's a pixel format we can get behind
12201248      if (m_pixformat != D3DFMT_X1R5G5B5 && m_pixformat != D3DFMT_R5G6B5 && m_pixformat != D3DFMT_X8R8G8B8)
12211249      {
1222         char *utf8_device = utf8_from_tstring(window().m_monitor->info.szDevice);
1250         char *utf8_device = utf8_from_tstring(m_window->m_monitor->info.szDevice);
12231251         if (utf8_device != NULL)
12241252         {
12251253            osd_printf_error("Device %s currently in an unsupported mode\n", utf8_device);
r243409r243410
12441272   }
12451273
12461274   // see if we can handle the device type
1247   result = (*d3dintf->d3d.check_device_type)(d3dintf, m_adapter, D3DDEVTYPE_HAL, m_pixformat, m_pixformat, !window().m_fullscreen);
1275   result = (*d3dintf->d3d.check_device_type)(d3dintf, m_adapter, D3DDEVTYPE_HAL, m_pixformat, m_pixformat, !m_window->m_fullscreen);
12481276   if (result != D3D_OK)
12491277   {
1250      char *utf8_device = utf8_from_tstring(window().m_monitor->info.szDevice);
1278      char *utf8_device = utf8_from_tstring(m_window->m_monitor->info.szDevice);
12511279      if (utf8_device != NULL)
12521280      {
12531281         osd_printf_error("Proposed video mode not supported on device %s\n", utf8_device);
r243409r243410
12751303      HMONITOR curmonitor = (*d3dintf->d3d.get_adapter_monitor)(d3dintf, adapternum);
12761304
12771305      // if we match the proposed monitor, this is it
1278      if (curmonitor == window().m_monitor->handle)
1306      if (curmonitor == m_window->m_monitor->handle)
12791307      {
12801308         return adapternum;
12811309      }
r243409r243410
12981326   float best_score = 0.0f;
12991327
13001328   // determine the refresh rate of the primary screen
1301   const screen_device *primary_screen = window().machine().config().first_screen();
1329   const screen_device *primary_screen = m_window->machine().config().first_screen();
13021330   if (primary_screen != NULL)
13031331   {
13041332      target_refresh = ATTOSECONDS_TO_HZ(primary_screen->refresh_attoseconds());
r243409r243410
13081336   // note: technically we should not be calling this from an alternate window
13091337   // thread; however, it is only done during init time, and the init code on
13101338   // the main thread is waiting for us to finish, so it is safe to do so here
1311   window().m_target->compute_minimum_size(minwidth, minheight);
1339   m_window->m_target->compute_minimum_size(minwidth, minheight);
13121340
13131341   // use those as the target for now
13141342   INT32 target_width = minwidth;
r243409r243410
13431371         size_score *= 0.1f;
13441372
13451373      // if we're looking for a particular mode, that's a winner
1346      if (mode.Width == window().m_maxwidth && mode.Height == window().m_maxheight)
1374      if (mode.Width == m_window->m_maxwidth && mode.Height == m_window->m_maxheight)
13471375         size_score = 2.0f;
13481376
13491377      // compute refresh score
r243409r243410
13541382         refresh_score *= 0.1f;
13551383
13561384      // if we're looking for a particular refresh, make sure it matches
1357      if (mode.RefreshRate == window().m_refresh)
1385      if (mode.RefreshRate == m_window->m_refresh)
13581386         refresh_score = 2.0f;
13591387
13601388      // weight size and refresh equally
r243409r243410
13841412{
13851413   // get the current window bounds
13861414   RECT client;
1387   GetClientRectExceptMenu(window().m_hwnd, &client, window().m_fullscreen);
1415   GetClientRectExceptMenu(m_window->m_hwnd, &client, m_window->m_fullscreen);
13881416
13891417   // if we have a device and matching width/height, nothing to do
13901418   if (m_device != NULL && rect_width(&client) == m_width && rect_height(&client) == m_height)
13911419   {
13921420      // clear out any pending resizing if the area didn't change
1393      if (window().m_resize_state == RESIZE_STATE_PENDING)
1394         window().m_resize_state = RESIZE_STATE_NORMAL;
1421      if (m_window->m_resize_state == RESIZE_STATE_PENDING)
1422         m_window->m_resize_state = RESIZE_STATE_NORMAL;
13951423      return FALSE;
13961424   }
13971425
13981426   // if we're in the middle of resizing, leave it alone as well
1399   if (window().m_resize_state == RESIZE_STATE_RESIZING)
1427   if (m_window->m_resize_state == RESIZE_STATE_RESIZING)
14001428      return FALSE;
14011429
14021430   // set the new bounds and create the device again
r243409r243410
14061434      return FALSE;
14071435
14081436   // reset the resize state to normal, and indicate we made a change
1409   window().m_resize_state = RESIZE_STATE_NORMAL;
1437   m_window->m_resize_state = RESIZE_STATE_NORMAL;
14101438   return TRUE;
14111439}
14121440
r243409r243410
14161444
14171445void renderer::batch_vectors()
14181446{
1419   windows_options &options = downcast<windows_options &>(window().machine().options());
1447   windows_options &options = downcast<windows_options &>(m_window->machine().options());
14201448
14211449   int vector_size = (options.antialias() ? 24 : 6);
14221450   m_vectorbatch = mesh_alloc(m_line_count * vector_size);
r243409r243410
14261454   int line_index = 0;
14271455   float period = options.screen_vector_time_period();
14281456   UINT32 cached_flags = 0;
1429   for (render_primitive *prim = window().m_primlist->first(); prim != NULL; prim = prim->next())
1457   for (render_primitive *prim = m_window->m_primlist->first(); prim != NULL; prim = prim->next())
14301458   {
14311459      switch (prim->type)
14321460      {
trunk/src/osd/windows/drawd3d.h
r243409r243410
9595};
9696
9797/* renderer is the information about Direct3D for the current screen */
98class renderer : public osd_renderer
98class renderer
9999{
100100public:
101   //renderer() { }
101   renderer() { }
102102   renderer(win_window_info *window);
103   virtual ~renderer();
103   ~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
113105   int                     initialize();
114106
115107   int                     device_create();
r243409r243410
156148   int                     get_height() { return m_height; }
157149   int                     get_refresh() { return m_refresh; }
158150
151   win_window_info *       get_window() { return m_window; }
152
159153   device *                get_device() { return m_device; }
160154   present_parameters *    get_presentation() { return &m_presentation; }
161155
r243409r243410
187181   int                     m_refresh;                  // current refresh rate
188182   int                     m_create_error_count;       // number of consecutive create errors
189183
184   win_window_info *       m_window;                     // current window info
185
190186   device *                m_device;                   // pointer to the Direct3DDevice object
191187   int                     m_gamma_supported;          // is full screen gamma supported?
192188   present_parameters      m_presentation;             // set of presentation parameters
trunk/src/osd/windows/drawdd.c
r243409r243410
3636
3737
3838/* dd_info is the information about DirectDraw for the current screen */
39class renderer_dd : public osd_renderer
39struct dd_info
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
10441   GUID                    adapter;                    // current display adapter
10542   GUID *                  adapter_ptr;                // pointer to current display adapter
43   int                     width, height;              // current width, height
44   int                     refresh;                    // current refresh rate
10645   int                     clearouter;                 // clear the outer areas?
10746
10847   INT32                   blitwidth, blitheight;      // current blit width/height values
r243409r243410
14079/* mode_enum_info holds information during a display mode enumeration */
14180struct mode_enum_info
14281{
143   win_window_info *      window;
82   win_window_info *       window;
14483   INT32                   minimum_width, minimum_height;
14584   INT32                   target_width, target_height;
14685   double                  target_refresh;
r243409r243410
163102//  INLINES
164103//============================================================
165104
166inline void renderer_dd::update_outer_rects()
105INLINE void update_outer_rects(dd_info *dd)
167106{
168   clearouter = (back != NULL) ? 3 : 1;
107   dd->clearouter = (dd->back != NULL) ? 3 : 1;
169108}
170109
171110
r243409r243410
184123
185124// core functions
186125static 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);
187130
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);
188140
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);
189144
190//============================================================
191//  drawnone_create
192//============================================================
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);
193149
194static osd_renderer *drawdd_create(win_window_info *window)
195{
196   return global_alloc(renderer_dd(window));
197}
198150
199151
200152//============================================================
201153//  drawdd_init
202154//============================================================
203155
204int drawdd_init(running_machine &machine, osd_draw_callbacks *callbacks)
156int drawdd_init(running_machine &machine, win_draw_callbacks *callbacks)
205157{
206158   // dynamically grab the create function from ddraw.dll
207159   dllhandle = LoadLibrary(TEXT("ddraw.dll"));
r243409r243410
234186   // fill in the callbacks
235187   memset(callbacks, 0, sizeof(*callbacks));
236188   callbacks->exit = drawdd_exit;
237   callbacks->create = drawdd_create;
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;
238193
239194   osd_printf_verbose("DirectDraw: Using DirectDraw 7\n");
240195   return 0;
r243409r243410
258213//  drawdd_window_init
259214//============================================================
260215
261int renderer_dd::init()
216static int drawdd_window_init(win_window_info *window)
262217{
218   dd_info *dd;
219
220   // allocate memory for our structures
221   dd = global_alloc_clear(dd_info);
222   window->m_drawdata = dd;
223
263224   // configure the adapter for the mode we want
264   if (config_adapter_mode())
225   if (config_adapter_mode(window))
265226      goto error;
266227
267228   // create the ddraw object
268   if (ddraw_create())
229   if (ddraw_create(window))
269230      goto error;
270231
271232   return 0;
272233
273234error:
274   destroy();
235   drawdd_window_destroy(window);
275236   osd_printf_error("Unable to initialize DirectDraw.\n");
276237   return 1;
277238}
r243409r243410
282243//  drawdd_window_destroy
283244//============================================================
284245
285void renderer_dd::destroy()
246static void drawdd_window_destroy(win_window_info *window)
286247{
248   dd_info *dd = (dd_info *)window->m_drawdata;
249
250   // skip if nothing
251   if (dd == NULL)
252      return;
253
287254   // delete the ddraw object
288   ddraw_delete();
255   ddraw_delete(window);
256
257   // free the memory in the window
258   global_free(dd);
259   window->m_drawdata = NULL;
289260}
290261
291262
r243409r243410
294265//  drawdd_window_get_primitives
295266//============================================================
296267
297render_primitive_list *renderer_dd::get_primitives()
268static render_primitive_list *drawdd_window_get_primitives(win_window_info *window)
298269{
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);
270   dd_info *dd = (dd_info *)window->m_drawdata;
302271
303   return &window().m_target->get_primitives();
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();
304277}
305278
306279
r243409r243410
309282//  drawdd_window_draw
310283//============================================================
311284
312int renderer_dd::draw(HDC dc, int update)
285static int drawdd_window_draw(win_window_info *window, HDC dc, int update)
313286{
287   dd_info *dd = (dd_info *)window->m_drawdata;
314288   render_primitive *prim;
315289   int usemembuffer = FALSE;
316290   HRESULT result;
317291
292   // if we haven't been created, just punt
293   if (dd == NULL)
294      return 1;
295
318296   // if we're updating, remember to erase the outer stuff
319297   if (update)
320      update_outer_rects();
298      update_outer_rects(dd);
321299
322300   // if we have a ddraw object, check the cooperative level
323   if (ddraw_test_cooperative())
301   if (ddraw_test_cooperative(window))
324302      return 1;
325303
326304   // get the size; if we're too small, delete the existing surfaces
327   if (blitwidth > blitdesc.dwWidth || blitheight > blitdesc.dwHeight)
328      ddraw_delete_surfaces();
305   if (dd->blitwidth > dd->blitdesc.dwWidth || dd->blitheight > dd->blitdesc.dwHeight)
306      ddraw_delete_surfaces(window);
329307
330308   // if we need to create surfaces, do it now
331   if (blit == NULL && ddraw_create_surfaces() != 0)
309   if (dd->blit == NULL && ddraw_create_surfaces(window) != 0)
332310      return 1;
333311
334312   // select our surface and lock it
335   result = IDirectDrawSurface7_Lock(blit, NULL, &blitdesc, DDLOCK_WAIT, NULL);
313   result = IDirectDrawSurface7_Lock(dd->blit, NULL, &dd->blitdesc, DDLOCK_WAIT, NULL);
336314   if (result == DDERR_SURFACELOST)
337315   {
338316      osd_printf_verbose("DirectDraw: Lost surfaces; deleting and retrying next frame\n");
339      ddraw_delete_surfaces();
317      ddraw_delete_surfaces(window);
340318      return 1;
341319   }
342320   if (result != DD_OK)
r243409r243410
346324   }
347325
348326   // render to it
349   window().m_primlist->acquire_lock();
327   window->m_primlist->acquire_lock();
350328
351329   // scan the list of primitives for tricky stuff
352   for (prim = window().m_primlist->first(); prim != NULL; prim = prim->next())
330   for (prim = window->m_primlist->first(); prim != NULL; prim = prim->next())
353331      if (PRIMFLAG_GET_BLENDMODE(prim->flags) != BLENDMODE_NONE ||
354332         (prim->texture.base != NULL && PRIMFLAG_GET_TEXFORMAT(prim->flags) == TEXFORMAT_ARGB32))
355333      {
r243409r243410
363341      int x, y;
364342
365343      // based on the target format, use one of our standard renderers
366      switch (blitdesc.ddpfPixelFormat.dwRBitMask)
344      switch (dd->blitdesc.ddpfPixelFormat.dwRBitMask)
367345      {
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;
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;
372350         default:
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);
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);
374352            break;
375353      }
376354
377355      // handle copying to both 16bpp and 32bpp destinations
378      for (y = 0; y < blitheight; y++)
356      for (y = 0; y < dd->blitheight; y++)
379357      {
380         if (blitdesc.ddpfPixelFormat.dwRGBBitCount == 32)
358         if (dd->blitdesc.ddpfPixelFormat.dwRGBBitCount == 32)
381359         {
382            UINT32 *src = (UINT32 *)membuffer + y * blitwidth;
383            UINT32 *dst = (UINT32 *)((UINT8 *)blitdesc.lpSurface + y * blitdesc.lPitch);
384            for (x = 0; x < blitwidth; x++)
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++)
385363               *dst++ = *src++;
386364         }
387         else if (blitdesc.ddpfPixelFormat.dwRGBBitCount == 16)
365         else if (dd->blitdesc.ddpfPixelFormat.dwRGBBitCount == 16)
388366         {
389            UINT16 *src = (UINT16 *)membuffer + y * blitwidth;
390            UINT16 *dst = (UINT16 *)((UINT8 *)blitdesc.lpSurface + y * blitdesc.lPitch);
391            for (x = 0; x < blitwidth; x++)
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++)
392370               *dst++ = *src++;
393371         }
394372      }
r243409r243410
399377   else
400378   {
401379      // based on the target format, use one of our standard renderers
402      switch (blitdesc.ddpfPixelFormat.dwRBitMask)
380      switch (dd->blitdesc.ddpfPixelFormat.dwRBitMask)
403381      {
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;
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;
408386         default:
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);
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);
410388            break;
411389      }
412390   }
413   window().m_primlist->release_lock();
391   window->m_primlist->release_lock();
414392
415393   // unlock and blit
416   result = IDirectDrawSurface7_Unlock(blit, NULL);
394   result = IDirectDrawSurface7_Unlock(dd->blit, NULL);
417395   if (result != DD_OK) osd_printf_verbose("DirectDraw: Error %08X unlocking blit surface\n", (int)result);
418396
419397   // sync to VBLANK
420   if ((video_config.waitvsync || video_config.syncrefresh) && window().machine().video().throttled() && (!window().m_fullscreen || back == NULL))
398   if ((video_config.waitvsync || video_config.syncrefresh) && window->machine().video().throttled() && (!window->m_fullscreen || dd->back == NULL))
421399   {
422      result = IDirectDraw7_WaitForVerticalBlank(ddraw, DDWAITVB_BLOCKBEGIN, NULL);
400      result = IDirectDraw7_WaitForVerticalBlank(dd->ddraw, DDWAITVB_BLOCKBEGIN, NULL);
423401      if (result != DD_OK) osd_printf_verbose("DirectDraw: Error %08X waiting for VBLANK\n", (int)result);
424402   }
425403
426404   // complete the blitting
427   blit_to_primary(blitwidth, blitheight);
405   blit_to_primary(window, dd->blitwidth, dd->blitheight);
428406   return 0;
429407}
430408
r243409r243410
434412//  ddraw_create
435413//============================================================
436414
437int renderer_dd::ddraw_create()
415static int ddraw_create(win_window_info *window)
438416{
417   dd_info *dd = (dd_info *)window->m_drawdata;
439418   HRESULT result;
440419   int verify;
441420
442421   // if a device exists, free it
443   if (ddraw != NULL)
444      ddraw_delete();
422   if (dd->ddraw != NULL)
423      ddraw_delete(window);
445424
446425   // create the DirectDraw object
447   result = (*directdrawcreateex)(adapter_ptr, (LPVOID *)&ddraw, WRAP_REFIID(IID_IDirectDraw7), NULL);
426   result = (*directdrawcreateex)(dd->adapter_ptr, (LPVOID *)&dd->ddraw, WRAP_REFIID(IID_IDirectDraw7), NULL);
448427   if (result != DD_OK)
449428   {
450429      osd_printf_verbose("DirectDraw: Error %08X during DirectDrawCreateEx call\n", (int)result);
r243409r243410
452431   }
453432
454433   // verify the caps
455   verify = ddraw_verify_caps();
434   verify = ddraw_verify_caps(dd);
456435   if (verify == 2)
457436   {
458437      osd_printf_error("DirectDraw: Error - Device does not meet minimum requirements for DirectDraw rendering\n");
r243409r243410
463442
464443   // set the cooperative level
465444   // for non-window modes, we will use full screen here
466   result = IDirectDraw7_SetCooperativeLevel(ddraw, win_window_list->m_hwnd, DDSCL_SETFOCUSWINDOW);
445   result = IDirectDraw7_SetCooperativeLevel(dd->ddraw, win_window_list->m_hwnd, DDSCL_SETFOCUSWINDOW);
467446   if (result != DD_OK)
468447   {
469448      osd_printf_verbose("DirectDraw: Error %08X during IDirectDraw7_SetCooperativeLevel(FOCUSWINDOW) call\n", (int)result);
470449      goto error;
471450   }
472   result = IDirectDraw7_SetCooperativeLevel(ddraw, window().m_hwnd, DDSCL_SETDEVICEWINDOW | (window().m_fullscreen ? DDSCL_FULLSCREEN | DDSCL_EXCLUSIVE : DDSCL_NORMAL));
451   result = IDirectDraw7_SetCooperativeLevel(dd->ddraw, window->m_hwnd, DDSCL_SETDEVICEWINDOW | (window->m_fullscreen ? DDSCL_FULLSCREEN | DDSCL_EXCLUSIVE : DDSCL_NORMAL));
473452   if (result != DD_OK)
474453   {
475454      osd_printf_verbose("DirectDraw: Error %08X during IDirectDraw7_SetCooperativeLevel(DEVICEWINDOW) call\n", (int)result);
r243409r243410
477456   }
478457
479458   // full screen mode: set the resolution
480   if (window().m_fullscreen && video_config.switchres)
459   if (window->m_fullscreen && video_config.switchres)
481460   {
482      result = IDirectDraw7_SetDisplayMode(ddraw, width, height, 32, refresh, 0);
461      result = IDirectDraw7_SetDisplayMode(dd->ddraw, dd->width, dd->height, 32, dd->refresh, 0);
483462      if (result != DD_OK)
484463      {
485         osd_printf_verbose("DirectDraw: Error %08X attempting to set video mode %dx%d@%d call\n", (int)result, width, height, refresh);
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);
486465         goto error;
487466      }
488467   }
489468
490   return ddraw_create_surfaces();
469   return ddraw_create_surfaces(window);
491470
492471error:
493   ddraw_delete();
472   ddraw_delete(window);
494473   return 1;
495474}
496475
r243409r243410
500479//  ddraw_create_surfaces
501480//============================================================
502481
503int renderer_dd::ddraw_create_surfaces()
482static int ddraw_create_surfaces(win_window_info *window)
504483{
484   dd_info *dd = (dd_info *)window->m_drawdata;
505485   HRESULT result;
506486
507487   // make a description of the primary surface
508   memset(&primarydesc, 0, sizeof(primarydesc));
509   primarydesc.dwSize = sizeof(primarydesc);
510   primarydesc.dwFlags = DDSD_CAPS;
511   primarydesc.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
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;
512492
513493   // for triple-buffered full screen mode, allocate flipping surfaces
514   if (window().m_fullscreen && video_config.triplebuf)
494   if (window->m_fullscreen && video_config.triplebuf)
515495   {
516      primarydesc.dwFlags |= DDSD_BACKBUFFERCOUNT;
517      primarydesc.ddsCaps.dwCaps |= DDSCAPS_FLIP | DDSCAPS_COMPLEX;
518      primarydesc.dwBackBufferCount = 2;
496      dd->primarydesc.dwFlags |= DDSD_BACKBUFFERCOUNT;
497      dd->primarydesc.ddsCaps.dwCaps |= DDSCAPS_FLIP | DDSCAPS_COMPLEX;
498      dd->primarydesc.dwBackBufferCount = 2;
519499   }
520500
521501   // create the primary surface and report errors
522   result = create_surface(&primarydesc, &primary, "primary");
502   result = create_surface(dd, &dd->primarydesc, &dd->primary, "primary");
523503   if (result != DD_OK) goto error;
524504
525505   // full screen mode: get the back surface
526   back = NULL;
527   if (window().m_fullscreen && video_config.triplebuf)
506   dd->back = NULL;
507   if (window->m_fullscreen && video_config.triplebuf)
528508   {
529509      DDSCAPS2 caps = { DDSCAPS_BACKBUFFER };
530      result = IDirectDrawSurface7_GetAttachedSurface(primary, &caps, &back);
510      result = IDirectDrawSurface7_GetAttachedSurface(dd->primary, &caps, &dd->back);
531511      if (result != DD_OK)
532512      {
533513         osd_printf_verbose("DirectDraw: Error %08X getting attached back surface\n", (int)result);
r243409r243410
536516   }
537517
538518   // now make a description of our blit surface, based on the primary surface
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;
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;
546526
547527   // then create the blit surface, fall back to system memory if video mem doesn't work
548   result = create_surface(&blitdesc, &blit, "blit");
528   result = create_surface(dd, &dd->blitdesc, &dd->blit, "blit");
549529   if (result != DD_OK)
550530   {
551      blitdesc.ddsCaps.dwCaps = DDSCAPS_SYSTEMMEMORY;
552      result = create_surface(&blitdesc, &blit, "blit");
531      dd->blitdesc.ddsCaps.dwCaps = DDSCAPS_SYSTEMMEMORY;
532      result = create_surface(dd, &dd->blitdesc, &dd->blit, "blit");
553533   }
554534   if (result != DD_OK) goto error;
555535
556536   // create a memory buffer for offscreen drawing
557   if (membuffersize < blitwidth * blitheight * 4)
537   if (dd->membuffersize < dd->blitwidth * dd->blitheight * 4)
558538   {
559      membuffersize = blitwidth * blitheight * 4;
560      global_free_array(membuffer);
561      membuffer = global_alloc_array(UINT8, membuffersize);
539      dd->membuffersize = dd->blitwidth * dd->blitheight * 4;
540      global_free_array(dd->membuffer);
541      dd->membuffer = global_alloc_array(UINT8, dd->membuffersize);
562542   }
563   if (membuffer == NULL)
543   if (dd->membuffer == NULL)
564544      goto error;
565545
566546   // create a clipper for windowed mode
567   if (!window().m_fullscreen && create_clipper())
547   if (!window->m_fullscreen && create_clipper(window))
568548      goto error;
569549
570550   // full screen mode: set the gamma
571   if (window().m_fullscreen)
551   if (window->m_fullscreen)
572552   {
573553      // only set the gamma if it's not 1.0f
574      windows_options &options = downcast<windows_options &>(window().machine().options());
554      windows_options &options = downcast<windows_options &>(window->machine().options());
575555      float brightness = options.full_screen_brightness();
576556      float contrast = options.full_screen_contrast();
577      float fgamma = options.full_screen_gamma();
578      if (brightness != 1.0f || contrast != 1.0f || fgamma != 1.0f)
557      float gamma = options.full_screen_gamma();
558      if (brightness != 1.0f || contrast != 1.0f || gamma != 1.0f)
579559      {
580560         // see if we can get a GammaControl object
581         result = IDirectDrawSurface_QueryInterface(primary, WRAP_REFIID(IID_IDirectDrawGammaControl), (void **)&gamma);
561         result = IDirectDrawSurface_QueryInterface(dd->primary, WRAP_REFIID(IID_IDirectDrawGammaControl), (void **)&dd->gamma);
582562         if (result != DD_OK)
583563         {
584564            osd_printf_warning("DirectDraw: Warning - device does not support full screen gamma correction.\n");
585            this->gamma = NULL;
565            dd->gamma = NULL;
586566         }
587567
588568         // proceed if we can
589         if (this->gamma != NULL)
569         if (dd->gamma != NULL)
590570         {
591571            DDGAMMARAMP ramp;
592572            int i;
593573
594574            // create a standard ramp and set it
595575            for (i = 0; i < 256; i++)
596               ramp.red[i] = ramp.green[i] = ramp.blue[i] = apply_brightness_contrast_gamma(i, brightness, contrast, fgamma) << 8;
576               ramp.red[i] = ramp.green[i] = ramp.blue[i] = apply_brightness_contrast_gamma(i, brightness, contrast, gamma) << 8;
597577
598578            // attempt to set it
599            result = IDirectDrawGammaControl_SetGammaRamp(this->gamma, 0, &ramp);
579            result = IDirectDrawGammaControl_SetGammaRamp(dd->gamma, 0, &ramp);
600580            if (result != DD_OK)
601581               osd_printf_verbose("DirectDraw: Error %08X attempting to set gamma correction.\n", (int)result);
602582         }
r243409r243410
604584   }
605585
606586   // force some updates
607   update_outer_rects();
587   update_outer_rects(dd);
608588   return 0;
609589
610590error:
611   ddraw_delete_surfaces();
591   ddraw_delete_surfaces(window);
612592   return 1;
613593}
614594
r243409r243410
618598//  ddraw_delete
619599//============================================================
620600
621void renderer_dd::ddraw_delete()
601static void ddraw_delete(win_window_info *window)
622602{
603   dd_info *dd = (dd_info *)window->m_drawdata;
604
623605   // free surfaces
624   ddraw_delete_surfaces();
606   ddraw_delete_surfaces(window);
625607
626608   // restore resolutions
627   if (ddraw != NULL)
628      IDirectDraw7_RestoreDisplayMode(ddraw);
609   if (dd->ddraw != NULL)
610      IDirectDraw7_RestoreDisplayMode(dd->ddraw);
629611
630612   // reset cooperative level
631   if (ddraw != NULL && window().m_hwnd != NULL)
632      IDirectDraw7_SetCooperativeLevel(ddraw, window().m_hwnd, DDSCL_NORMAL);
613   if (dd->ddraw != NULL && window->m_hwnd != NULL)
614      IDirectDraw7_SetCooperativeLevel(dd->ddraw, window->m_hwnd, DDSCL_NORMAL);
633615
634616   // release the DirectDraw object itself
635   if (ddraw != NULL)
636      IDirectDraw7_Release(ddraw);
637   ddraw = NULL;
617   if (dd->ddraw != NULL)
618      IDirectDraw7_Release(dd->ddraw);
619   dd->ddraw = NULL;
638620}
639621
640622
r243409r243410
643625//  ddraw_delete_surfaces
644626//============================================================
645627
646void renderer_dd::ddraw_delete_surfaces()
628static void ddraw_delete_surfaces(win_window_info *window)
647629{
630   dd_info *dd = (dd_info *)window->m_drawdata;
631
648632   // release the gamma control
649   if (gamma != NULL)
650      IDirectDrawGammaControl_Release(gamma);
651   gamma = NULL;
633   if (dd->gamma != NULL)
634      IDirectDrawGammaControl_Release(dd->gamma);
635   dd->gamma = NULL;
652636
653637   // release the clipper
654   if (clipper != NULL)
655      IDirectDrawClipper_Release(clipper);
656   clipper = NULL;
638   if (dd->clipper != NULL)
639      IDirectDrawClipper_Release(dd->clipper);
640   dd->clipper = NULL;
657641
658642   // free the memory buffer
659   global_free_array(membuffer);
660   membuffer = NULL;
661   membuffersize = 0;
643   global_free_array(dd->membuffer);
644   dd->membuffer = NULL;
645   dd->membuffersize = 0;
662646
663647   // release the blit surface
664   if (blit != NULL)
665      IDirectDrawSurface7_Release(blit);
666   blit = NULL;
648   if (dd->blit != NULL)
649      IDirectDrawSurface7_Release(dd->blit);
650   dd->blit = NULL;
667651
668652   // release the back surface
669   if (back != NULL)
670      IDirectDrawSurface7_Release(back);
671   back = NULL;
653   if (dd->back != NULL)
654      IDirectDrawSurface7_Release(dd->back);
655   dd->back = NULL;
672656
673657   // release the primary surface
674   if (primary != NULL)
675      IDirectDrawSurface7_Release(primary);
676   primary = NULL;
658   if (dd->primary != NULL)
659      IDirectDrawSurface7_Release(dd->primary);
660   dd->primary = NULL;
677661}
678662
679663
r243409r243410
682666//  ddraw_verify_caps
683667//============================================================
684668
685int renderer_dd::ddraw_verify_caps()
669static int ddraw_verify_caps(dd_info *dd)
686670{
687671   int retval = 0;
688672   HRESULT result;
689673
690674   // get the capabilities
691   ddcaps.dwSize = sizeof(ddcaps);
692   helcaps.dwSize = sizeof(helcaps);
693   result = IDirectDraw7_GetCaps(ddraw, &ddcaps, &helcaps);
675   dd->ddcaps.dwSize = sizeof(dd->ddcaps);
676   dd->helcaps.dwSize = sizeof(dd->helcaps);
677   result = IDirectDraw7_GetCaps(dd->ddraw, &dd->ddcaps, &dd->helcaps);
694678   if (result != DD_OK)
695679   {
696680      osd_printf_verbose("DirectDraw: Error %08X during IDirectDraw7_GetCaps call\n", (int)result);
r243409r243410
698682   }
699683
700684   // determine if hardware stretching is available
701   if ((ddcaps.dwCaps & DDCAPS_BLTSTRETCH) == 0)
685   if ((dd->ddcaps.dwCaps & DDCAPS_BLTSTRETCH) == 0)
702686   {
703687      osd_printf_verbose("DirectDraw: Warning - Device does not support hardware stretching\n");
704688      retval = 1;
r243409r243410
713697//  ddraw_test_cooperative
714698//============================================================
715699
716int renderer_dd::ddraw_test_cooperative()
700static int ddraw_test_cooperative(win_window_info *window)
717701{
702   dd_info *dd = (dd_info *)window->m_drawdata;
718703   HRESULT result;
719704
720705   // check our current status; if we lost the device, punt to GDI
721   result = IDirectDraw7_TestCooperativeLevel(ddraw);
706   result = IDirectDraw7_TestCooperativeLevel(dd->ddraw);
722707   switch (result)
723708   {
724709      // punt to GDI if someone else has exclusive mode
725710      case DDERR_NOEXCLUSIVEMODE:
726711      case DDERR_EXCLUSIVEMODEALREADYSET:
727         ddraw_delete_surfaces();
712         ddraw_delete_surfaces(window);
728713         return 1;
729714
730715      // if we're ok, but we don't have a primary surface, create one
731716      default:
732717      case DD_OK:
733         if (primary == NULL)
734            return ddraw_create_surfaces();
718         if (dd->primary == NULL)
719            return ddraw_create_surfaces(window);
735720         return 0;
736721   }
737722}
r243409r243410
742727//  create_surface
743728//============================================================
744729
745HRESULT renderer_dd::create_surface(DDSURFACEDESC2 *desc, IDirectDrawSurface7 **surface, const char *type)
730static HRESULT create_surface(dd_info *dd, DDSURFACEDESC2 *desc, IDirectDrawSurface7 **surface, const char *type)
746731{
747732   HRESULT result;
748733
749734   // create the surface as requested
750   result = IDirectDraw7_CreateSurface(ddraw, desc, surface, NULL);
735   result = IDirectDraw7_CreateSurface(dd->ddraw, desc, surface, NULL);
751736   if (result != DD_OK)
752737   {
753738      osd_printf_verbose("DirectDraw: Error %08X creating %s surface\n", (int)result, type);
r243409r243410
782767//  create_clipper
783768//============================================================
784769
785int renderer_dd::create_clipper()
770static int create_clipper(win_window_info *window)
786771{
772   dd_info *dd = (dd_info *)window->m_drawdata;
787773   HRESULT result;
788774
789775   // create a clipper for the primary surface
790   result = IDirectDraw7_CreateClipper(ddraw, 0, &clipper, NULL);
776   result = IDirectDraw7_CreateClipper(dd->ddraw, 0, &dd->clipper, NULL);
791777   if (result != DD_OK)
792778   {
793779      osd_printf_verbose("DirectDraw: Error %08X creating clipper\n", (int)result);
r243409r243410
795781   }
796782
797783   // set the clipper's hwnd
798   result = IDirectDrawClipper_SetHWnd(clipper, 0, window().m_hwnd);
784   result = IDirectDrawClipper_SetHWnd(dd->clipper, 0, window->m_hwnd);
799785   if (result != DD_OK)
800786   {
801787      osd_printf_verbose("DirectDraw: Error %08X setting clipper hwnd\n", (int)result);
r243409r243410
803789   }
804790
805791   // set the clipper on the primary surface
806   result = IDirectDrawSurface7_SetClipper(primary, clipper);
792   result = IDirectDrawSurface7_SetClipper(dd->primary, dd->clipper);
807793   if (result != DD_OK)
808794   {
809795      osd_printf_verbose("DirectDraw: Error %08X setting clipper on primary surface\n", (int)result);
r243409r243410
818804//  compute_blit_surface_size
819805//============================================================
820806
821void renderer_dd::compute_blit_surface_size()
807static void compute_blit_surface_size(win_window_info *window)
822808{
809   dd_info *dd = (dd_info *)window->m_drawdata;
823810   INT32 newwidth, newheight;
824811   int xscale, yscale;
825812   RECT client;
826813
827814   // start with the minimum size
828   window().m_target->compute_minimum_size(newwidth, newheight);
815   window->m_target->compute_minimum_size(newwidth, newheight);
829816
830817   // get the window's client rectangle
831   GetClientRect(window().m_hwnd, &client);
818   GetClientRect(window->m_hwnd, &client);
832819
833820   // hardware stretch case: apply prescale
834821   if (video_config.hwstretch)
r243409r243410
854841      // compute the appropriate visible area if we're trying to keepaspect
855842      if (video_config.keepaspect)
856843      {
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);
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);
859846         desired_aspect = (float)target_width / (float)target_height;
860847      }
861848
r243409r243410
897884   // apply the final scale
898885   newwidth *= xscale;
899886   newheight *= yscale;
900   if (newwidth != blitwidth || newheight != blitheight)
887   if (newwidth != dd->blitwidth || newheight != dd->blitheight)
901888   {
902889      // force some updates
903      update_outer_rects();
890      update_outer_rects(dd);
904891      osd_printf_verbose("DirectDraw: New blit size = %dx%d\n", newwidth, newheight);
905892   }
906   blitwidth = newwidth;
907   blitheight = newheight;
893   dd->blitwidth = newwidth;
894   dd->blitheight = newheight;
908895}
909896
910897
r243409r243410
913900//  calc_fullscreen_margins
914901//============================================================
915902
916void renderer_dd::calc_fullscreen_margins(DWORD desc_width, DWORD desc_height, RECT *margins)
903static void calc_fullscreen_margins(win_window_info *window, DWORD desc_width, DWORD desc_height, RECT *margins)
917904{
918905   margins->left = 0;
919906   margins->top = 0;
920907   margins->right = desc_width;
921908   margins->bottom = desc_height;
922909
923   if (win_has_menu(&window()))
910   if (win_has_menu(window))
924911   {
925912      static int height_with_menubar = 0;
926913      if (height_with_menubar == 0)
r243409r243410
941928//  blit_to_primary
942929//============================================================
943930
944void renderer_dd::blit_to_primary(int srcwidth, int srcheight)
931static void blit_to_primary(win_window_info *window, int srcwidth, int srcheight)
945932{
946   IDirectDrawSurface7 *target = (back != NULL) ? back : primary;
947   win_monitor_info *monitor = winwindow_video_window_monitor(&window(), NULL);
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);
948936   DDBLTFX blitfx = { sizeof(DDBLTFX) };
949937   RECT clear, outer, dest, source;
950938   INT32 dstwidth, dstheight;
r243409r243410
956944   source.bottom = srcheight;
957945
958946   // compute outer rect -- windowed version
959   if (!window().m_fullscreen)
947   if (!window->m_fullscreen)
960948   {
961      GetClientRect(window().m_hwnd, &outer);
962      ClientToScreen(window().m_hwnd, &((LPPOINT)&outer)[0]);
963      ClientToScreen(window().m_hwnd, &((LPPOINT)&outer)[1]);
949      GetClientRect(window->m_hwnd, &outer);
950      ClientToScreen(window->m_hwnd, &((LPPOINT)&outer)[0]);
951      ClientToScreen(window->m_hwnd, &((LPPOINT)&outer)[1]);
964952
965953      // adjust to be relative to the monitor
966954      outer.left -= monitor->info.rcMonitor.left;
r243409r243410
972960   // compute outer rect -- full screen version
973961   else
974962   {
975      calc_fullscreen_margins(primarydesc.dwWidth, primarydesc.dwHeight, &outer);
963      calc_fullscreen_margins(window, dd->primarydesc.dwWidth, dd->primarydesc.dwHeight, &outer);
976964   }
977965
978966   // if we're respecting the aspect ratio, we need to adjust to fit
r243409r243410
999987   else if (video_config.keepaspect)
1000988   {
1001989      // compute the appropriate visible area
1002      window().m_target->compute_visible_area(rect_width(&outer), rect_height(&outer), monitor->get_aspect(), window().m_target->orientation(), dstwidth, dstheight);
990      window->m_target->compute_visible_area(rect_width(&outer), rect_height(&outer), monitor->get_aspect(), window->m_target->orientation(), dstwidth, dstheight);
1003991   }
1004992
1005993   // center within
r243409r243410
1009997   dest.bottom = dest.top + dstheight;
1010998
1011999   // compare against last destination; if different, force a redraw
1012   if (dest.left != lastdest.left || dest.right != lastdest.right || dest.top != lastdest.top || dest.bottom != lastdest.bottom)
1000   if (dest.left != dd->lastdest.left || dest.right != dd->lastdest.right || dest.top != dd->lastdest.top || dest.bottom != dd->lastdest.bottom)
10131001   {
1014      lastdest = dest;
1015      update_outer_rects();
1002      dd->lastdest = dest;
1003      update_outer_rects(dd);
10161004   }
10171005
10181006   // clear outer rects if we need to
1019   if (clearouter != 0)
1007   if (dd->clearouter != 0)
10201008   {
1021      clearouter--;
1009      dd->clearouter--;
10221010
10231011      // clear the left edge
10241012      if (dest.left > outer.left)
r243409r243410
10581046   }
10591047
10601048   // do the blit
1061   result = IDirectDrawSurface7_Blt(target, &dest, blit, &source, DDBLT_WAIT, NULL);
1049   result = IDirectDrawSurface7_Blt(target, &dest, dd->blit, &source, DDBLT_WAIT, NULL);
10621050   if (result != DD_OK) osd_printf_verbose("DirectDraw: Error %08X blitting to the screen\n", (int)result);
10631051
10641052   // page flip if triple buffered
1065   if (window().m_fullscreen && back != NULL)
1053   if (window->m_fullscreen && dd->back != NULL)
10661054   {
1067      result = IDirectDrawSurface7_Flip(primary, NULL, DDFLIP_WAIT);
1055      result = IDirectDrawSurface7_Flip(dd->primary, NULL, DDFLIP_WAIT);
10681056      if (result != DD_OK) osd_printf_verbose("DirectDraw: Error %08X waiting for VBLANK\n", (int)result);
10691057   }
10701058}
r243409r243410
10751063//  config_adapter_mode
10761064//============================================================
10771065
1078int renderer_dd::config_adapter_mode()
1066static int config_adapter_mode(win_window_info *window)
10791067{
10801068   DDDEVICEIDENTIFIER2 identifier;
1069   dd_info *dd = (dd_info *)window->m_drawdata;
10811070   HRESULT result;
10821071
10831072   // choose the monitor number
1084   get_adapter_for_monitor(window().m_monitor);
1073   get_adapter_for_monitor(dd, window->m_monitor);
10851074
10861075   // create a temporary DirectDraw object
1087   result = (*directdrawcreateex)(adapter_ptr, (LPVOID *)&ddraw, WRAP_REFIID(IID_IDirectDraw7), NULL);
1076   result = (*directdrawcreateex)(dd->adapter_ptr, (LPVOID *)&dd->ddraw, WRAP_REFIID(IID_IDirectDraw7), NULL);
10881077   if (result != DD_OK)
10891078   {
10901079      osd_printf_verbose("DirectDraw: Error %08X during DirectDrawCreateEx call\n", (int)result);
r243409r243410
10921081   }
10931082
10941083   // get the identifier
1095   result = IDirectDraw7_GetDeviceIdentifier(ddraw, &identifier, 0);
1084   result = IDirectDraw7_GetDeviceIdentifier(dd->ddraw, &identifier, 0);
10961085   if (result != DD_OK)
10971086   {
10981087      osd_printf_error("Error getting identifier for device\n");
r243409r243410
11011090   osd_printf_verbose("DirectDraw: Configuring device %s\n", identifier.szDescription);
11021091
11031092   // get the current display mode
1104   memset(&origmode, 0, sizeof(origmode));
1105   origmode.dwSize = sizeof(origmode);
1106   result = IDirectDraw7_GetDisplayMode(ddraw, &origmode);
1093   memset(&dd->origmode, 0, sizeof(dd->origmode));
1094   dd->origmode.dwSize = sizeof(dd->origmode);
1095   result = IDirectDraw7_GetDisplayMode(dd->ddraw, &dd->origmode);
11071096   if (result != DD_OK)
11081097   {
11091098      osd_printf_verbose("DirectDraw: Error %08X getting current display mode\n", (int)result);
1110      IDirectDraw7_Release(ddraw);
1099      IDirectDraw7_Release(dd->ddraw);
11111100      return 1;
11121101   }
11131102
11141103   // choose a resolution: full screen mode case
1115   if (window().m_fullscreen)
1104   if (window->m_fullscreen)
11161105   {
11171106      // default to the current mode exactly
1118      width = origmode.dwWidth;
1119      height = origmode.dwHeight;
1120      refresh = origmode.dwRefreshRate;
1107      dd->width = dd->origmode.dwWidth;
1108      dd->height = dd->origmode.dwHeight;
1109      dd->refresh = dd->origmode.dwRefreshRate;
11211110
11221111      // if we're allowed to switch resolutions, override with something better
11231112      if (video_config.switchres)
1124         pick_best_mode();
1113         pick_best_mode(window);
11251114   }
11261115
11271116   // release the DirectDraw object
1128   IDirectDraw7_Release(ddraw);
1129   ddraw = NULL;
1117   IDirectDraw7_Release(dd->ddraw);
1118   dd->ddraw = NULL;
11301119
11311120   // if we're not changing resolutions, make sure we have a resolution we can handle
1132   if (!window().m_fullscreen || !video_config.switchres)
1121   if (!window->m_fullscreen || !video_config.switchres)
11331122   {
1134      switch (origmode.ddpfPixelFormat.dwRBitMask)
1123      switch (dd->origmode.ddpfPixelFormat.dwRBitMask)
11351124      {
11361125         case 0x00ff0000:
11371126         case 0x000000ff:
r243409r243410
11401129            break;
11411130
11421131         default:
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);
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);
11441133            return 1;
11451134      }
11461135   }
r243409r243410
11751164//  get_adapter_for_monitor
11761165//============================================================
11771166
1178void renderer_dd::get_adapter_for_monitor(win_monitor_info *monitor)
1167static void get_adapter_for_monitor(dd_info *dd, win_monitor_info *monitor)
11791168{
11801169   monitor_enum_info einfo;
11811170   HRESULT result;
r243409r243410
11891178   // set up the adapter
11901179   if (einfo.foundit && einfo.guid_ptr != NULL)
11911180   {
1192      adapter = einfo.guid;
1193      adapter_ptr = &adapter;
1181      dd->adapter = einfo.guid;
1182      dd->adapter_ptr = &dd->adapter;
11941183   }
11951184   else
1196      adapter_ptr = NULL;
1185      dd->adapter_ptr = NULL;
11971186}
11981187
11991188
r243409r243410
12061195{
12071196   float size_score, refresh_score, final_score;
12081197   mode_enum_info *einfo = (mode_enum_info *)context;
1209   renderer_dd *dd = dynamic_cast<renderer_dd *>(einfo->window->m_renderer);
1198   dd_info *dd = (dd_info *)einfo->window->m_drawdata;
12101199
12111200   // skip non-32 bit modes
12121201   if (desc->ddpfPixelFormat.dwRGBBitCount != 32)
r243409r243410
12591248//  pick_best_mode
12601249//============================================================
12611250
1262void renderer_dd::pick_best_mode()
1251static void pick_best_mode(win_window_info *window)
12631252{
1253   dd_info *dd = (dd_info *)window->m_drawdata;
12641254   mode_enum_info einfo;
12651255   HRESULT result;
12661256
r243409r243410
12681258   // note: technically we should not be calling this from an alternate window
12691259   // thread; however, it is only done during init time, and the init code on
12701260   // the main thread is waiting for us to finish, so it is safe to do so here
1271   window().m_target->compute_minimum_size(einfo.minimum_width, einfo.minimum_height);
1261   window->m_target->compute_minimum_size(einfo.minimum_width, einfo.minimum_height);
12721262
12731263   // use those as the target for now
12741264   einfo.target_width = einfo.minimum_width * MAX(1, video_config.prescale);
r243409r243410
12761266
12771267   // determine the refresh rate of the primary screen
12781268   einfo.target_refresh = 60.0;
1279   const screen_device *primary_screen = window().machine().config().first_screen();
1269   const screen_device *primary_screen = window->machine().config().first_screen();
12801270   if (primary_screen != NULL)
12811271      einfo.target_refresh = ATTOSECONDS_TO_HZ(primary_screen->refresh_attoseconds());
12821272   printf("Target refresh = %f\n", einfo.target_refresh);
r243409r243410
12961286   }
12971287
12981288   // fill in the rest of the data
1299   einfo.window = &window();
1289   einfo.window = window;
13001290   einfo.best_score = 0.0f;
13011291
13021292   // enumerate the modes
13031293   osd_printf_verbose("DirectDraw: Selecting video mode...\n");
1304   result = IDirectDraw7_EnumDisplayModes(ddraw, DDEDM_REFRESHRATES, NULL, &einfo, enum_modes_callback);
1294   result = IDirectDraw7_EnumDisplayModes(dd->ddraw, DDEDM_REFRESHRATES, NULL, &einfo, enum_modes_callback);
13051295   if (result != DD_OK) osd_printf_verbose("DirectDraw: Error %08X during EnumDisplayModes call\n", (int)result);
1306   osd_printf_verbose("DirectDraw: Mode selected = %4dx%4d@%3dHz\n", width, height, refresh);
1296   osd_printf_verbose("DirectDraw: Mode selected = %4dx%4d@%3dHz\n", dd->width, dd->height, dd->refresh);
13071297}
trunk/src/osd/windows/drawgdi.c
r243409r243410
1818#include "window.h"
1919
2020
21
2122//============================================================
2223//  TYPE DEFINITIONS
2324//============================================================
2425
25class renderer_gdi : public osd_renderer
26/* gdi_info is the information for the current screen */
27struct gdi_info
2628{
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 */
4329   BITMAPINFO              bminfo;
4430   UINT8 *                 bmdata;
4531   size_t                  bmsize;
4632};
4733
4834
35
4936//============================================================
5037//  PROTOTYPES
5138//============================================================
5239
5340// core functions
5441static 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);
5546
56//============================================================
57//  drawnone_create
58//============================================================
5947
60static osd_renderer *drawgdi_create(win_window_info *window)
61{
62   return global_alloc(renderer_gdi(window));
63}
6448
65
6649//============================================================
6750//  drawgdi_init
6851//============================================================
6952
70int drawgdi_init(running_machine &machine, osd_draw_callbacks *callbacks)
53int drawgdi_init(running_machine &machine, win_draw_callbacks *callbacks)
7154{
7255   // fill in the callbacks
7356   memset(callbacks, 0, sizeof(*callbacks));
7457   callbacks->exit = drawgdi_exit;
75   callbacks->create = drawgdi_create;
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;
7662   return 0;
7763}
7864
r243409r243410
9278//  drawgdi_window_init
9379//============================================================
9480
95int renderer_gdi::init()
81static int drawgdi_window_init(win_window_info *window)
9682{
83   // allocate memory for our structures
84   gdi_info *gdi = global_alloc_clear(gdi_info);
85   window->m_drawdata = gdi;
9786
9887   // fill in the bitmap info header
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;
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;
10897
10998   return 0;
11099}
r243409r243410
115104//  drawgdi_window_destroy
116105//============================================================
117106
118void renderer_gdi::destroy()
107static void drawgdi_window_destroy(win_window_info *window)
119108{
109   gdi_info *gdi = (gdi_info *)window->m_drawdata;
120110
111   // skip if nothing
112   if (gdi == NULL)
113      return;
114
121115   // free the bitmap memory
122   if (bmdata != NULL)
123      global_free_array(bmdata);
116   if (gdi->bmdata != NULL)
117      global_free_array(gdi->bmdata);
118   global_free(gdi);
119   window->m_drawdata = NULL;
124120}
125121
126122
r243409r243410
129125//  drawgdi_window_get_primitives
130126//============================================================
131127
132render_primitive_list *renderer_gdi::get_primitives()
128static render_primitive_list *drawgdi_window_get_primitives(win_window_info *window)
133129{
134130   RECT client;
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();
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();
138134}
139135
140136
r243409r243410
143139//  drawgdi_window_draw
144140//============================================================
145141
146int renderer_gdi::draw(HDC dc, int update)
142static int drawgdi_window_draw(win_window_info *window, HDC dc, int update)
147143{
144   gdi_info *gdi = (gdi_info *)window->m_drawdata;
148145   int width, height, pitch;
149146   RECT bounds;
150147
151148   // we don't have any special resize behaviors
152   if (window().m_resize_state == RESIZE_STATE_PENDING)
153      window().m_resize_state = RESIZE_STATE_NORMAL;
149   if (window->m_resize_state == RESIZE_STATE_PENDING)
150      window->m_resize_state = RESIZE_STATE_NORMAL;
154151
155152   // get the target bounds
156   GetClientRect(window().m_hwnd, &bounds);
153   GetClientRect(window->m_hwnd, &bounds);
157154
158155   // compute width/height/pitch of target
159156   width = rect_width(&bounds);
r243409r243410
161158   pitch = (width + 3) & ~3;
162159
163160   // make sure our temporary bitmap is big enough
164   if (pitch * height * 4 > bmsize)
161   if (pitch * height * 4 > gdi->bmsize)
165162   {
166      bmsize = pitch * height * 4 * 2;
167      global_free_array(bmdata);
168      bmdata = global_alloc_array(UINT8, bmsize);
163      gdi->bmsize = pitch * height * 4 * 2;
164      global_free_array(gdi->bmdata);
165      gdi->bmdata = global_alloc_array(UINT8, gdi->bmsize);
169166   }
170167
171168   // draw the primitives to the bitmap
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();
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();
175172
176173   // fill in bitmap-specific info
177   bminfo.bmiHeader.biWidth = pitch;
178   bminfo.bmiHeader.biHeight = -height;
174   gdi->bminfo.bmiHeader.biWidth = pitch;
175   gdi->bminfo.bmiHeader.biHeight = -height;
179176
180177   // blit to the screen
181178   StretchDIBits(dc, 0, 0, width, height,
182179            0, 0, width, height,
183            bmdata, &bminfo, DIB_RGB_COLORS, SRCCOPY);
180            gdi->bmdata, &gdi->bminfo, DIB_RGB_COLORS, SRCCOPY);
184181   return 0;
185182}
trunk/src/osd/windows/drawnone.c
r243409r243410
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) { }
2520
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
3921//============================================================
4022//  PROTOTYPES
4123//============================================================
4224
4325// core functions
4426static 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);
4531
46//============================================================
47//  drawnone_create
48//============================================================
4932
50osd_renderer *drawnone_create(win_window_info *window)
51{
52   return global_alloc(renderer_none(window));
53}
5433
5534//============================================================
5635//  drawnone_init
5736//============================================================
5837
59int drawnone_init(running_machine &machine, osd_draw_callbacks *callbacks)
38int drawnone_init(running_machine &machine, win_draw_callbacks *callbacks)
6039{
6140   // fill in the callbacks
6241   memset(callbacks, 0, sizeof(*callbacks));
6342   callbacks->exit = drawnone_exit;
64   callbacks->create = drawnone_create;
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;
6547   return 0;
6648}
6749
r243409r243410
8163//  drawnone_window_init
8264//============================================================
8365
84int renderer_none::init()
66static int drawnone_window_init(win_window_info *window)
8567{
8668   return 0;
8769}
r243409r243410
9274//  drawnone_window_destroy
9375//============================================================
9476
95void renderer_none::destroy()
77static void drawnone_window_destroy(win_window_info *window)
9678{
9779}
9880
r243409r243410
10284//  drawnone_window_get_primitives
10385//============================================================
10486
105render_primitive_list *renderer_none::get_primitives()
87static render_primitive_list *drawnone_window_get_primitives(win_window_info *window)
10688{
10789   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();
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();
11193}
11294
11395
r243409r243410
11698//  drawnone_window_draw
11799//============================================================
118100
119int renderer_none::draw(HDC dc, int update)
101static int drawnone_window_draw(win_window_info *window, HDC dc, int update)
120102{
121103   return 0;
122104}
trunk/src/osd/windows/window.c
r243409r243410
3535#include "config.h"
3636#include "winutf8.h"
3737
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);
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);
4343
4444
4545//============================================================
r243409r243410
107107
108108static DWORD last_update_time;
109109
110static osd_draw_callbacks draw;
110static win_draw_callbacks draw;
111111
112112static HANDLE ui_pause_event;
113113static HANDLE window_thread_ready_event;
r243409r243410
320320      m_lastclicktime(0),
321321      m_lastclickx(0),
322322      m_lastclicky(0),
323      m_renderer(NULL),
323      m_drawdata(NULL),
324324      m_machine(machine)
325325{
326326   memset(m_title,0,sizeof(m_title));
r243409r243410
504504
505505void winwindow_take_snap(void)
506506{
507   if (draw.window_record == NULL)
508      return;
509
507510   win_window_info *window;
508511
509512   assert(GetCurrentThreadId() == main_threadid);
r243409r243410
511514   // iterate over windows and request a snap
512515   for (window = win_window_list; window != NULL; window = window->m_next)
513516   {
514      window->m_renderer->save();
517      (*draw.window_save)(window);
515518   }
516519}
517520
r243409r243410
524527
525528void winwindow_toggle_fsfx(void)
526529{
530   if (draw.window_toggle_fsfx == NULL)
531      return;
532
527533   win_window_info *window;
528534
529535   assert(GetCurrentThreadId() == main_threadid);
r243409r243410
531537   // iterate over windows and request a snap
532538   for (window = win_window_list; window != NULL; window = window->m_next)
533539   {
534      window->m_renderer->toggle_fsfx();
540      (*draw.window_toggle_fsfx)(window);
535541   }
536542}
537543
r243409r243410
544550
545551void winwindow_take_video(void)
546552{
553   if (draw.window_record == NULL)
554      return;
555
547556   win_window_info *window;
548557
549558   assert(GetCurrentThreadId() == main_threadid);
r243409r243410
551560   // iterate over windows and request a snap
552561   for (window = win_window_list; window != NULL; window = window->m_next)
553562   {
554      window->m_renderer->record();
563      (*draw.window_record)(window);
555564   }
556565}
557566
r243409r243410
803812   }
804813
805814   // if we're visible and running and not in the middle of a resize, draw
806   if (m_hwnd != NULL && m_target != NULL && m_renderer != NULL)
815   if (m_hwnd != NULL && m_target != NULL && m_drawdata != NULL)
807816   {
808817      int got_lock = TRUE;
809818
r243409r243410
826835         osd_lock_release(m_render_lock);
827836
828837         // ensure the target bounds are up-to-date, and then get the primitives
829         primlist = m_renderer->get_primitives();
838         primlist = (*draw.window_get_primitives)(this);
830839
831840         // post a redraw request with the primitive list as a parameter
832841         last_update_time = timeGetTime();
r243409r243410
12321241   if (!window->m_fullscreen || window->m_fullscreen_safe)
12331242   {
12341243      // finish off by trying to initialize DirectX; if we fail, ignore it
1235      window->m_renderer = draw.create(window);
1236      if (window->m_renderer->init())
1244      if ((*draw.window_init)(window))
12371245         return 1;
12381246      ShowWindow(window->m_hwnd, SW_SHOW);
12391247   }
r243409r243410
14091417
14101418      // destroy: clean up all attached rendering bits and NULL out our hwnd
14111419      case WM_DESTROY:
1412         window->m_renderer->destroy();
1413         global_free(window->m_renderer);
1414         window->m_renderer = NULL;
1420         (*draw.window_destroy)(window);
14151421         window->m_hwnd = NULL;
14161422         return DefWindowProc(wnd, message, wparam, lparam);
14171423
r243409r243410
14951501      // otherwise, render with our drawing system
14961502      else
14971503      {
1498         window->m_renderer->draw(dc, update);
1504         (*draw.window_draw)(window, dc, update);
14991505         mtlog_add("draw_video_contents: drawing finished");
15001506      }
15011507   }
r243409r243410
18651871   window->m_fullscreen = fullscreen;
18661872
18671873   // kill off the drawers
1868   window->m_renderer->destroy();
1869   global_free(window->m_renderer);
1870   window->m_renderer = NULL;
1874   (*draw.window_destroy)(window);
18711875
18721876   // hide ourself
18731877   ShowWindow(window->m_hwnd, SW_HIDE);
r243409r243410
19231927   {
19241928      if (video_config.mode != VIDEO_MODE_NONE)
19251929         ShowWindow(window->m_hwnd, SW_SHOW);
1926      window->m_renderer = draw.create(window);
1927      if (window->m_renderer->init())
1930      if ((*draw.window_init)(window))
19281931         exit(1);
19291932   }
19301933
trunk/src/osd/windows/window.h
r243409r243410
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
7135class win_window_info
7236{
7337public:
r243409r243410
11377   int                 m_lastclicky;
11478
11579   // drawing data
116   osd_renderer *      m_renderer;
80   void *              m_drawdata;
11781
11882private:
11983   running_machine &   m_machine;
12084};
12185
122struct osd_draw_callbacks
86
87struct win_draw_callbacks
12388{
124   osd_renderer *(*create)(win_window_info *window);
12589   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);
12698};
12799
128100
trunk/src/tools/chdman.c
r243409r243410
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   }
r243409r243410
25882588         // read the hunk into the buffers
25892589         chd_error err = input_chd.read_hunk(framenum, NULL);
25902590         if (err != CHDERR_NONE)
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         }
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));
25952592
25962593         // write audio
25972594         for (int chnum = 0; chnum < channels; chnum++)


Previous 199869 Revisions Next


© 1997-2024 The MAME Team