summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus/nes_ctrl/ctrl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/bus/nes_ctrl/ctrl.cpp')
-rw-r--r--src/devices/bus/nes_ctrl/ctrl.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/devices/bus/nes_ctrl/ctrl.cpp b/src/devices/bus/nes_ctrl/ctrl.cpp
index a1ef7dc9c1a..6e57faaabd2 100644
--- a/src/devices/bus/nes_ctrl/ctrl.cpp
+++ b/src/devices/bus/nes_ctrl/ctrl.cpp
@@ -100,7 +100,7 @@ device_nes_control_port_interface::~device_nes_control_port_interface()
// nes_control_port_device - constructor
//-------------------------------------------------
-nes_control_port_device::nes_control_port_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+nes_control_port_device::nes_control_port_device(const machine_config &mconfig, std::string tag, device_t *owner, UINT32 clock) :
device_t(mconfig, NES_CONTROL_PORT, "Nintendo NES/FC control port", tag, owner, clock, "nes_control_port", __FILE__),
device_slot_interface(mconfig, *this), m_device(nullptr)
{
href='#n105'>105 106 107 108 109 110 111 112 113 114 115 116
// license:BSD-3-Clause
// copyright-holders:Vas Crabb
//============================================================
//
//  debugosxdebugcommandhistory.m - MacOS X Cocoa debug window handling
//
//  Copyright (c) 1996-2015, Nicola Salmoria and the MAME Team.
//  Visit http://mamedev.org for licensing and usage restrictions.
//
//============================================================

//============================================================
//  MAMEDebugView class
//============================================================

#import "debugcommandhistory.h"


@implementation MAMEDebugCommandHistory

+ (NSInteger)defaultLength {
	return 100;
}


- (id)init {
	if (!(self = [super init]))
		return nil;
	length = [[self class] defaultLength];
	position = -1;
	current = nil;
	history = [[NSMutableArray alloc] initWithCapacity:length];
	return self;
}


- (void)dealloc {
	if (current != nil)
		[current release];
	if (history != nil)
		[history release];
	[super dealloc];
}


- (NSInteger)length {
	return length;
}


- (void)setLength:(NSInteger)l {
	length = l;
	if ([history count] > length)
		[history removeObjectsInRange:NSMakeRange(length, [history count] - length)];
}


- (void)add:(NSString *)entry {
	if (([history count] == 0) || ![[history objectAtIndex:0] isEqualToString:entry]) {
		[history insertObject:entry atIndex:0];
		while ([history count] > length)
			[history removeLastObject];
	}
	position = 0;
}


- (NSString *)previous:(NSString *)cur {
	if ((position + 1) < [history count]) {
		if (position < 0) {
			[current autorelease];
			current = [cur copy];
		}
		return [history objectAtIndex:++position];
	} else {
		return nil;
	}
}


- (NSString *)next:(NSString *)cur {
	if (position > 0) {
		return [history objectAtIndex:--position];
	} else if ((position == 0) && (current != nil) && ![current isEqualToString:[history objectAtIndex:0]]) {
		position--;
		return [[current retain] autorelease];
	} else {
		return nil;
	}
}


- (void)edit {
	if (position == 0)
		position--;
}

- (void)reset {
	position = -1;
	if (current != nil) {
		[current release];
		current = nil;
	}
}


- (void)clear {
	position = -1;
	if (current != nil) {
		[current release];
		current = nil;
	}
	[history removeAllObjects];
}

@end