summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author couriersud <couriersud@arcor.de>2015-02-22 20:34:12 +0100
committer couriersud <couriersud@arcor.de>2015-02-22 20:34:12 +0100
commitc2c3a819a59998b351a76415b2c5a7853a07da85 (patch)
treeb9b6d4827ca389f0e89bb1e7ec43fe83b05a8b65
parent9fcd415327cd4155a1aceff8886c5e7b3d136de5 (diff)
parent08a8056e4b31e4f3bc0ea8abf90ced2e417b87cd (diff)
Merge branch 'master' of https://github.com/mamedev/mame.git
-rw-r--r--src/emu/bus/gamegear/ggext.c1
-rw-r--r--src/emu/bus/gamegear/ggext.h1
-rw-r--r--src/emu/bus/gamegear/smsctrladp.h2
-rw-r--r--src/emu/bus/sega8/sega8_slot.c15
-rw-r--r--src/emu/bus/sms_ctrl/lphaser.c128
-rw-r--r--src/emu/debug/dvbpoints.c431
-rw-r--r--src/emu/debug/dvbpoints.h22
-rw-r--r--src/emu/debug/dvwpoints.c540
-rw-r--r--src/emu/debug/dvwpoints.h30
-rw-r--r--src/emu/video/315_5124.c47
-rw-r--r--src/emu/video/315_5124.h1
-rw-r--r--src/mame/drivers/bfm_sc1.c2
-rw-r--r--src/mame/drivers/mpu4avan.c2
-rw-r--r--src/mame/drivers/mpu4bwb.c2
-rw-r--r--src/mame/drivers/mpu4concept.c2
-rw-r--r--src/mame/drivers/mpu4crystal.c2
-rw-r--r--src/mame/drivers/mpu4empire.c2
-rw-r--r--src/mame/drivers/mpu4mdm.c2
-rw-r--r--src/mame/drivers/mpu4misc.c2
-rw-r--r--src/mame/drivers/mpu4mod2sw.c2
-rw-r--r--src/mame/drivers/mpu4plasma.c2
-rw-r--r--src/mame/drivers/mpu4sw.c2
-rw-r--r--src/mame/drivers/mpu4union.c2
-rw-r--r--src/mame/drivers/sumt8035.c4
-rw-r--r--src/mame/drivers/vaportra.c14
-rw-r--r--src/mame/drivers/wms.c50
-rw-r--r--src/mess/includes/sms.h22
-rw-r--r--src/mess/machine/sms.c3
-rw-r--r--src/osd/modules/debugger/osx/breakpointsview.m2
-rw-r--r--src/osd/modules/debugger/osx/consoleview.m2
-rw-r--r--src/osd/modules/debugger/osx/debugview.h3
-rw-r--r--src/osd/modules/debugger/osx/debugview.m43
-rw-r--r--src/osd/modules/debugger/osx/debugwindowhandler.m30
-rw-r--r--src/osd/modules/debugger/osx/disassemblyview.m2
-rw-r--r--src/osd/modules/debugger/osx/errorlogview.m2
-rw-r--r--src/osd/modules/debugger/osx/memoryview.m2
-rw-r--r--src/osd/modules/debugger/osx/registersview.m2
-rw-r--r--src/osd/modules/debugger/osx/watchpointsview.m2
38 files changed, 588 insertions, 837 deletions
diff --git a/src/emu/bus/gamegear/ggext.c b/src/emu/bus/gamegear/ggext.c
index 864057a65ce..7b6f51c59dd 100644
--- a/src/emu/bus/gamegear/ggext.c
+++ b/src/emu/bus/gamegear/ggext.c
@@ -1,6 +1,7 @@
/**********************************************************************
Sega Game Gear EXT port emulation
+ Also known as Gear-to-Gear (or VS, in Japan) cable connector
Copyright MESS Team.
Visit http://mamedev.org for licensing and usage restrictions.
diff --git a/src/emu/bus/gamegear/ggext.h b/src/emu/bus/gamegear/ggext.h
index 199b0f40933..333b802cde9 100644
--- a/src/emu/bus/gamegear/ggext.h
+++ b/src/emu/bus/gamegear/ggext.h
@@ -1,6 +1,7 @@
/**********************************************************************
Sega Game Gear EXT port emulation
+ Also known as Gear-to-Gear (or VS, in Japan) cable connector
Copyright MESS Team.
Visit http://mamedev.org for licensing and usage restrictions.
diff --git a/src/emu/bus/gamegear/smsctrladp.h b/src/emu/bus/gamegear/smsctrladp.h
index 4e941267c46..64925ca21fb 100644
--- a/src/emu/bus/gamegear/smsctrladp.h
+++ b/src/emu/bus/gamegear/smsctrladp.h
@@ -16,7 +16,7 @@
#include "emu.h"
#include "ggext.h"
-#include "../sms_ctrl/smsctrl.h"
+#include "bus/sms_ctrl/smsctrl.h"
diff --git a/src/emu/bus/sega8/sega8_slot.c b/src/emu/bus/sega8/sega8_slot.c
index 5afc57efcb0..98c91a1ae45 100644
--- a/src/emu/bus/sega8/sega8_slot.c
+++ b/src/emu/bus/sega8/sega8_slot.c
@@ -253,20 +253,15 @@ void sega8_cart_slot_device::set_lphaser_xoffset( UINT8 *rom, int size )
{
if (!memcmp(&rom[0x7ff0], signatures[0], 16) || !memcmp(&rom[0x7ff0], signatures[1], 16))
xoff = 26;
-
- if (!memcmp(&rom[0x7ff0], signatures[2], 16))
+ else if (!memcmp(&rom[0x7ff0], signatures[2], 16))
xoff = 36;
-
- if (!memcmp(&rom[0x7ff0], signatures[3], 16))
+ else if (!memcmp(&rom[0x7ff0], signatures[3], 16))
xoff = 32;
-
- if (!memcmp(&rom[0x7ff0], signatures[4], 16))
+ else if (!memcmp(&rom[0x7ff0], signatures[4], 16))
xoff = 30;
-
- if (!memcmp(&rom[0x7ff0], signatures[5], 16))
+ else if (!memcmp(&rom[0x7ff0], signatures[5], 16))
xoff = 39;
-
- if (!memcmp(&rom[0x7ff0], signatures[6], 16))
+ else if (!memcmp(&rom[0x7ff0], signatures[6], 16))
xoff = 38;
}
diff --git a/src/emu/bus/sms_ctrl/lphaser.c b/src/emu/bus/sms_ctrl/lphaser.c
index 792e8d03721..050086aa09c 100644
--- a/src/emu/bus/sms_ctrl/lphaser.c
+++ b/src/emu/bus/sms_ctrl/lphaser.c
@@ -137,26 +137,27 @@ int sms_light_phaser_device::bright_aim_area( emu_timer *timer, int lgun_x, int
{
const int r_x_r = LGUN_RADIUS * LGUN_RADIUS;
const rectangle &visarea = m_screen->visible_area();
+ rectangle aim_area;
int beam_x = m_screen->hpos();
int beam_y = m_screen->vpos();
- int dx, dy;
- int result = 1;
- int pos_changed = 0;
+ int beam_x_orig = beam_x;
+ int beam_y_orig = beam_y;
+ int dy, result = 1;
double dx_radius;
+ bool new_check_point = false;
- while (1)
+ aim_area.min_y = MAX(lgun_y - LGUN_RADIUS, visarea.min_y);
+ aim_area.max_y = MIN(lgun_y + LGUN_RADIUS, visarea.max_y);
+
+ while (!new_check_point)
{
- /* If beam's y isn't at a line where the aim area is, change it
- the next line it enters that area. */
- dy = abs(beam_y - lgun_y);
- if (dy > LGUN_RADIUS || beam_y < visarea.min_y || beam_y > visarea.max_y)
+ /* If beam's y doesn't point to a line where the aim area is,
+ change it to the first line where the beam enters that area. */
+ if (beam_y < aim_area.min_y || beam_y > aim_area.max_y)
{
- beam_y = lgun_y - LGUN_RADIUS;
- if (beam_y < visarea.min_y)
- beam_y = visarea.min_y;
- dy = abs(beam_y - lgun_y);
- pos_changed = 1;
+ beam_y = aim_area.min_y;
}
+ dy = abs(beam_y - lgun_y);
/* Caculate distance in x of the radius, relative to beam's y distance.
First try some shortcuts. */
@@ -175,66 +176,73 @@ int sms_light_phaser_device::bright_aim_area( emu_timer *timer, int lgun_x, int
dx_radius = ceil((float) sqrt((float) (r_x_r - (dy * dy))));
}
- /* If beam's x isn't in the circular aim area, change it
- to the next point it enters that area. */
- dx = abs(beam_x - lgun_x);
- if (dx > dx_radius || beam_x < visarea.min_x || beam_x > visarea.max_x)
+ aim_area.min_x = MAX(lgun_x - dx_radius, visarea.min_x);
+ aim_area.max_x = MIN(lgun_x + dx_radius, visarea.max_x);
+
+ while (!new_check_point)
{
- /* If beam's x has passed the aim area, advance to
- next line and recheck y/x coordinates. */
- if (beam_x > lgun_x)
+ /* If beam's x has passed the aim area, change it to the
+ next line and go back to recheck y/x coordinates. */
+ if (beam_x > aim_area.max_x)
{
- beam_x = 0;
+ beam_x = visarea.min_x;
beam_y++;
- continue;
+ break;
}
- beam_x = lgun_x - dx_radius;
- if (beam_x < visarea.min_x)
- beam_x = visarea.min_x;
- pos_changed = 1;
- }
- if (pos_changed)
- break;
+ /* If beam's x isn't in the aim area, change it to the
+ next point where the beam enters that area. */
+ if (beam_x < aim_area.min_x)
+ {
+ beam_x = aim_area.min_x;
+ }
- if (m_sensor_last_state == 0) /* sensor is on */
- {
- /* keep sensor on until out of the aim area */
- result = 0;
- }
- else
- {
- rgb_t color;
- UINT8 brightness;
- /* brightness of the lightgray color in the frame drawn by Light Phaser games */
- const UINT8 sensor_min_brightness = 0x7f;
+ if (beam_x_orig != beam_x || beam_y_orig != beam_y)
+ {
+ /* adopt the new coordinates to adjust the timer */
+ new_check_point = true;
+ break;
+ }
+
+ if (m_sensor_last_state == 0)
+ {
+ /* sensor is already on */
+ /* keep sensor on until out of the aim area */
+ result = 0;
+ }
+ else
+ {
+ rgb_t color;
+ UINT8 brightness;
+ /* brightness of the lightgray color in the frame drawn by Light Phaser games */
+ const UINT8 sensor_min_brightness = 0x7f;
- color = m_port->pixel_r();
+ color = m_port->pixel_r();
- /* reference: http://www.w3.org/TR/AERT#color-contrast */
- brightness = (color.r() * 0.299) + (color.g() * 0.587) + (color.b() * 0.114);
- //printf ("color brightness: %2X for x %d y %d\n", brightness, beam_x, beam_y);
+ /* reference: http://www.w3.org/TR/AERT#color-contrast */
+ brightness = (color.r() * 0.299) + (color.g() * 0.587) + (color.b() * 0.114);
+ //printf ("color brightness: %2X for x %d y %d\n", brightness, beam_x, beam_y);
- result = (brightness >= sensor_min_brightness) ? 0 : 1;
- }
+ result = (brightness >= sensor_min_brightness) ? 0 : 1;
+ }
- if (result == 0)
- {
- /* Set next check for when sensor will be off */
- beam_x = lgun_x + dx_radius + 1;
- if (beam_x > visarea.max_x)
- beam_x = visarea.max_x + 1;
- break;
- }
- else
- {
- /* Next check after the minimum interval */
- beam_x += LGUN_X_INTERVAL;
- pos_changed = 1;
+ if (result == 0) /* sensor on */
+ {
+ /* Set next check for when sensor will be off */
+ beam_x = aim_area.max_x + 1;
+
+ /* adopt the new coordinates to adjust the timer */
+ new_check_point = true;
+ }
+ else
+ {
+ /* Next check will happen after the minimum interval */
+ beam_x += LGUN_X_INTERVAL;
+ }
}
}
- timer->adjust(m_screen->time_until_pos(beam_y, beam_x));
+ timer->adjust(m_screen->time_until_pos(beam_y, beam_x));
return result;
}
diff --git a/src/emu/debug/dvbpoints.c b/src/emu/debug/dvbpoints.c
index e97fe5ba449..b1a2ce8b8fa 100644
--- a/src/emu/debug/dvbpoints.c
+++ b/src/emu/debug/dvbpoints.c
@@ -13,6 +13,80 @@
+// Sorting functors for the qsort function
+static int cIndexAscending(const void* a, const void* b)
+{
+ const device_debug::breakpoint* left = *(device_debug::breakpoint**)a;
+ const device_debug::breakpoint* right = *(device_debug::breakpoint**)b;
+ return left->index() - right->index();
+}
+
+static int cIndexDescending(const void* a, const void* b)
+{
+ return cIndexAscending(b, a);
+}
+
+static int cEnabledAscending(const void* a, const void* b)
+{
+ const device_debug::breakpoint* left = *(device_debug::breakpoint**)a;
+ const device_debug::breakpoint* right = *(device_debug::breakpoint**)b;
+ return (left->enabled() ? 1 : 0) - (right->enabled() ? 1 : 0);
+}
+
+static int cEnabledDescending(const void* a, const void* b)
+{
+ return cEnabledAscending(b, a);
+}
+
+static int cCpuAscending(const void* a, const void* b)
+{
+ const device_debug::breakpoint* left = *(device_debug::breakpoint**)a;
+ const device_debug::breakpoint* right = *(device_debug::breakpoint**)b;
+ return strcmp(left->debugInterface()->device().tag(), right->debugInterface()->device().tag());
+}
+
+static int cCpuDescending(const void* a, const void* b)
+{
+ return cCpuAscending(b, a);
+}
+
+static int cAddressAscending(const void* a, const void* b)
+{
+ const device_debug::breakpoint* left = *(device_debug::breakpoint**)a;
+ const device_debug::breakpoint* right = *(device_debug::breakpoint**)b;
+ return (left->address() > right->address()) ? 1 : (left->address() < right->address()) ? -1 : 0;
+}
+
+static int cAddressDescending(const void* a, const void* b)
+{
+ return cAddressAscending(b, a);
+}
+
+static int cConditionAscending(const void* a, const void* b)
+{
+ const device_debug::breakpoint* left = *(device_debug::breakpoint**)a;
+ const device_debug::breakpoint* right = *(device_debug::breakpoint**)b;
+ return strcmp(left->condition(), right->condition());
+}
+
+static int cConditionDescending(const void* a, const void* b)
+{
+ return cConditionAscending(b, a);
+}
+
+static int cActionAscending(const void* a, const void* b)
+{
+ const device_debug::breakpoint* left = *(device_debug::breakpoint**)a;
+ const device_debug::breakpoint* right = *(device_debug::breakpoint**)b;
+ return strcmp(left->action(), right->action());
+}
+
+static int cActionDescending(const void* a, const void* b)
+{
+ return cActionAscending(b, a);
+}
+
+
//**************************************************************************
// DEBUG VIEW BREAK POINTS
//**************************************************************************
@@ -26,16 +100,12 @@ static const int tableBreaks[] = { 5, 9, 31, 45, 63, 80 };
debug_view_breakpoints::debug_view_breakpoints(running_machine &machine, debug_view_osd_update_func osdupdate, void *osdprivate)
: debug_view(machine, DVT_BREAK_POINTS, osdupdate, osdprivate),
- m_sortType(SORT_INDEX_ASCENDING)
+ m_sortType(cIndexAscending)
{
// fail if no available sources
enumerate_sources();
if (m_source_list.count() == 0)
throw std::bad_alloc();
-
- // configure the view
- m_total.y = 10;
- m_supports_cursor = false;
}
@@ -83,48 +153,30 @@ void debug_view_breakpoints::view_click(const int button, const debug_view_xy& p
if (clickedTopRow)
{
- if (pos.x < tableBreaks[0] && m_sortType == SORT_INDEX_ASCENDING)
- m_sortType = SORT_INDEX_DESCENDING;
- else if (pos.x < tableBreaks[0])
- m_sortType = SORT_INDEX_ASCENDING;
- else if (pos.x < tableBreaks[1] && m_sortType == SORT_ENABLED_ASCENDING)
- m_sortType = SORT_ENABLED_DESCENDING;
+ if (pos.x < tableBreaks[0])
+ m_sortType = (m_sortType == &cIndexAscending) ? &cIndexDescending : &cIndexAscending;
else if (pos.x < tableBreaks[1])
- m_sortType = SORT_ENABLED_ASCENDING;
- else if (pos.x < tableBreaks[2] && m_sortType == SORT_CPU_ASCENDING)
- m_sortType = SORT_CPU_DESCENDING;
+ m_sortType = (m_sortType == &cEnabledAscending) ? &cEnabledDescending : &cEnabledAscending;
else if (pos.x < tableBreaks[2])
- m_sortType = SORT_CPU_ASCENDING;
- else if (pos.x < tableBreaks[3] && m_sortType == SORT_ADDRESS_ASCENDING)
- m_sortType = SORT_ADDRESS_DESCENDING;
+ m_sortType = (m_sortType == &cCpuAscending) ? &cCpuDescending : &cCpuAscending;
else if (pos.x < tableBreaks[3])
- m_sortType = SORT_ADDRESS_ASCENDING;
- else if (pos.x < tableBreaks[4] && m_sortType == SORT_CONDITION_ASCENDING)
- m_sortType = SORT_CONDITION_DESCENDING;
+ m_sortType = (m_sortType == &cAddressAscending) ? &cAddressDescending : &cAddressAscending;
else if (pos.x < tableBreaks[4])
- m_sortType = SORT_CONDITION_ASCENDING;
- else if (pos.x < tableBreaks[5] && m_sortType == SORT_ACTION_ASCENDING)
- m_sortType = SORT_ACTION_DESCENDING;
+ m_sortType = (m_sortType == &cConditionAscending) ? &cConditionDescending : &cConditionAscending;
else if (pos.x < tableBreaks[5])
- m_sortType = SORT_ACTION_ASCENDING;
+ m_sortType = (m_sortType == &cActionAscending) ? &cActionDescending : &cActionAscending;
}
else
{
// Gather a sorted list of all the breakpoints for all the CPUs
- device_debug::breakpoint** bpList = NULL;
- const int numBPs = breakpoints(SORT_NONE, bpList);
+ gather_breakpoints();
- const int bpIndex = pos.y - 1;
- if (bpIndex > numBPs || bpIndex < 0)
+ int const bpIndex = pos.y - 1;
+ if ((bpIndex >= m_buffer.count()) || (bpIndex < 0))
return;
// Enable / disable
- if (bpList[bpIndex]->enabled())
- bpList[bpIndex]->setEnabled(false);
- else
- bpList[bpIndex]->setEnabled(true);
-
- delete[] bpList;
+ m_buffer[bpIndex]->setEnabled(!m_buffer[bpIndex]->enabled());
machine().debug_view().update_all(DVT_DISASSEMBLY);
}
@@ -149,167 +201,19 @@ void debug_view_breakpoints::pad_astring_to_length(astring& str, int len)
}
-// Sorting functors for the qsort function
-static int cIndexAscending(const void* a, const void* b)
+void debug_view_breakpoints::gather_breakpoints()
{
- const device_debug::breakpoint* left = *(device_debug::breakpoint**)a;
- const device_debug::breakpoint* right = *(device_debug::breakpoint**)b;
- return left->index() > right->index();
-}
-
-static int cIndexDescending(const void* a, const void* b)
-{
- const device_debug::breakpoint* left = *(device_debug::breakpoint**)a;
- const device_debug::breakpoint* right = *(device_debug::breakpoint**)b;
- return left->index() < right->index();
-}
-
-static int cEnabledAscending(const void* a, const void* b)
-{
- const device_debug::breakpoint* left = *(device_debug::breakpoint**)a;
- const device_debug::breakpoint* right = *(device_debug::breakpoint**)b;
- return left->enabled() < right->enabled();
-}
-
-static int cEnabledDescending(const void* a, const void* b)
-{
- const device_debug::breakpoint* left = *(device_debug::breakpoint**)a;
- const device_debug::breakpoint* right = *(device_debug::breakpoint**)b;
- return left->enabled() > right->enabled();
-}
-
-static int cCpuAscending(const void* a, const void* b)
-{
- const device_debug::breakpoint* left = *(device_debug::breakpoint**)a;
- const device_debug::breakpoint* right = *(device_debug::breakpoint**)b;
- const int result = strcmp(left->debugInterface()->device().tag(), right->debugInterface()->device().tag());
- return result >= 0;
-}
-
-static int cCpuDescending(const void* a, const void* b)
-{
- const device_debug::breakpoint* left = *(device_debug::breakpoint**)a;
- const device_debug::breakpoint* right = *(device_debug::breakpoint**)b;
- const int result = strcmp(left->debugInterface()->device().tag(), right->debugInterface()->device().tag());
- return result < 0;
-}
-
-static int cAddressAscending(const void* a, const void* b)
-{
- const device_debug::breakpoint* left = *(device_debug::breakpoint**)a;
- const device_debug::breakpoint* right = *(device_debug::breakpoint**)b;
- return left->address() > right->address();
-}
-
-static int cAddressDescending(const void* a, const void* b)
-{
- const device_debug::breakpoint* left = *(device_debug::breakpoint**)a;
- const device_debug::breakpoint* right = *(device_debug::breakpoint**)b;
- return left->address() < right->address();
-}
-
-static int cConditionAscending(const void* a, const void* b)
-{
- const device_debug::breakpoint* left = *(device_debug::breakpoint**)a;
- const device_debug::breakpoint* right = *(device_debug::breakpoint**)b;
- const int result = strcmp(left->condition(), right->condition());
- return result >= 0;
-}
-
-static int cConditionDescending(const void* a, const void* b)
-{
- const device_debug::breakpoint* left = *(device_debug::breakpoint**)a;
- const device_debug::breakpoint* right = *(device_debug::breakpoint**)b;
- const int result = strcmp(left->condition(), right->condition());
- return result < 0;
-}
-
-static int cActionAscending(const void* a, const void* b)
-{
- const device_debug::breakpoint* left = *(device_debug::breakpoint**)a;
- const device_debug::breakpoint* right = *(device_debug::breakpoint**)b;
- const int result = strcmp(left->action(), right->action());
- return result >= 0;
-}
-
-static int cActionDescending(const void* a, const void* b)
-{
- const device_debug::breakpoint* left = *(device_debug::breakpoint**)a;
- const device_debug::breakpoint* right = *(device_debug::breakpoint**)b;
- const int result = strcmp(left->action(), right->action());
- return result < 0;
-}
-
-
-int debug_view_breakpoints::breakpoints(SortMode sort, device_debug::breakpoint**& bpList)
-{
- // Alloc
- int numBPs = 0;
- bpList = NULL;
- for (const debug_view_source *source = m_source_list.first(); source != NULL; source = source->next())
- {
- const device_debug& debugInterface = *source->device()->debug();
- for (device_debug::breakpoint *bp = debugInterface.breakpoint_first(); bp != NULL; bp = bp->next())
- numBPs++;
- }
- bpList = new device_debug::breakpoint*[numBPs];
-
- int bpAddIndex = 0;
+ m_buffer.resize(0);
for (const debug_view_source *source = m_source_list.first(); source != NULL; source = source->next())
{
// Collect
- device_debug& debugInterface = *source->device()->debug();
+ device_debug &debugInterface = *source->device()->debug();
for (device_debug::breakpoint *bp = debugInterface.breakpoint_first(); bp != NULL; bp = bp->next())
- {
- bpList[bpAddIndex] = bp;
- bpAddIndex++;
- }
+ m_buffer.append() = bp;
}
// And now for the sort
- switch (m_sortType)
- {
- case SORT_NONE:
- break;
- case SORT_INDEX_ASCENDING:
- qsort(bpList, numBPs, sizeof(device_debug::breakpoint*), cIndexAscending);
- break;
- case SORT_INDEX_DESCENDING:
- qsort(bpList, numBPs, sizeof(device_debug::breakpoint*), cIndexDescending);
- break;
- case SORT_ENABLED_ASCENDING:
- qsort(bpList, numBPs, sizeof(device_debug::breakpoint*), cEnabledAscending);
- break;
- case SORT_ENABLED_DESCENDING:
- qsort(bpList, numBPs, sizeof(device_debug::breakpoint*), cEnabledDescending);
- break;
- case SORT_CPU_ASCENDING:
- qsort(bpList, numBPs, sizeof(device_debug::breakpoint*), cCpuAscending);
- break;
- case SORT_CPU_DESCENDING:
- qsort(bpList, numBPs, sizeof(device_debug::breakpoint*), cCpuDescending);
- break;
- case SORT_ADDRESS_ASCENDING:
- qsort(bpList, numBPs, sizeof(device_debug::breakpoint*), cAddressAscending);
- break;
- case SORT_ADDRESS_DESCENDING:
- qsort(bpList, numBPs, sizeof(device_debug::breakpoint*), cAddressDescending);
- break;
- case SORT_CONDITION_ASCENDING:
- qsort(bpList, numBPs, sizeof(device_debug::breakpoint*), cConditionAscending);
- break;
- case SORT_CONDITION_DESCENDING:
- qsort(bpList, numBPs, sizeof(device_debug::breakpoint*), cConditionDescending);
- break;
- case SORT_ACTION_ASCENDING:
- qsort(bpList, numBPs, sizeof(device_debug::breakpoint*), cActionAscending);
- break;
- case SORT_ACTION_DESCENDING:
- qsort(bpList, numBPs, sizeof(device_debug::breakpoint*), cActionDescending);
- break;
- }
-
- return numBPs;
+ qsort(&m_buffer[0], m_buffer.count(), sizeof(device_debug::breakpoint *), m_sortType);
}
@@ -321,104 +225,95 @@ int debug_view_breakpoints::breakpoints(SortMode sort, device_debug::breakpoint*
void debug_view_breakpoints::view_update()
{
// Gather a list of all the breakpoints for all the CPUs
- device_debug::breakpoint** bpList = NULL;
- const int numBPs = breakpoints(SORT_NONE, bpList);
+ gather_breakpoints();
// Set the view region so the scroll bars update
- m_total.y = numBPs+1;
+ m_total.x = tableBreaks[ARRAY_LENGTH(tableBreaks) - 1];
+ m_total.y = m_buffer.count() + 1;
+ if (m_total.y < 10)
+ m_total.y = 10;
// Draw
- debug_view_char *dest = m_viewdata;
- for (int row = 0; row < m_visible.y; row++)
- {
- UINT32 effrow = m_topleft.y + row;
+ debug_view_char *dest = m_viewdata;
+ astring linebuf;
- // Header
- if (row == 0)
+ // Header
+ if (m_visible.y > 0)
+ {
+ linebuf.reset();
+ linebuf.cat("ID");
+ if (m_sortType == &cIndexAscending) linebuf.cat('\\');
+ else if (m_sortType == &cIndexDescending) linebuf.cat('/');
+ pad_astring_to_length(linebuf, tableBreaks[0]);
+ linebuf.cat("En");
+ if (m_sortType == &cEnabledAscending) linebuf.cat('\\');
+ else if (m_sortType == &cEnabledDescending) linebuf.cat('/');
+ pad_astring_to_length(linebuf, tableBreaks[1]);
+ linebuf.cat("CPU");
+ if (m_sortType == &cCpuAscending) linebuf.cat('\\');
+ else if (m_sortType == &cCpuDescending) linebuf.cat('/');
+ pad_astring_to_length(linebuf, tableBreaks[2]);
+ linebuf.cat("Address");
+ if (m_sortType == &cAddressAscending) linebuf.cat('\\');
+ else if (m_sortType == &cAddressDescending) linebuf.cat('/');
+ pad_astring_to_length(linebuf, tableBreaks[3]);
+ linebuf.cat("Condition");
+ if (m_sortType == &cConditionAscending) linebuf.cat('\\');
+ else if (m_sortType == &cConditionDescending) linebuf.cat('/');
+ pad_astring_to_length(linebuf, tableBreaks[4]);
+ linebuf.cat("Action");
+ if (m_sortType == &cActionAscending) linebuf.cat('\\');
+ else if (m_sortType == &cActionDescending) linebuf.cat('/');
+ pad_astring_to_length(linebuf, tableBreaks[5]);
+
+ for (UINT32 i = m_topleft.x; i < (m_topleft.x + m_visible.x); i++, dest++)
{
- astring header;
- header.printf("ID");
- if (m_sortType == SORT_INDEX_ASCENDING) header.catprintf("\\");
- else if (m_sortType == SORT_INDEX_DESCENDING) header.catprintf("/");
- pad_astring_to_length(header, tableBreaks[0]);
- header.catprintf("En");
- if (m_sortType == SORT_ENABLED_ASCENDING) header.catprintf("\\");
- else if (m_sortType == SORT_ENABLED_DESCENDING) header.catprintf("/");
- pad_astring_to_length(header, tableBreaks[1]);
- header.catprintf("CPU");
- if (m_sortType == SORT_CPU_ASCENDING) header.catprintf("\\");
- else if (m_sortType == SORT_CPU_DESCENDING) header.catprintf("/");
- pad_astring_to_length(header, tableBreaks[2]);
- header.catprintf("Address");
- if (m_sortType == SORT_ADDRESS_ASCENDING) header.catprintf("\\");
- else if (m_sortType == SORT_ADDRESS_DESCENDING) header.catprintf("/");
- pad_astring_to_length(header, tableBreaks[3]);
- header.catprintf("Condition");
- if (m_sortType == SORT_CONDITION_ASCENDING) header.catprintf("\\");
- else if (m_sortType == SORT_CONDITION_DESCENDING) header.catprintf("/");
- pad_astring_to_length(header, tableBreaks[4]);
- header.catprintf("Action");
- if (m_sortType == SORT_ACTION_ASCENDING) header.catprintf("\\");
- else if (m_sortType == SORT_ACTION_DESCENDING) header.catprintf("/");
- pad_astring_to_length(header, tableBreaks[5]);
-
- for (int i = 0; i < m_visible.x; i++)
- {
- dest->byte = (i < header.len()) ? header[i] : ' ';
- dest->attrib = DCA_ANCILLARY;
- dest++;
- }
- continue;
+ dest->byte = (i < linebuf.len()) ? linebuf[i] : ' ';
+ dest->attrib = DCA_ANCILLARY;
}
+ }
+ for (int row = 1; row < m_visible.y; row++)
+ {
// Breakpoints
- int bpi = effrow-1;
- if (bpi < numBPs && bpi >= 0)
+ int bpi = row + m_topleft.y - 1;
+ if ((bpi < m_buffer.count()) && (bpi >= 0))
{
- device_debug::breakpoint* bp = bpList[bpi];
-
- astring buffer;
- buffer.printf("%X", bp->index());
- pad_astring_to_length(buffer, tableBreaks[0]);
- buffer.catprintf("%c", bp->enabled() ? 'X' : 'O');
- pad_astring_to_length(buffer, tableBreaks[1]);
- buffer.catprintf("%s", bp->debugInterface()->device().tag());
- pad_astring_to_length(buffer, tableBreaks[2]);
- buffer.catprintf("%s", core_i64_hex_format(bp->address(), bp->debugInterface()->logaddrchars()));
- pad_astring_to_length(buffer, tableBreaks[3]);
- if (astring(bp->condition()) != astring("1"))
- {
- buffer.catprintf("%s", bp->condition());
- pad_astring_to_length(buffer, tableBreaks[4]);
- }
- if (astring(bp->action()) != astring(""))
+ device_debug::breakpoint *const bp = m_buffer[bpi];
+
+ linebuf.reset();
+ linebuf.catprintf("%2X", bp->index());
+ pad_astring_to_length(linebuf, tableBreaks[0]);
+ linebuf.cat(bp->enabled() ? 'X' : 'O');
+ pad_astring_to_length(linebuf, tableBreaks[1]);
+ linebuf.cat(bp->debugInterface()->device().tag());
+ pad_astring_to_length(linebuf, tableBreaks[2]);
+ linebuf.cat(core_i64_hex_format(bp->address(), bp->debugInterface()->logaddrchars()));
+ pad_astring_to_length(linebuf, tableBreaks[3]);
+ if (strcmp(bp->condition(), "1"))
+ linebuf.cat(bp->condition());
+ pad_astring_to_length(linebuf, tableBreaks[4]);
+ linebuf.cat(bp->action());
+ pad_astring_to_length(linebuf, tableBreaks[5]);
+
+ for (UINT32 i = m_topleft.x; i < (m_topleft.x + m_visible.x); i++, dest++)
{
- buffer.catprintf("%s", bp->action());
- pad_astring_to_length(buffer, tableBreaks[5]);
- }
-
- for (int i = 0; i < m_visible.x; i++)
- {
- dest->byte = (i < buffer.len()) ? buffer[i] : ' ';
+ dest->byte = (i < linebuf.len()) ? linebuf[i] : ' ';
dest->attrib = DCA_NORMAL;
// Color disabled breakpoints red
- if (i == 5 && dest->byte == 'O')
- dest->attrib = DCA_CHANGED;
-
- dest++;
+ if ((i >= tableBreaks[0]) && (i < tableBreaks[1]) && !bp->enabled())
+ dest->attrib |= DCA_CHANGED;
}
- continue;
}
-
- // Fill the remaining vertical space
- for (int i = 0; i < m_visible.x; i++)
+ else
{
- dest->byte = ' ';
- dest->attrib = DCA_NORMAL;
- dest++;
+ // Fill the remaining vertical space
+ for (UINT32 i = m_topleft.x; i < (m_topleft.x + m_visible.x); i++, dest++)
+ {
+ dest->byte = ' ';
+ dest->attrib = DCA_NORMAL;
+ }
}
}
-
- delete[] bpList;
}
diff --git a/src/emu/debug/dvbpoints.h b/src/emu/debug/dvbpoints.h
index bb80b840ebb..83a36ed965b 100644
--- a/src/emu/debug/dvbpoints.h
+++ b/src/emu/debug/dvbpoints.h
@@ -35,23 +35,6 @@ class debug_view_breakpoints : public debug_view
virtual ~debug_view_breakpoints();
public:
- enum SortMode
- {
- SORT_NONE,
- SORT_INDEX_ASCENDING,
- SORT_INDEX_DESCENDING,
- SORT_ENABLED_ASCENDING,
- SORT_ENABLED_DESCENDING,
- SORT_CPU_ASCENDING,
- SORT_CPU_DESCENDING,
- SORT_ADDRESS_ASCENDING,
- SORT_ADDRESS_DESCENDING,
- SORT_CONDITION_ASCENDING,
- SORT_CONDITION_DESCENDING,
- SORT_ACTION_ASCENDING,
- SORT_ACTION_DESCENDING
- };
-
// getters
// setters
@@ -64,11 +47,12 @@ private:
// internal helpers
void enumerate_sources();
void pad_astring_to_length(astring& str, int len);
- int breakpoints(SortMode sort, device_debug::breakpoint**& bpList);
+ void gather_breakpoints();
// internal state
- SortMode m_sortType;
+ int (*m_sortType)(void const *, void const *);
+ dynamic_array<device_debug::breakpoint *> m_buffer;
};
diff --git a/src/emu/debug/dvwpoints.c b/src/emu/debug/dvwpoints.c
index 8f16d57219b..ddf28ea4863 100644
--- a/src/emu/debug/dvwpoints.c
+++ b/src/emu/debug/dvwpoints.c
@@ -13,6 +13,103 @@
+static int cIndexAscending(const void* a, const void* b)
+{
+ const device_debug::watchpoint* left = *(device_debug::watchpoint**)a;
+ const device_debug::watchpoint* right = *(device_debug::watchpoint**)b;
+ return left->index() - right->index();
+}
+
+static int cIndexDescending(const void* a, const void* b)
+{
+ return cIndexAscending(b, a);
+}
+
+static int cEnabledAscending(const void* a, const void* b)
+{
+ const device_debug::watchpoint* left = *(device_debug::watchpoint**)a;
+ const device_debug::watchpoint* right = *(device_debug::watchpoint**)b;
+ return (left->enabled() ? 1 : 0) - (right->enabled() ? 1 : 0);
+}
+
+static int cEnabledDescending(const void* a, const void* b)
+{
+ return cEnabledAscending(b, a);
+}
+
+static int cCpuAscending(const void* a, const void* b)
+{
+ const device_debug::watchpoint* left = *(device_debug::watchpoint**)a;
+ const device_debug::watchpoint* right = *(device_debug::watchpoint**)b;
+ return strcmp(left->debugInterface()->device().tag(), right->debugInterface()->device().tag());
+}
+
+static int cCpuDescending(const void* a, const void* b)
+{
+ return cCpuAscending(b, a);
+}
+
+static int cSpaceAscending(const void* a, const void* b)
+{
+ const device_debug::watchpoint* left = *(device_debug::watchpoint**)a;
+ const device_debug::watchpoint* right = *(device_debug::watchpoint**)b;
+ return strcmp(left->space().name(), right->space().name());
+}
+
+static int cSpaceDescending(const void* a, const void* b)
+{
+ return cSpaceAscending(b, a);
+}
+
+static int cAddressAscending(const void* a, const void* b)
+{
+ const device_debug::watchpoint* left = *(device_debug::watchpoint**)a;
+ const device_debug::watchpoint* right = *(device_debug::watchpoint**)b;
+ return (left->address() > right->address()) ? 1 : (left->address() < right->address()) ? -1 : 0;
+}
+
+static int cAddressDescending(const void* a, const void* b)
+{
+ return cAddressAscending(b, a);
+}
+
+static int cTypeAscending(const void* a, const void* b)
+{
+ const device_debug::watchpoint* left = *(device_debug::watchpoint**)a;
+ const device_debug::watchpoint* right = *(device_debug::watchpoint**)b;
+ return left->type() - right->type();
+}
+
+static int cTypeDescending(const void* a, const void* b)
+{
+ return cTypeAscending(b, a);
+}
+
+static int cConditionAscending(const void* a, const void* b)
+{
+ const device_debug::watchpoint* left = *(device_debug::watchpoint**)a;
+ const device_debug::watchpoint* right = *(device_debug::watchpoint**)b;
+ return strcmp(left->condition(), right->condition());
+}
+
+static int cConditionDescending(const void* a, const void* b)
+{
+ return cConditionAscending(b, a);
+}
+
+static int cActionAscending(const void* a, const void* b)
+{
+ const device_debug::watchpoint* left = *(device_debug::watchpoint**)a;
+ const device_debug::watchpoint* right = *(device_debug::watchpoint**)b;
+ return strcmp(left->action(), right->action());
+}
+
+static int cActionDescending(const void* a, const void* b)
+{
+ return cActionAscending(b, a);
+}
+
+
//**************************************************************************
// DEBUG VIEW WATCH POINTS
//**************************************************************************
@@ -25,16 +122,12 @@ static const int tableBreaks[] = { 5, 9, 31, 42, 60, 67, 86, 100 };
debug_view_watchpoints::debug_view_watchpoints(running_machine &machine, debug_view_osd_update_func osdupdate, void *osdprivate)
: debug_view(machine, DVT_WATCH_POINTS, osdupdate, osdprivate),
- m_sortType(SORT_INDEX_ASCENDING)
+ m_sortType(&cIndexAscending)
{
// fail if no available sources
enumerate_sources();
if (m_source_list.count() == 0)
throw std::bad_alloc();
-
- // configure the view
- m_total.y = 10;
- m_supports_cursor = false;
}
@@ -78,60 +171,38 @@ void debug_view_watchpoints::enumerate_sources()
void debug_view_watchpoints::view_click(const int button, const debug_view_xy& pos)
{
- bool clickedTopRow = (m_topleft.y == pos.y);
+ bool const clickedTopRow = (m_topleft.y == pos.y);
if (clickedTopRow)
{
- if (pos.x < tableBreaks[0] && m_sortType == SORT_INDEX_ASCENDING)
- m_sortType = SORT_INDEX_DESCENDING;
- else if (pos.x < tableBreaks[0])
- m_sortType = SORT_INDEX_ASCENDING;
- else if (pos.x < tableBreaks[1] && m_sortType == SORT_ENABLED_ASCENDING)
- m_sortType = SORT_ENABLED_DESCENDING;
+ if (pos.x < tableBreaks[0])
+ m_sortType = (m_sortType == &cIndexAscending) ? &cIndexDescending : &cIndexAscending;
else if (pos.x < tableBreaks[1])
- m_sortType = SORT_ENABLED_ASCENDING;
- else if (pos.x < tableBreaks[2] && m_sortType == SORT_CPU_ASCENDING)
- m_sortType = SORT_CPU_DESCENDING;
+ m_sortType = (m_sortType == &cEnabledAscending) ? &cEnabledDescending : &cEnabledAscending;
else if (pos.x < tableBreaks[2])
- m_sortType = SORT_CPU_ASCENDING;
- else if (pos.x < tableBreaks[3] && m_sortType == SORT_SPACE_ASCENDING)
- m_sortType = SORT_SPACE_DESCENDING;
+ m_sortType = (m_sortType == &cCpuAscending) ? &cCpuDescending : &cCpuAscending;
else if (pos.x < tableBreaks[3])
- m_sortType = SORT_SPACE_ASCENDING;
- else if (pos.x < tableBreaks[4] && m_sortType == SORT_ADDRESS_ASCENDING)
- m_sortType = SORT_ADDRESS_DESCENDING;
+ m_sortType = (m_sortType == &cSpaceAscending) ? &cSpaceDescending : &cSpaceAscending;
else if (pos.x < tableBreaks[4])
- m_sortType = SORT_ADDRESS_ASCENDING;
- else if (pos.x < tableBreaks[5] && m_sortType == SORT_TYPE_ASCENDING)
- m_sortType = SORT_TYPE_DESCENDING;
+ m_sortType = (m_sortType == &cAddressAscending) ? &cAddressDescending : &cAddressAscending;
else if (pos.x < tableBreaks[5])
- m_sortType = SORT_TYPE_ASCENDING;
- else if (pos.x < tableBreaks[6] && m_sortType == SORT_CONDITION_ASCENDING)
- m_sortType = SORT_CONDITION_DESCENDING;
+ m_sortType = (m_sortType == &cTypeAscending) ? &cTypeDescending : &cTypeAscending;
else if (pos.x < tableBreaks[6])
- m_sortType = SORT_CONDITION_ASCENDING;
- else if (pos.x < tableBreaks[7] && m_sortType == SORT_ACTION_ASCENDING)
- m_sortType = SORT_ACTION_DESCENDING;
+ m_sortType = (m_sortType == &cConditionAscending) ? &cConditionDescending : &cConditionAscending;
else if (pos.x < tableBreaks[7])
- m_sortType = SORT_ACTION_ASCENDING;
+ m_sortType = (m_sortType == &cActionAscending) ? &cActionDescending : &cActionAscending;
}
else
{
// Gather a sorted list of all the watchpoints for all the CPUs
- device_debug::watchpoint** wpList = NULL;
- const int numWPs = watchpoints(SORT_NONE, wpList);
+ gather_watchpoints();
- const int wpIndex = pos.y - 1;
- if (wpIndex > numWPs || wpIndex < 0)
+ int const wpIndex = pos.y - 1;
+ if ((wpIndex >= m_buffer.count()) || (wpIndex < 0))
return;
// Enable / disable
- if (wpList[wpIndex]->enabled())
- wpList[wpIndex]->setEnabled(false);
- else
- wpList[wpIndex]->setEnabled(true);
-
- delete[] wpList;
+ m_buffer[wpIndex]->setEnabled(!m_buffer[wpIndex]->enabled());
}
begin_update();
@@ -154,216 +225,22 @@ void debug_view_watchpoints::pad_astring_to_length(astring& str, int len)
}
-// Sorting functors for the qsort function
-static int cIndexAscending(const void* a, const void* b)
-{
- const device_debug::watchpoint* left = *(device_debug::watchpoint**)a;
- const device_debug::watchpoint* right = *(device_debug::watchpoint**)b;
- return left->index() > right->index();
-}
-
-static int cIndexDescending(const void* a, const void* b)
-{
- const device_debug::watchpoint* left = *(device_debug::watchpoint**)a;
- const device_debug::watchpoint* right = *(device_debug::watchpoint**)b;
- return left->index() < right->index();
-}
-
-static int cEnabledAscending(const void* a, const void* b)
-{
- const device_debug::watchpoint* left = *(device_debug::watchpoint**)a;
- const device_debug::watchpoint* right = *(device_debug::watchpoint**)b;
- return left->enabled() < right->enabled();
-}
-
-static int cEnabledDescending(const void* a, const void* b)
-{
- const device_debug::watchpoint* left = *(device_debug::watchpoint**)a;
- const device_debug::watchpoint* right = *(device_debug::watchpoint**)b;
- return left->enabled() > right->enabled();
-}
-
-static int cCpuAscending(const void* a, const void* b)
-{
- const device_debug::watchpoint* left = *(device_debug::watchpoint**)a;
- const device_debug::watchpoint* right = *(device_debug::watchpoint**)b;
- const int result = strcmp(left->debugInterface()->device().tag(), right->debugInterface()->device().tag());
- return result >= 0;
-}
-
-static int cCpuDescending(const void* a, const void* b)
-{
- const device_debug::watchpoint* left = *(device_debug::watchpoint**)a;
- const device_debug::watchpoint* right = *(device_debug::watchpoint**)b;
- const int result = strcmp(left->debugInterface()->device().tag(), right->debugInterface()->device().tag());
- return result < 0;
-}
-
-static int cSpaceAscending(const void* a, const void* b)
-{
- const device_debug::watchpoint* left = *(device_debug::watchpoint**)a;
- const device_debug::watchpoint* right = *(device_debug::watchpoint**)b;
- const int result = strcmp(left->space().name(), right->space().name());
- return result >= 0;
-}
-
-static int cSpaceDescending(const void* a, const void* b)
-{
- const device_debug::watchpoint* left = *(device_debug::watchpoint**)a;
- const device_debug::watchpoint* right = *(device_debug::watchpoint**)b;
- const int result = strcmp(left->space().name(), right->space().name());
- return result < 0;
-}
-
-static int cAddressAscending(const void* a, const void* b)
-{
- const device_debug::watchpoint* left = *(device_debug::watchpoint**)a;
- const device_debug::watchpoint* right = *(device_debug::watchpoint**)b;
- return left->address() > right->address();
-}
-
-static int cAddressDescending(const void* a, const void* b)
-{
- const device_debug::watchpoint* left = *(device_debug::watchpoint**)a;
- const device_debug::watchpoint* right = *(device_debug::watchpoint**)b;
- return left->address() < right->address();
-}
-
-static int cTypeAscending(const void* a, const void* b)
-{
- const device_debug::watchpoint* left = *(device_debug::watchpoint**)a;
- const device_debug::watchpoint* right = *(device_debug::watchpoint**)b;
- return left->type() > right->type();
-}
-
-static int cTypeDescending(const void* a, const void* b)
-{
- const device_debug::watchpoint* left = *(device_debug::watchpoint**)a;
- const device_debug::watchpoint* right = *(device_debug::watchpoint**)b;
- return left->type() < right->type();
-}
-
-static int cConditionAscending(const void* a, const void* b)
-{
- const device_debug::watchpoint* left = *(device_debug::watchpoint**)a;
- const device_debug::watchpoint* right = *(device_debug::watchpoint**)b;
- const int result = strcmp(left->condition(), right->condition());
- return result >= 0;
-}
-
-static int cConditionDescending(const void* a, const void* b)
-{
- const device_debug::watchpoint* left = *(device_debug::watchpoint**)a;
- const device_debug::watchpoint* right = *(device_debug::watchpoint**)b;
- const int result = strcmp(left->condition(), right->condition());
- return result < 0;
-}
-
-static int cActionAscending(const void* a, const void* b)
+void debug_view_watchpoints::gather_watchpoints()
{
- const device_debug::watchpoint* left = *(device_debug::watchpoint**)a;
- const device_debug::watchpoint* right = *(device_debug::watchpoint**)b;
- const int result = strcmp(left->action(), right->action());
- return result >= 0;
-}
-
-static int cActionDescending(const void* a, const void* b)
-{
- const device_debug::watchpoint* left = *(device_debug::watchpoint**)a;
- const device_debug::watchpoint* right = *(device_debug::watchpoint**)b;
- const int result = strcmp(left->action(), right->action());
- return result < 0;
-}
-
-
-int debug_view_watchpoints::watchpoints(SortMode sort, device_debug::watchpoint**& wpList)
-{
- // Alloc
- int numWPs = 0;
- wpList = NULL;
- for (const debug_view_source *source = m_source_list.first(); source != NULL; source = source->next())
- {
- for (address_spacenum spacenum = AS_0; spacenum < ADDRESS_SPACES; spacenum++)
- {
- /* loop over the watchpoints */
- const device_debug& debugInterface = *source->device()->debug();
- for (device_debug::watchpoint *wp = debugInterface.watchpoint_first(spacenum); wp != NULL; wp = wp->next())
- numWPs++;
- }
- }
- wpList = new device_debug::watchpoint*[numWPs];
-
- int wpAddIndex = 0;
+ m_buffer.resize(0);
for (const debug_view_source *source = m_source_list.first(); source != NULL; source = source->next())
{
// Collect
+ device_debug &debugInterface = *source->device()->debug();
for (address_spacenum spacenum = AS_0; spacenum < ADDRESS_SPACES; spacenum++)
{
- device_debug& debugInterface = *source->device()->debug();
for (device_debug::watchpoint *wp = debugInterface.watchpoint_first(spacenum); wp != NULL; wp = wp->next())
- {
- wpList[wpAddIndex] = wp;
- wpAddIndex++;
- }
+ m_buffer.append() = wp;
}
}
// And now for the sort
- switch (m_sortType)
- {
- case SORT_NONE:
- break;
- case SORT_INDEX_ASCENDING:
- qsort(wpList, numWPs, sizeof(device_debug::watchpoint*), cIndexAscending);
- break;
- case SORT_INDEX_DESCENDING:
- qsort(wpList, numWPs, sizeof(device_debug::watchpoint*), cIndexDescending);
- break;
- case SORT_ENABLED_ASCENDING:
- qsort(wpList, numWPs, sizeof(device_debug::watchpoint*), cEnabledAscending);
- break;
- case SORT_ENABLED_DESCENDING:
- qsort(wpList, numWPs, sizeof(device_debug::watchpoint*), cEnabledDescending);
- break;
- case SORT_CPU_ASCENDING:
- qsort(wpList, numWPs, sizeof(device_debug::watchpoint*), cCpuAscending);
- break;
- case SORT_CPU_DESCENDING:
- qsort(wpList, numWPs, sizeof(device_debug::watchpoint*), cCpuDescending);
- break;
- case SORT_SPACE_ASCENDING:
- qsort(wpList, numWPs, sizeof(device_debug::watchpoint*), cSpaceAscending);
- break;
- case SORT_SPACE_DESCENDING:
- qsort(wpList, numWPs, sizeof(device_debug::watchpoint*), cSpaceDescending);
- break;
- case SORT_ADDRESS_ASCENDING:
- qsort(wpList, numWPs, sizeof(device_debug::watchpoint*), cAddressAscending);
- break;
- case SORT_ADDRESS_DESCENDING:
- qsort(wpList, numWPs, sizeof(device_debug::watchpoint*), cAddressDescending);
- break;
- case SORT_TYPE_ASCENDING:
- qsort(wpList, numWPs, sizeof(device_debug::watchpoint*), cTypeAscending);
- break;
- case SORT_TYPE_DESCENDING:
- qsort(wpList, numWPs, sizeof(device_debug::watchpoint*), cTypeDescending);
- break;
- case SORT_CONDITION_ASCENDING:
- qsort(wpList, numWPs, sizeof(device_debug::watchpoint*), cConditionAscending);
- break;
- case SORT_CONDITION_DESCENDING:
- qsort(wpList, numWPs, sizeof(device_debug::watchpoint*), cConditionDescending);
- break;
- case SORT_ACTION_ASCENDING:
- qsort(wpList, numWPs, sizeof(device_debug::watchpoint*), cActionAscending);
- break;
- case SORT_ACTION_DESCENDING:
- qsort(wpList, numWPs, sizeof(device_debug::watchpoint*), cActionDescending);
- break;
- }
-
- return numWPs;
+ qsort(&m_buffer[0], m_buffer.count(), sizeof(device_debug::watchpoint *), m_sortType);
}
@@ -375,119 +252,110 @@ int debug_view_watchpoints::watchpoints(SortMode sort, device_debug::watchpoint*
void debug_view_watchpoints::view_update()
{
// Gather a list of all the watchpoints for all the CPUs
- device_debug::watchpoint** wpList = NULL;
- const int numWPs = watchpoints(SORT_NONE, wpList);
+ gather_watchpoints();
// Set the view region so the scroll bars update
- m_total.y = numWPs+1;
+ m_total.x = tableBreaks[ARRAY_LENGTH(tableBreaks) - 1];
+ m_total.y = m_buffer.count() + 1;
+ if (m_total.y < 10)
+ m_total.y = 10;
// Draw
- debug_view_char *dest = m_viewdata;
- for (int row = 0; row < m_visible.y; row++)
- {
- UINT32 effrow = m_topleft.y + row;
+ debug_view_char *dest = m_viewdata;
+ astring linebuf;
- // Header
- if (row == 0)
+ // Header
+ if (m_visible.y > 0)
+ {
+ linebuf.reset();
+ linebuf.cat("ID");
+ if (m_sortType == &cIndexAscending) linebuf.cat('\\');
+ else if (m_sortType == &cIndexDescending) linebuf.cat('/');
+ pad_astring_to_length(linebuf, tableBreaks[0]);
+ linebuf.cat("En");
+ if (m_sortType == &cEnabledAscending) linebuf.cat('\\');
+ else if (m_sortType == &cEnabledDescending) linebuf.cat('/');
+ pad_astring_to_length(linebuf, tableBreaks[1]);
+ linebuf.cat("CPU");
+ if (m_sortType == &cCpuAscending) linebuf.cat('\\');
+ else if (m_sortType == &cCpuDescending) linebuf.cat('/');
+ pad_astring_to_length(linebuf, tableBreaks[2]);
+ linebuf.cat("Space");
+ if (m_sortType == &cSpaceAscending) linebuf.cat('\\');
+ else if (m_sortType == &cSpaceDescending) linebuf.cat('/');
+ pad_astring_to_length(linebuf, tableBreaks[3]);
+ linebuf.cat("Addresses");
+ if (m_sortType == &cAddressAscending) linebuf.cat('\\');
+ else if (m_sortType == &cAddressDescending) linebuf.cat('/');
+ pad_astring_to_length(linebuf, tableBreaks[4]);
+ linebuf.cat("Type");
+ if (m_sortType == &cTypeAscending) linebuf.cat('\\');
+ else if (m_sortType == &cTypeDescending) linebuf.cat('/');
+ pad_astring_to_length(linebuf, tableBreaks[5]);
+ linebuf.cat("Condition");
+ if (m_sortType == &cConditionAscending) linebuf.cat('\\');
+ else if (m_sortType == &cConditionDescending) linebuf.cat('/');
+ pad_astring_to_length(linebuf, tableBreaks[6]);
+ linebuf.cat("Action");
+ if (m_sortType == &cActionAscending) linebuf.cat('\\');
+ else if (m_sortType == &cActionDescending) linebuf.cat('/');
+ pad_astring_to_length(linebuf, tableBreaks[7]);
+
+ for (UINT32 i = m_topleft.x; i < (m_topleft.x + m_visible.x); i++, dest++)
{
- astring header;
- header.printf("ID");
- if (m_sortType == SORT_INDEX_ASCENDING) header.catprintf("\\");
- else if (m_sortType == SORT_INDEX_DESCENDING) header.catprintf("/");
- pad_astring_to_length(header, tableBreaks[0]);
- header.catprintf("En");
- if (m_sortType == SORT_ENABLED_ASCENDING) header.catprintf("\\");
- else if (m_sortType == SORT_ENABLED_DESCENDING) header.catprintf("/");
- pad_astring_to_length(header, tableBreaks[1]);
- header.catprintf("CPU");
- if (m_sortType == SORT_CPU_ASCENDING) header.catprintf("\\");
- else if (m_sortType == SORT_CPU_DESCENDING) header.catprintf("/");
- pad_astring_to_length(header, tableBreaks[2]);
- header.catprintf("Space");
- if (m_sortType == SORT_SPACE_ASCENDING) header.catprintf("\\");
- else if (m_sortType == SORT_SPACE_DESCENDING) header.catprintf("/");
- pad_astring_to_length(header, tableBreaks[3]);
- header.catprintf("Addresses");
- if (m_sortType == SORT_ADDRESS_ASCENDING) header.catprintf("\\");
- else if (m_sortType == SORT_ADDRESS_DESCENDING) header.catprintf("/");
- pad_astring_to_length(header, tableBreaks[4]);
- header.catprintf("Type");
- if (m_sortType == SORT_TYPE_ASCENDING) header.catprintf("\\");
- else if (m_sortType == SORT_TYPE_DESCENDING) header.catprintf("/");
- pad_astring_to_length(header, tableBreaks[5]);
- header.catprintf("Condition");
- if (m_sortType == SORT_CONDITION_ASCENDING) header.catprintf("\\");
- else if (m_sortType == SORT_CONDITION_DESCENDING) header.catprintf("/");
- pad_astring_to_length(header, tableBreaks[6]);
- header.catprintf("Action");
- if (m_sortType == SORT_ACTION_ASCENDING) header.catprintf("\\");
- else if (m_sortType == SORT_ACTION_DESCENDING) header.catprintf("/");
- pad_astring_to_length(header, tableBreaks[7]);
-
- for (int i = 0; i < m_visible.x; i++)
- {
- dest->byte = (i < header.len()) ? header[i] : ' ';
- dest->attrib = DCA_ANCILLARY;
- dest++;
- }
- continue;
+ dest->byte = (i < linebuf.len()) ? linebuf[i] : ' ';
+ dest->attrib = DCA_ANCILLARY;
}
+ }
+ for (int row = 1; row < m_visible.y; row++)
+ {
// watchpoints
- int wpi = effrow-1;
- if (wpi < numWPs && wpi >= 0)
+ int const wpi = row + m_topleft.y - 1;
+ if ((wpi < m_buffer.count()) && wpi >= 0)
{
- static const char *const types[] = { "unkn ", "read ", "write", "r/w " };
- device_debug::watchpoint* wp = wpList[wpi];
-
- astring buffer;
- buffer.printf("%X", wp->index());
- pad_astring_to_length(buffer, tableBreaks[0]);
- buffer.catprintf("%c", wp->enabled() ? 'X' : 'O');
- pad_astring_to_length(buffer, tableBreaks[1]);
- buffer.catprintf("%s", wp->debugInterface()->device().tag());
- pad_astring_to_length(buffer, tableBreaks[2]);
- buffer.catprintf("%s", wp->space().name());
- pad_astring_to_length(buffer, tableBreaks[3]);
- buffer.catprintf("%s-%s",
- core_i64_hex_format(wp->space().byte_to_address(wp->address()), wp->space().addrchars()),
- core_i64_hex_format(wp->space().byte_to_address_end(wp->address() + wp->length()) - 1, wp->space().addrchars()));
- pad_astring_to_length(buffer, tableBreaks[4]);
- buffer.catprintf("%s", types[wp->type() & 3]);
- pad_astring_to_length(buffer, tableBreaks[5]);
- if (astring(wp->condition()) != astring("1"))
- {
- buffer.catprintf("%s", wp->condition());
- pad_astring_to_length(buffer, tableBreaks[6]);
- }
- if (astring(wp->action()) != astring(""))
+ static char const *const types[] = { "unkn ", "read ", "write", "r/w " };
+ device_debug::watchpoint *const wp = m_buffer[wpi];
+
+ linebuf.reset();
+ linebuf.catprintf("%2X", wp->index());
+ pad_astring_to_length(linebuf, tableBreaks[0]);
+ linebuf.cat(wp->enabled() ? 'X' : 'O');
+ pad_astring_to_length(linebuf, tableBreaks[1]);
+ linebuf.cat(wp->debugInterface()->device().tag());
+ pad_astring_to_length(linebuf, tableBreaks[2]);
+ linebuf.cat(wp->space().name());
+ pad_astring_to_length(linebuf, tableBreaks[3]);
+ linebuf.cat(core_i64_hex_format(wp->space().byte_to_address(wp->address()), wp->space().addrchars()));
+ linebuf.cat('-');
+ linebuf.cat(core_i64_hex_format(wp->space().byte_to_address_end(wp->address() + wp->length()) - 1, wp->space().addrchars()));
+ pad_astring_to_length(linebuf, tableBreaks[4]);
+ linebuf.cat(types[wp->type() & 3]);
+ pad_astring_to_length(linebuf, tableBreaks[5]);
+ if (strcmp(wp->condition(), "1"))
+ linebuf.cat(wp->condition());
+ pad_astring_to_length(linebuf, tableBreaks[6]);
+ linebuf.cat(wp->action());
+ pad_astring_to_length(linebuf, tableBreaks[7]);
+
+ for (UINT32 i = m_topleft.x; i < (m_topleft.x + m_visible.x); i++, dest++)
{
- buffer.catprintf("%s", wp->action());
- pad_astring_to_length(buffer, tableBreaks[7]);
- }
-
- for (int i = 0; i < m_visible.x; i++)
- {
- dest->byte = (i < buffer.len()) ? buffer[i] : ' ';
+ dest->byte = (i < linebuf.len()) ? linebuf[i] : ' ';
dest->attrib = DCA_NORMAL;
// Color disabled watchpoints red
- if (i == 5 && dest->byte == 'O')
- dest->attrib = DCA_CHANGED;
-
- dest++;
+ if ((i >= tableBreaks[0]) && (i < tableBreaks[1]) && !wp->enabled())
+ dest->attrib |= DCA_CHANGED;
}
- continue;
}
-
- // Fill the remaining vertical space
- for (int i = 0; i < m_visible.x; i++)
+ else
{
- dest->byte = ' ';
- dest->attrib = DCA_NORMAL;
- dest++;
+ // Fill the remaining vertical space
+ for (int i = 0; i < m_visible.x; i++, dest++)
+ {
+ dest->byte = ' ';
+ dest->attrib = DCA_NORMAL;
+ }
}
}
-
- delete[] wpList;
}
diff --git a/src/emu/debug/dvwpoints.h b/src/emu/debug/dvwpoints.h
index 6414b3b0424..b714a168ecd 100644
--- a/src/emu/debug/dvwpoints.h
+++ b/src/emu/debug/dvwpoints.h
@@ -34,31 +34,6 @@ class debug_view_watchpoints : public debug_view
debug_view_watchpoints(running_machine &machine, debug_view_osd_update_func osdupdate, void *osdprivate);
virtual ~debug_view_watchpoints();
-public:
- enum SortMode
- {
- SORT_NONE,
- SORT_INDEX_ASCENDING,
- SORT_INDEX_DESCENDING,
- SORT_ENABLED_ASCENDING,
- SORT_ENABLED_DESCENDING,
- SORT_CPU_ASCENDING,
- SORT_CPU_DESCENDING,
- SORT_SPACE_ASCENDING,
- SORT_SPACE_DESCENDING,
- SORT_ADDRESS_ASCENDING,
- SORT_ADDRESS_DESCENDING,
- SORT_TYPE_ASCENDING,
- SORT_TYPE_DESCENDING,
- SORT_CONDITION_ASCENDING,
- SORT_CONDITION_DESCENDING,
- SORT_ACTION_ASCENDING,
- SORT_ACTION_DESCENDING
- };
-
- // getters
- // setters
-
protected:
// view overrides
virtual void view_update();
@@ -68,11 +43,12 @@ private:
// internal helpers
void enumerate_sources();
void pad_astring_to_length(astring& str, int len);
- int watchpoints(SortMode sort, device_debug::watchpoint**& bpList);
+ void gather_watchpoints();
// internal state
- SortMode m_sortType;
+ int (*m_sortType)(void const *, void const *);
+ dynamic_array<device_debug::watchpoint *> m_buffer;
};
diff --git a/src/emu/video/315_5124.c b/src/emu/video/315_5124.c
index 2fba1f6f78f..d221e847645 100644
--- a/src/emu/video/315_5124.c
+++ b/src/emu/video/315_5124.c
@@ -254,21 +254,27 @@ void sega315_5124_device::set_display_settings()
}
}
+ set_frame_timing();
+ m_cram_dirty = 1;
+}
+
+
+void sega315_5124_device::set_frame_timing()
+{
switch (m_y_pixels)
{
- case 192:
- m_frame_timing = (m_is_pal) ? pal_192 : ntsc_192;
- break;
+ case 192:
+ m_frame_timing = (m_is_pal) ? pal_192 : ntsc_192;
+ break;
- case 224:
- m_frame_timing = (m_is_pal) ? pal_224 : ntsc_224;
- break;
+ case 224:
+ m_frame_timing = (m_is_pal) ? pal_224 : ntsc_224;
+ break;
- case 240:
- m_frame_timing = (m_is_pal) ? pal_240 : ntsc_240;
- break;
+ case 240:
+ m_frame_timing = (m_is_pal) ? pal_240 : ntsc_240;
+ break;
}
- m_cram_dirty = 1;
}
@@ -675,7 +681,7 @@ WRITE8_MEMBER( sega315_5124_device::register_write )
case 2: /* VDP register write */
reg_num = data & 0x0f;
m_reg[reg_num] = m_addr & 0xff;
- //logerror("%s: %s: setting register %x to %02x\n", machine().describe_context(), tag(), reg_num, m_addr & 0xf );
+ //logerror("%s: %s: setting register %x to %02x\n", machine().describe_context(), tag(), reg_num, m_addr & 0xff);
switch (reg_num)
{
@@ -1441,7 +1447,7 @@ void sega315_5124_device::update_palette()
{
int i;
- /* Exit if palette is has no changes */
+ /* Exit if palette has no changes */
if (m_cram_dirty == 0)
{
return;
@@ -1468,7 +1474,7 @@ void sega315_5378_device::update_palette()
{
int i;
- /* Exit if palette is has no changes */
+ /* Exit if palette has no changes */
if (m_cram_dirty == 0)
{
return;
@@ -1557,20 +1563,7 @@ void sega315_5124_device::stop_timers()
void sega315_5124_device::vdp_postload()
{
- switch (m_y_pixels)
- {
- case 192:
- m_frame_timing = (m_is_pal) ? pal_192 : ntsc_192;
- break;
-
- case 224:
- m_frame_timing = (m_is_pal) ? pal_224 : ntsc_224;
- break;
-
- case 240:
- m_frame_timing = (m_is_pal) ? pal_240 : ntsc_240;
- break;
- }
+ set_frame_timing();
}
void sega315_5124_device::device_start()
diff --git a/src/emu/video/315_5124.h b/src/emu/video/315_5124.h
index fa4a7418bb6..04c5ff8cc65 100644
--- a/src/emu/video/315_5124.h
+++ b/src/emu/video/315_5124.h
@@ -91,6 +91,7 @@ public:
protected:
void set_display_settings();
+ void set_frame_timing();
virtual void update_palette();
virtual void cram_write(UINT8 data);
virtual void draw_scanline( int pixel_offset_x, int pixel_plot_y, int line );
diff --git a/src/mame/drivers/bfm_sc1.c b/src/mame/drivers/bfm_sc1.c
index d01add6ee5a..4bc2edf238b 100644
--- a/src/mame/drivers/bfm_sc1.c
+++ b/src/mame/drivers/bfm_sc1.c
@@ -2601,7 +2601,7 @@ ROM_END
#define GAME_FLAGS GAME_SUPPORTS_SAVE|GAME_REQUIRES_ARTWORK|GAME_NOT_WORKING|GAME_MECHANICAL
//Adder 2
-GAME( 1996, m_tppokr , 0 , scorpion1_adder2 , toppoker , bfm_sc1_state, toppoker , 0, "BFM/ELAM", "Top Poker (Dutch, Game Card 95-750-899)", GAME_FLAGS )
+GAME( 1996, m_tppokr , 0 , scorpion1_adder2 , toppoker , bfm_sc1_state, toppoker , 0, "BFM/ELAM", "Top Poker (Dutch, Game Card 95-750-899)", GAME_SUPPORTS_SAVE|GAME_NOT_WORKING )
/********************************************************************************************************************************************************************************************************************
diff --git a/src/mame/drivers/mpu4avan.c b/src/mame/drivers/mpu4avan.c
index fb1b3c68602..22d21f60a2b 100644
--- a/src/mame/drivers/mpu4avan.c
+++ b/src/mame/drivers/mpu4avan.c
@@ -12,7 +12,7 @@
MACHINE_CONFIG_EXTERN( mod4oki );
INPUT_PORTS_EXTERN( mpu4 );
-#define GAME_FLAGS (GAME_NOT_WORKING|GAME_REQUIRES_ARTWORK)
+#define GAME_FLAGS (GAME_NOT_WORKING|GAME_REQUIRES_ARTWORK|GAME_MECHANICAL)
diff --git a/src/mame/drivers/mpu4bwb.c b/src/mame/drivers/mpu4bwb.c
index c755726b423..a9895c33caa 100644
--- a/src/mame/drivers/mpu4bwb.c
+++ b/src/mame/drivers/mpu4bwb.c
@@ -29,7 +29,7 @@ MACHINE_CONFIG_EXTERN( bwboki );
MACHINE_CONFIG_EXTERN( mod2 );
INPUT_PORTS_EXTERN( mpu4 );
-#define GAME_FLAGS (GAME_NOT_WORKING|GAME_REQUIRES_ARTWORK)
+#define GAME_FLAGS (GAME_NOT_WORKING|GAME_REQUIRES_ARTWORK|GAME_MECHANICAL)
#define M4BIGMT_EXTRA_ROMS \
diff --git a/src/mame/drivers/mpu4concept.c b/src/mame/drivers/mpu4concept.c
index 4f072a69219..f5e7ccd769c 100644
--- a/src/mame/drivers/mpu4concept.c
+++ b/src/mame/drivers/mpu4concept.c
@@ -6,7 +6,7 @@
MACHINE_CONFIG_EXTERN( mod4oki );
INPUT_PORTS_EXTERN( mpu4 );
-#define GAME_FLAGS (GAME_NOT_WORKING|GAME_REQUIRES_ARTWORK)
+#define GAME_FLAGS (GAME_NOT_WORKING|GAME_REQUIRES_ARTWORK|GAME_MECHANICAL)
#define M4RHFEVC_EXTRA_ROMS \
diff --git a/src/mame/drivers/mpu4crystal.c b/src/mame/drivers/mpu4crystal.c
index 40fe6bd6a4a..67658515a7a 100644
--- a/src/mame/drivers/mpu4crystal.c
+++ b/src/mame/drivers/mpu4crystal.c
@@ -9,7 +9,7 @@ MACHINE_CONFIG_EXTERN( mod4oki );
MACHINE_CONFIG_EXTERN( mpu4crys );
INPUT_PORTS_EXTERN( mpu4 );
-#define GAME_FLAGS (GAME_NOT_WORKING|GAME_REQUIRES_ARTWORK)
+#define GAME_FLAGS (GAME_NOT_WORKING|GAME_REQUIRES_ARTWORK|GAME_MECHANICAL)
diff --git a/src/mame/drivers/mpu4empire.c b/src/mame/drivers/mpu4empire.c
index a7ee368c20c..5bd53d7cf3a 100644
--- a/src/mame/drivers/mpu4empire.c
+++ b/src/mame/drivers/mpu4empire.c
@@ -7,7 +7,7 @@
MACHINE_CONFIG_EXTERN( mod4oki );
INPUT_PORTS_EXTERN( mpu4 );
-#define GAME_FLAGS (GAME_NOT_WORKING|GAME_REQUIRES_ARTWORK)
+#define GAME_FLAGS (GAME_NOT_WORKING|GAME_REQUIRES_ARTWORK|GAME_MECHANICAL)
ROM_START( m4apachg )
diff --git a/src/mame/drivers/mpu4mdm.c b/src/mame/drivers/mpu4mdm.c
index 904d8a8a0c2..9b2a27a16c9 100644
--- a/src/mame/drivers/mpu4mdm.c
+++ b/src/mame/drivers/mpu4mdm.c
@@ -7,7 +7,7 @@
MACHINE_CONFIG_EXTERN( mod4oki );
INPUT_PORTS_EXTERN( mpu4 );
-#define GAME_FLAGS (GAME_NOT_WORKING|GAME_REQUIRES_ARTWORK)
+#define GAME_FLAGS (GAME_NOT_WORKING|GAME_REQUIRES_ARTWORK|GAME_MECHANICAL)
diff --git a/src/mame/drivers/mpu4misc.c b/src/mame/drivers/mpu4misc.c
index 0ee02bcddb7..e3b60efb369 100644
--- a/src/mame/drivers/mpu4misc.c
+++ b/src/mame/drivers/mpu4misc.c
@@ -6,7 +6,7 @@
MACHINE_CONFIG_EXTERN( mod4oki );
INPUT_PORTS_EXTERN( mpu4 );
-#define GAME_FLAGS (GAME_NOT_WORKING|GAME_REQUIRES_ARTWORK)
+#define GAME_FLAGS (GAME_NOT_WORKING|GAME_REQUIRES_ARTWORK|GAME_MECHANICAL)
diff --git a/src/mame/drivers/mpu4mod2sw.c b/src/mame/drivers/mpu4mod2sw.c
index 052ba25ca40..eb2fb738051 100644
--- a/src/mame/drivers/mpu4mod2sw.c
+++ b/src/mame/drivers/mpu4mod2sw.c
@@ -24,7 +24,7 @@ INPUT_PORTS_EXTERN( mpu4jackpot8tkn );
-#define GAME_FLAGS (GAME_NOT_WORKING|GAME_REQUIRES_ARTWORK)
+#define GAME_FLAGS (GAME_NOT_WORKING|GAME_REQUIRES_ARTWORK|GAME_MECHANICAL)
DRIVER_INIT_MEMBER( mpu4_state, m4_showstring_mod2 )
{
diff --git a/src/mame/drivers/mpu4plasma.c b/src/mame/drivers/mpu4plasma.c
index 0eb1f08574c..ae2f9d7f18a 100644
--- a/src/mame/drivers/mpu4plasma.c
+++ b/src/mame/drivers/mpu4plasma.c
@@ -189,7 +189,7 @@ ROM_START( m4elite )
M4ELITE_PLASMA
ROM_END
-#define GAME_FLAGS (GAME_NOT_WORKING|GAME_REQUIRES_ARTWORK)
+#define GAME_FLAGS (GAME_NOT_WORKING|GAME_REQUIRES_ARTWORK|GAME_MECHANICAL)
GAMEL(199?, m4bigchf ,0 ,mpu4plasma ,mpu4 , mpu4_state,m4default ,ROT0, "Barcrest","Big Chief (Barcrest) (MPU4 w/ Plasma DMD) (set 1)", GAME_FLAGS|GAME_NO_SOUND,layout_mpu4plasma )
GAMEL(199?, m4bigchfa ,m4bigchf ,mpu4plasma ,mpu4 , mpu4_state,m4default ,ROT0, "Barcrest","Big Chief (Barcrest) (MPU4 w/ Plasma DMD) (set 2)", GAME_FLAGS|GAME_NO_SOUND,layout_mpu4plasma )
diff --git a/src/mame/drivers/mpu4sw.c b/src/mame/drivers/mpu4sw.c
index 511c3e1e3f1..e8a86467b25 100644
--- a/src/mame/drivers/mpu4sw.c
+++ b/src/mame/drivers/mpu4sw.c
@@ -25,7 +25,7 @@ INPUT_PORTS_EXTERN( grtecp );
INPUT_PORTS_EXTERN( mpu4jackpot8tkn );
INPUT_PORTS_EXTERN( mpu4jackpot8per );
-#define GAME_FLAGS (GAME_NOT_WORKING|GAME_REQUIRES_ARTWORK)
+#define GAME_FLAGS (GAME_NOT_WORKING|GAME_REQUIRES_ARTWORK|GAME_MECHANICAL)
DRIVER_INIT_MEMBER(mpu4_state,m4debug)
{
diff --git a/src/mame/drivers/mpu4union.c b/src/mame/drivers/mpu4union.c
index a7a5ec976b7..1c27269817c 100644
--- a/src/mame/drivers/mpu4union.c
+++ b/src/mame/drivers/mpu4union.c
@@ -7,7 +7,7 @@ MACHINE_CONFIG_EXTERN( mod4oki );
MACHINE_CONFIG_EXTERN( mod2 );
INPUT_PORTS_EXTERN( mpu4 );
-#define GAME_FLAGS (GAME_NOT_WORKING|GAME_REQUIRES_ARTWORK)
+#define GAME_FLAGS (GAME_NOT_WORKING|GAME_REQUIRES_ARTWORK|GAME_MECHANICAL)
ROM_START( m4cwalk )
diff --git a/src/mame/drivers/sumt8035.c b/src/mame/drivers/sumt8035.c
index 51f30ff5d33..fa77c9523b9 100644
--- a/src/mame/drivers/sumt8035.c
+++ b/src/mame/drivers/sumt8035.c
@@ -254,5 +254,5 @@ ROM_START( sm_ultng )
ROM_END
-GAME( 1981, sm_ngacc, 0, summit, summit, driver_device, 0, ROT270, "Summit Coin", "Nudge Accumulator (Summit Coin)", GAME_IS_SKELETON )
-GAME( 1981, sm_ultng, 0, summit, summit, driver_device, 0, ROT270, "Summit Coin", "Ultimate Nudge (Summit Coin)", GAME_IS_SKELETON )
+GAME( 1981, sm_ngacc, 0, summit, summit, driver_device, 0, ROT270, "Summit Coin", "Nudge Accumulator (Summit Coin)", GAME_IS_SKELETON_MECHANICAL )
+GAME( 1981, sm_ultng, 0, summit, summit, driver_device, 0, ROT270, "Summit Coin", "Ultimate Nudge (Summit Coin)", GAME_IS_SKELETON_MECHANICAL )
diff --git a/src/mame/drivers/vaportra.c b/src/mame/drivers/vaportra.c
index cadb2287490..1a19f263ede 100644
--- a/src/mame/drivers/vaportra.c
+++ b/src/mame/drivers/vaportra.c
@@ -215,11 +215,11 @@ void vaportra_state::machine_reset()
static MACHINE_CONFIG_START( vaportra, vaportra_state )
/* basic machine hardware */
- MCFG_CPU_ADD("maincpu", M68000,12000000) /* Custom chip 59 */
+ MCFG_CPU_ADD("maincpu", M68000,XTAL_24MHz/2) /* Custom chip 59 */
MCFG_CPU_PROGRAM_MAP(main_map)
MCFG_CPU_VBLANK_INT_DRIVER("screen", vaportra_state, irq6_line_hold)
- MCFG_CPU_ADD("audiocpu", H6280, 32220000/4) /* Custom chip 45; Audio section crystal is 32.220 MHz */
+ MCFG_CPU_ADD("audiocpu", H6280, XTAL_24MHz/4) /* Custom chip 45; Audio section crystal is 32.220 MHz but CPU clock is confirmed as coming from the 24MHz crystal (6Mhz exactly on the CPU) */
MCFG_CPU_PROGRAM_MAP(sound_map)
@@ -278,18 +278,18 @@ static MACHINE_CONFIG_START( vaportra, vaportra_state )
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")
- MCFG_SOUND_ADD("ym1", YM2203, 32220000/8)
+ MCFG_SOUND_ADD("ym1", YM2203, XTAL_32_22MHz/8)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.60)
- MCFG_YM2151_ADD("ym2", 32220000/9)
+ MCFG_YM2151_ADD("ym2", XTAL_32_22MHz/9) // uses a preset LS163 to force the odd speed
MCFG_YM2151_IRQ_HANDLER(INPUTLINE("audiocpu", 1)) /* IRQ 2 */
MCFG_SOUND_ROUTE(0, "mono", 0.60)
MCFG_SOUND_ROUTE(1, "mono", 0.60)
- MCFG_OKIM6295_ADD("oki1", 32220000/32, OKIM6295_PIN7_HIGH)
+ MCFG_OKIM6295_ADD("oki1", XTAL_32_22MHz/32, OKIM6295_PIN7_HIGH)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75)
- MCFG_OKIM6295_ADD("oki2", 32220000/16, OKIM6295_PIN7_HIGH)
+ MCFG_OKIM6295_ADD("oki2", XTAL_32_22MHz/16, OKIM6295_PIN7_HIGH)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.60)
MACHINE_CONFIG_END
@@ -840,7 +840,7 @@ DRIVER_INIT_MEMBER(vaportra_state,vaportra)
int i;
for (i = 0x00000; i < 0x80000; i++)
- RAM[i] = (RAM[i] & 0x7e) | ((RAM[i] & 0x01) << 7) | ((RAM[i] & 0x80) >> 7);
+ RAM[i] = BITSWAP8(RAM[i],0,6,5,4,3,2,1,7);
}
/******************************************************************************/
diff --git a/src/mame/drivers/wms.c b/src/mame/drivers/wms.c
index 607ab3cab1e..de809fa3f76 100644
--- a/src/mame/drivers/wms.c
+++ b/src/mame/drivers/wms.c
@@ -376,28 +376,28 @@ DRIVER_INIT_MEMBER(wms_state,wms)
{
}
-GAME( 200?, wms, 0, wms, wms, wms_state, wms, ROT0, "WMS", "WMS SetUp/Clear Chips (set 1)", GAME_IS_SKELETON )
-GAME( 200?, wmsa, wms, wms, wms, wms_state, wms, ROT0, "WMS", "WMS SetUp/Clear Chips (set 2)", GAME_IS_SKELETON )
-GAME( 200?, wmsb, wms, wms, wms, wms_state, wms, ROT0, "WMS", "WMS SetUp/Clear Chips (set 3)", GAME_IS_SKELETON )
-
-GAME( 200?, btippers, 0, wms, wms, wms_state, wms, ROT0, "WMS", "Big Tippers (Russia)", GAME_IS_SKELETON )
-GAME( 200?, wmsboom, 0, wms, wms, wms_state, wms, ROT0, "WMS", "Boom (Russia)", GAME_IS_SKELETON )
-GAME( 200?, cashcrop, 0, wms, wms, wms_state, wms, ROT0, "WMS", "Cash Crop (Russia)", GAME_IS_SKELETON )
-GAME( 200?, filthyr, 0, wms, wms, wms_state, wms, ROT0, "WMS", "Filthy Rich (Russia)", GAME_IS_SKELETON )
-GAME( 200?, hottop, 0, wms, wms, wms_state, wms, ROT0, "WMS", "Hot Toppings (Russia)", GAME_IS_SKELETON )
-GAME( 200?, inwinner, 0, wms, wms, wms_state, wms, ROT0, "WMS", "Instant Winner (Russia)", GAME_IS_SKELETON )
-GAME( 200?, jptparty, 0, wms, wms, wms_state, wms, ROT0, "WMS", "Jackpot Party (Russia)", GAME_IS_SKELETON )
-GAME( 200?, leprgld, 0, wms, wms, wms_state, wms, ROT0, "WMS", "Leprechaun's Gold (Russia)", GAME_IS_SKELETON )
-GAME( 200?, lol, 0, wms, wms, wms_state, wms, ROT0, "WMS", "Life of Luxury (Russia)", GAME_IS_SKELETON )
-GAME( 200?, lovewin, 0, wms, wms, wms_state, wms, ROT0, "WMS", "Love To Win (Russia)", GAME_IS_SKELETON )
-GAME( 200?, mtburn, 0, wms, wms, wms_state, wms, ROT0, "WMS", "Money To Burn (Russia)", GAME_IS_SKELETON )
-GAME( 200?, otchart, 0, wms, wms, wms_state, wms, ROT0, "WMS", "Off The Charts (Russia)", GAME_IS_SKELETON )
-GAME( 200?, perfect, 0, wms, wms, wms_state, wms, ROT0, "WMS", "Perfect Game (Russia)", GAME_IS_SKELETON )
-GAME( 200?, reelemin, 0, wms, wms, wms_state, wms, ROT0, "WMS", "Reel 'Em In (Russia)", GAME_IS_SKELETON )
-GAME( 200?, sonoth, 0, wms, wms, wms_state, wms, ROT0, "WMS", "Something For Nothing (Russia)", GAME_IS_SKELETON )
-GAME( 200?, swingin, 0, wms, wms, wms_state, wms, ROT0, "WMS", "Swingin In The Green (Russia)", GAME_IS_SKELETON )
-GAME( 200?, wmstopb, 0, wms, wms, wms_state, wms, ROT0, "WMS", "Top Banana (Russia)", GAME_IS_SKELETON )
-GAME( 200?, wdun, 0, wms, wms, wms_state, wms, ROT0, "WMS", "Who Dunnit (Russia)", GAME_IS_SKELETON )
-GAME( 200?, winbid, 0, wms, wms, wms_state, wms, ROT0, "WMS", "Winning Bid (Russia)", GAME_IS_SKELETON )
-GAME( 200?, wldstrek, 0, wms, wms, wms_state, wms, ROT0, "WMS", "Wild Streak (Russia)", GAME_IS_SKELETON )
-GAME( 200?, yukongld, 0, wms, wms, wms_state, wms, ROT0, "WMS", "Yukon Gold (Russia)", GAME_IS_SKELETON )
+GAME( 200?, wms, 0, wms, wms, wms_state, wms, ROT0, "WMS", "WMS SetUp/Clear Chips (set 1)", GAME_IS_SKELETON_MECHANICAL )
+GAME( 200?, wmsa, wms, wms, wms, wms_state, wms, ROT0, "WMS", "WMS SetUp/Clear Chips (set 2)", GAME_IS_SKELETON_MECHANICAL )
+GAME( 200?, wmsb, wms, wms, wms, wms_state, wms, ROT0, "WMS", "WMS SetUp/Clear Chips (set 3)", GAME_IS_SKELETON_MECHANICAL )
+
+GAME( 200?, btippers, 0, wms, wms, wms_state, wms, ROT0, "WMS", "Big Tippers (Russia)", GAME_IS_SKELETON_MECHANICAL )
+GAME( 200?, wmsboom, 0, wms, wms, wms_state, wms, ROT0, "WMS", "Boom (Russia)", GAME_IS_SKELETON_MECHANICAL )
+GAME( 200?, cashcrop, 0, wms, wms, wms_state, wms, ROT0, "WMS", "Cash Crop (Russia)", GAME_IS_SKELETON_MECHANICAL )
+GAME( 200?, filthyr, 0, wms, wms, wms_state, wms, ROT0, "WMS", "Filthy Rich (Russia)", GAME_IS_SKELETON_MECHANICAL )
+GAME( 200?, hottop, 0, wms, wms, wms_state, wms, ROT0, "WMS", "Hot Toppings (Russia)", GAME_IS_SKELETON_MECHANICAL )
+GAME( 200?, inwinner, 0, wms, wms, wms_state, wms, ROT0, "WMS", "Instant Winner (Russia)", GAME_IS_SKELETON_MECHANICAL )
+GAME( 200?, jptparty, 0, wms, wms, wms_state, wms, ROT0, "WMS", "Jackpot Party (Russia)", GAME_IS_SKELETON_MECHANICAL )
+GAME( 200?, leprgld, 0, wms, wms, wms_state, wms, ROT0, "WMS", "Leprechaun's Gold (Russia)", GAME_IS_SKELETON_MECHANICAL )
+GAME( 200?, lol, 0, wms, wms, wms_state, wms, ROT0, "WMS", "Life of Luxury (Russia)", GAME_IS_SKELETON_MECHANICAL )
+GAME( 200?, lovewin, 0, wms, wms, wms_state, wms, ROT0, "WMS", "Love To Win (Russia)", GAME_IS_SKELETON_MECHANICAL )
+GAME( 200?, mtburn, 0, wms, wms, wms_state, wms, ROT0, "WMS", "Money To Burn (Russia)", GAME_IS_SKELETON_MECHANICAL )
+GAME( 200?, otchart, 0, wms, wms, wms_state, wms, ROT0, "WMS", "Off The Charts (Russia)", GAME_IS_SKELETON_MECHANICAL )
+GAME( 200?, perfect, 0, wms, wms, wms_state, wms, ROT0, "WMS", "Perfect Game (Russia)", GAME_IS_SKELETON_MECHANICAL )
+GAME( 200?, reelemin, 0, wms, wms, wms_state, wms, ROT0, "WMS", "Reel 'Em In (Russia)", GAME_IS_SKELETON_MECHANICAL )
+GAME( 200?, sonoth, 0, wms, wms, wms_state, wms, ROT0, "WMS", "Something For Nothing (Russia)", GAME_IS_SKELETON_MECHANICAL )
+GAME( 200?, swingin, 0, wms, wms, wms_state, wms, ROT0, "WMS", "Swingin In The Green (Russia)", GAME_IS_SKELETON_MECHANICAL )
+GAME( 200?, wmstopb, 0, wms, wms, wms_state, wms, ROT0, "WMS", "Top Banana (Russia)", GAME_IS_SKELETON_MECHANICAL )
+GAME( 200?, wdun, 0, wms, wms, wms_state, wms, ROT0, "WMS", "Who Dunnit (Russia)", GAME_IS_SKELETON_MECHANICAL )
+GAME( 200?, winbid, 0, wms, wms, wms_state, wms, ROT0, "WMS", "Winning Bid (Russia)", GAME_IS_SKELETON_MECHANICAL )
+GAME( 200?, wldstrek, 0, wms, wms, wms_state, wms, ROT0, "WMS", "Wild Streak (Russia)", GAME_IS_SKELETON_MECHANICAL )
+GAME( 200?, yukongld, 0, wms, wms, wms_state, wms, ROT0, "WMS", "Yukon Gold (Russia)", GAME_IS_SKELETON_MECHANICAL )
diff --git a/src/mess/includes/sms.h b/src/mess/includes/sms.h
index 10ea4ef7be8..c6f85a0e735 100644
--- a/src/mess/includes/sms.h
+++ b/src/mess/includes/sms.h
@@ -19,10 +19,10 @@
#define CONTROL1_TAG "ctrl1"
#define CONTROL2_TAG "ctrl2"
-#include "bus/gamegear/ggext.h"
-#include "bus/sms_ctrl/smsctrl.h"
-#include "bus/sms_exp/smsexp.h"
#include "bus/sega8/sega8_slot.h"
+#include "bus/sms_exp/smsexp.h"
+#include "bus/sms_ctrl/smsctrl.h"
+#include "bus/gamegear/ggext.h"
class sms_state : public driver_device
@@ -32,9 +32,8 @@ public:
: driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_vdp(*this, "sms_vdp"),
- m_ym(*this, "ym2413"),
m_main_scr(*this, "screen"),
- m_region_maincpu(*this, "maincpu"),
+ m_ym(*this, "ym2413"),
m_port_ctrl1(*this, CONTROL1_TAG),
m_port_ctrl2(*this, CONTROL2_TAG),
m_port_gg_ext(*this, "ext"),
@@ -45,6 +44,7 @@ public:
m_port_scope(*this, "SEGASCOPE"),
m_port_scope_binocular(*this, "SSCOPE_BINOCULAR"),
m_port_persist(*this, "PERSISTENCE"),
+ m_region_maincpu(*this, "maincpu"),
m_mainram(NULL),
m_is_gamegear(0),
m_is_gg_region_japan(0),
@@ -61,12 +61,12 @@ public:
// devices
required_device<cpu_device> m_maincpu;
required_device<sega315_5124_device> m_vdp;
- optional_device<ym2413_device> m_ym;
required_device<screen_device> m_main_scr;
- required_memory_region m_region_maincpu;
+ optional_device<ym2413_device> m_ym;
optional_device<sms_control_port_device> m_port_ctrl1;
optional_device<sms_control_port_device> m_port_ctrl2;
optional_device<gg_ext_port_device> m_port_gg_ext;
+
optional_ioport m_port_gg_dc;
optional_ioport m_port_pause;
optional_ioport m_port_reset;
@@ -75,6 +75,7 @@ public:
optional_ioport m_port_scope_binocular;
optional_ioport m_port_persist;
+ required_memory_region m_region_maincpu;
address_space *m_space;
UINT8 *m_mainram;
UINT8 *m_BIOS;
@@ -121,11 +122,12 @@ public:
UINT8 m_gg_sio[5];
int m_paused;
- // Data needed for Light Phaser
UINT8 m_ctrl1_th_state;
UINT8 m_ctrl2_th_state;
UINT8 m_ctrl1_th_latch;
UINT8 m_ctrl2_th_latch;
+
+ // Data needed for Light Phaser
int m_lphaser_x_offs; /* Needed to 'calibrate' lphaser; set at cart loading */
// Data needed for SegaScope (3D glasses)
@@ -160,10 +162,10 @@ public:
DECLARE_READ8_MEMBER(sms_input_port_dc_r);
DECLARE_READ8_MEMBER(sms_input_port_dd_r);
DECLARE_READ8_MEMBER(gg_input_port_00_r);
- DECLARE_WRITE8_MEMBER(gg_sio_w);
DECLARE_READ8_MEMBER(gg_sio_r);
- DECLARE_WRITE8_MEMBER(sms_fm_detect_w);
+ DECLARE_WRITE8_MEMBER(gg_sio_w);
DECLARE_READ8_MEMBER(sms_fm_detect_r);
+ DECLARE_WRITE8_MEMBER(sms_fm_detect_w);
DECLARE_WRITE8_MEMBER(sms_ym2413_register_port_w);
DECLARE_WRITE8_MEMBER(sms_ym2413_data_port_w);
DECLARE_READ8_MEMBER(sms_sscope_r);
diff --git a/src/mess/machine/sms.c b/src/mess/machine/sms.c
index 5db57ad56ef..6cc56fc1302 100644
--- a/src/mess/machine/sms.c
+++ b/src/mess/machine/sms.c
@@ -869,8 +869,9 @@ MACHINE_START_MEMBER(sms_state,sms)
// a bug in the program code. The only way this cartridge could have run
// successfully on a real unit is if the RAM would be initialized with
// a F0 pattern on power up; F0 = RET P.
- // This initialization breaks the some Game Gear games though (e.g.
+ // This initialization breaks some Game Gear games though (e.g.
// tempojr), suggesting that not all systems had the same initialization.
+ // This also breaks some homebrew software (e.g. Nine Pixels).
// For the moment we apply this to systems that have the Japanese SMS
// cartridge slot.
if (m_has_jpn_sms_cart_slot)
diff --git a/src/osd/modules/debugger/osx/breakpointsview.m b/src/osd/modules/debugger/osx/breakpointsview.m
index 97545370955..46f58eac29b 100644
--- a/src/osd/modules/debugger/osx/breakpointsview.m
+++ b/src/osd/modules/debugger/osx/breakpointsview.m
@@ -17,7 +17,7 @@
@implementation MAMEBreakpointsView
- (id)initWithFrame:(NSRect)f machine:(running_machine &)m {
- if (!(self = [super initWithFrame:f type:DVT_BREAK_POINTS machine:m]))
+ if (!(self = [super initWithFrame:f type:DVT_BREAK_POINTS machine:m wholeLineScroll:YES]))
return nil;
return self;
}
diff --git a/src/osd/modules/debugger/osx/consoleview.m b/src/osd/modules/debugger/osx/consoleview.m
index 3e2e29b9202..afa6c826199 100644
--- a/src/osd/modules/debugger/osx/consoleview.m
+++ b/src/osd/modules/debugger/osx/consoleview.m
@@ -17,7 +17,7 @@
@implementation MAMEConsoleView
- (id)initWithFrame:(NSRect)f machine:(running_machine &)m {
- if (!(self = [super initWithFrame:f type:DVT_CONSOLE machine:m]))
+ if (!(self = [super initWithFrame:f type:DVT_CONSOLE machine:m wholeLineScroll:NO]))
return nil;
return self;
}
diff --git a/src/osd/modules/debugger/osx/debugview.h b/src/osd/modules/debugger/osx/debugview.h
index 12bfa3c3ca7..b76e4633f38 100644
--- a/src/osd/modules/debugger/osx/debugview.h
+++ b/src/osd/modules/debugger/osx/debugview.h
@@ -22,6 +22,7 @@
int type;
running_machine *machine;
debug_view *view;
+ BOOL wholeLineScroll;
INT32 totalWidth, totalHeight, originTop;
@@ -35,7 +36,7 @@
+ (NSFont *)defaultFont;
-- (id)initWithFrame:(NSRect)f type:(debug_view_type)t machine:(running_machine &)m;
+- (id)initWithFrame:(NSRect)f type:(debug_view_type)t machine:(running_machine &)m wholeLineScroll:(BOOL)w;
- (void)update;
diff --git a/src/osd/modules/debugger/osx/debugview.m b/src/osd/modules/debugger/osx/debugview.m
index eda265db976..6ed888fd53d 100644
--- a/src/osd/modules/debugger/osx/debugview.m
+++ b/src/osd/modules/debugger/osx/debugview.m
@@ -168,6 +168,7 @@ static void debugwin_view_update(debug_view &view, void *osdprivate)
// this gets all the lines that are at least partially visible
debug_view_xy origin(0, 0), size(totalWidth, totalHeight);
[self convertBounds:[self visibleRect] toFirstAffectedLine:&origin.y count:&size.y];
+ size.y = MIN(size.y, totalHeight - origin.y);
// tell the underlying view how much real estate is available
view->set_visible_size(size);
@@ -196,9 +197,12 @@ static void debugwin_view_update(debug_view &view, void *osdprivate)
- (void)adjustSizeAndRecomputeVisible {
NSSize const clip = [[[self enclosingScrollView] contentView] bounds].size;
- NSSize const content = NSMakeSize((fontWidth * totalWidth) + (2 * [textContainer lineFragmentPadding]),
- fontHeight * totalHeight);
- [self setFrameSize:NSMakeSize(MAX(clip.width, content.width), MAX(clip.height, content.height))];
+ NSSize content = NSMakeSize((fontWidth * totalWidth) + (2 * [textContainer lineFragmentPadding]),
+ fontHeight * totalHeight);
+ if (wholeLineScroll)
+ content.height += (fontHeight * 2) - 1;
+ [self setFrameSize:NSMakeSize(ceil(MAX(clip.width, content.width)),
+ ceil(MAX(clip.height, content.height)))];
[self recomputeVisible];
}
@@ -208,7 +212,7 @@ static void debugwin_view_update(debug_view &view, void *osdprivate)
}
-- (id)initWithFrame:(NSRect)f type:(debug_view_type)t machine:(running_machine &)m {
+- (id)initWithFrame:(NSRect)f type:(debug_view_type)t machine:(running_machine &)m wholeLineScroll:(BOOL)w {
if (!(self = [super initWithFrame:f]))
return nil;
type = t;
@@ -218,7 +222,10 @@ static void debugwin_view_update(debug_view &view, void *osdprivate)
[self release];
return nil;
}
- totalWidth = totalHeight = 0;
+ wholeLineScroll = w;
+ debug_view_xy const size = view->total_size();
+ totalWidth = size.x;
+ totalHeight = size.y;
originTop = 0;
text = [[NSTextStorage alloc] init];
@@ -258,10 +265,12 @@ static void debugwin_view_update(debug_view &view, void *osdprivate)
if (scroller)
{
NSSize const clip = [[scroller contentView] bounds].size;
- NSSize const content = NSMakeSize((fontWidth * newSize.x) + (2 * [textContainer lineFragmentPadding]),
- fontHeight * newSize.y);
- [self setFrameSize:NSMakeSize(MAX(clip.width, content.width), MAX(clip.height, content.height))];
- [self recomputeVisible];
+ NSSize content = NSMakeSize((fontWidth * newSize.x) + (2 * [textContainer lineFragmentPadding]),
+ fontHeight * newSize.y);
+ if (wholeLineScroll)
+ content.height += (fontHeight * 2) - 1;
+ [self setFrameSize:NSMakeSize(ceil(MAX(clip.width, content.width)),
+ ceil(MAX(clip.height, content.height)))];
}
totalWidth = newSize.x;
totalHeight = newSize.y;
@@ -273,8 +282,6 @@ static void debugwin_view_update(debug_view &view, void *osdprivate)
{
NSRect const visible = [self visibleRect];
NSPoint scroll = NSMakePoint(visible.origin.x, newOrigin.y * fontHeight);
- if ((newOrigin.y + view->visible_size().y) == totalHeight)
- scroll.y += (view->visible_size().y * fontHeight) - visible.size.height;
[self scrollPoint:scroll];
originTop = newOrigin.y;
}
@@ -287,7 +294,7 @@ static void debugwin_view_update(debug_view &view, void *osdprivate)
- (NSSize)maximumFrameSize {
debug_view_xy const max = view->total_size();
return NSMakeSize(ceil((max.x * fontWidth) + (2 * [textContainer lineFragmentPadding])),
- ceil(max.y * fontHeight));
+ ceil((max.y + (wholeLineScroll ? 1 : 0)) * fontHeight));
}
@@ -519,6 +526,7 @@ static void debugwin_view_update(debug_view &view, void *osdprivate)
selector:@selector(viewFrameDidChange:)
name:NSViewFrameDidChangeNotification
object:[scroller contentView]];
+ [self adjustSizeAndRecomputeVisible];
}
}
@@ -558,6 +566,17 @@ static void debugwin_view_update(debug_view &view, void *osdprivate)
}
+- (NSRect)adjustScroll:(NSRect)proposedVisibleRect {
+ if (wholeLineScroll)
+ {
+ CGFloat const clamp = [self bounds].size.height - fontHeight - proposedVisibleRect.size.height;
+ proposedVisibleRect.origin.y = MIN(proposedVisibleRect.origin.y, MAX(clamp, 0));
+ proposedVisibleRect.origin.y -= fmod(proposedVisibleRect.origin.y, fontHeight);
+ }
+ return proposedVisibleRect;
+}
+
+
- (void)drawRect:(NSRect)dirtyRect {
// work out what's available
[self recomputeVisible];
diff --git a/src/osd/modules/debugger/osx/debugwindowhandler.m b/src/osd/modules/debugger/osx/debugwindowhandler.m
index 65ef6d5b7ba..9d1e6d5f949 100644
--- a/src/osd/modules/debugger/osx/debugwindowhandler.m
+++ b/src/osd/modules/debugger/osx/debugwindowhandler.m
@@ -316,26 +316,32 @@ NSString *const MAMEAuxiliaryDebugWindowWillCloseNotification = @"MAMEAuxiliaryD
}
- (void)cascadeWindowWithDesiredSize:(NSSize)desired forView:(NSView *)view {
- NSRect available = [[NSScreen mainScreen] visibleFrame];
- NSRect windowFrame = [window frame];
- NSSize current = [view frame].size;
-
+ // convert desired size to an adjustment and apply it to the current window frame
+ NSSize const current = [view frame].size;
desired.width -= current.width;
desired.height -= current.height;
-
+ NSRect windowFrame = [window frame];
windowFrame.size.width += desired.width;
- windowFrame.size.width = MIN(windowFrame.size.width, available.size.width);
windowFrame.size.height += desired.height;
- windowFrame.size.height = MIN(MIN(MAX(windowFrame.size.height, 120), 320), available.size.height);
+
+ // limit the size to the minimum size
+ NSSize const minimum = [window minSize];
+ windowFrame.size.width = MAX(windowFrame.size.width, minimum.width);
+ windowFrame.size.height = MAX(windowFrame.size.height, minimum.height);
+
+ // limit the size to the main screen size
+ NSRect const available = [[NSScreen mainScreen] visibleFrame];
+ windowFrame.size.width = MIN(windowFrame.size.width, available.size.width);
+ windowFrame.size.height = MIN(windowFrame.size.height, available.size.height);
+
+ // arbitrary additional height limit
+ windowFrame.size.height = MIN(windowFrame.size.height, 320);
+
+ // place it in the bottom right corner and apply
windowFrame.origin.x = available.origin.x + available.size.width - windowFrame.size.width;
windowFrame.origin.y = available.origin.y;
[window setFrame:windowFrame display:YES];
[[self class] cascadeWindow:window];
-
- windowFrame = [[window contentView] frame];
- desired = [window contentMinSize];
- [window setContentMinSize:NSMakeSize(MIN(windowFrame.size.width, desired.width),
- MIN(windowFrame.size.height, desired.height))];
}
@end
diff --git a/src/osd/modules/debugger/osx/disassemblyview.m b/src/osd/modules/debugger/osx/disassemblyview.m
index 0be36d9f5f9..55ecb5f50ac 100644
--- a/src/osd/modules/debugger/osx/disassemblyview.m
+++ b/src/osd/modules/debugger/osx/disassemblyview.m
@@ -17,7 +17,7 @@
@implementation MAMEDisassemblyView
- (id)initWithFrame:(NSRect)f machine:(running_machine &)m {
- if (!(self = [super initWithFrame:f type:DVT_DISASSEMBLY machine:m]))
+ if (!(self = [super initWithFrame:f type:DVT_DISASSEMBLY machine:m wholeLineScroll:NO]))
return nil;
return self;
}
diff --git a/src/osd/modules/debugger/osx/errorlogview.m b/src/osd/modules/debugger/osx/errorlogview.m
index 80380bc1e16..102065009ea 100644
--- a/src/osd/modules/debugger/osx/errorlogview.m
+++ b/src/osd/modules/debugger/osx/errorlogview.m
@@ -17,7 +17,7 @@
@implementation MAMEErrorLogView
- (id)initWithFrame:(NSRect)f machine:(running_machine &)m {
- if (!(self = [super initWithFrame:f type:DVT_LOG machine:m]))
+ if (!(self = [super initWithFrame:f type:DVT_LOG machine:m wholeLineScroll:NO]))
return nil;
return self;
}
diff --git a/src/osd/modules/debugger/osx/memoryview.m b/src/osd/modules/debugger/osx/memoryview.m
index 0cb1a7f55d9..e90095292a4 100644
--- a/src/osd/modules/debugger/osx/memoryview.m
+++ b/src/osd/modules/debugger/osx/memoryview.m
@@ -18,7 +18,7 @@
@implementation MAMEMemoryView
- (id)initWithFrame:(NSRect)f machine:(running_machine &)m {
- if (!(self = [super initWithFrame:f type:DVT_MEMORY machine:m]))
+ if (!(self = [super initWithFrame:f type:DVT_MEMORY machine:m wholeLineScroll:NO]))
return nil;
return self;
}
diff --git a/src/osd/modules/debugger/osx/registersview.m b/src/osd/modules/debugger/osx/registersview.m
index 50191b4c9a5..e02bd9cd7a6 100644
--- a/src/osd/modules/debugger/osx/registersview.m
+++ b/src/osd/modules/debugger/osx/registersview.m
@@ -18,7 +18,7 @@
@implementation MAMERegistersView
- (id)initWithFrame:(NSRect)f machine:(running_machine &)m {
- if (!(self = [super initWithFrame:f type:DVT_STATE machine:m]))
+ if (!(self = [super initWithFrame:f type:DVT_STATE machine:m wholeLineScroll:NO]))
return nil;
return self;
}
diff --git a/src/osd/modules/debugger/osx/watchpointsview.m b/src/osd/modules/debugger/osx/watchpointsview.m
index 0b1ab9ae39c..ae726d0f0d0 100644
--- a/src/osd/modules/debugger/osx/watchpointsview.m
+++ b/src/osd/modules/debugger/osx/watchpointsview.m
@@ -17,7 +17,7 @@
@implementation MAMEWatchpointsView
- (id)initWithFrame:(NSRect)f machine:(running_machine &)m {
- if (!(self = [super initWithFrame:f type:DVT_WATCH_POINTS machine:m]))
+ if (!(self = [super initWithFrame:f type:DVT_WATCH_POINTS machine:m wholeLineScroll:YES]))
return nil;
return self;
}