1
1
//============================================================
3
// debugwin.h - Win32 debug window handling
3
// debugosx.h - MacOS X Cocoa debug window handling
5
5
// Copyright (c) 1996-2006, Nicola Salmoria and the MAME Team.
6
6
// Visit http://mamedev.org for licensing and usage restrictions.
8
8
//============================================================
10
#ifndef __WIN_DEBUGWIN__
11
#define __WIN_DEBUGWIN__
14
//============================================================
16
//============================================================
10
#ifndef __SDL_DEBUGOSX__
11
#define __SDL_DEBUGOSX__
13
// make sure this comes first
14
#include <AvailabilityMacros.h>
18
#include "debug/debugvw.h"
23
// standard Cocoa headers
24
#import <Cocoa/Cocoa.h>
26
// workarounds for 10.6 warnings
27
#ifdef MAC_OS_X_VERSION_MAX_ALLOWED
29
#if MAC_OS_X_VERSION_MAX_ALLOWED < 1050
31
typedef int NSInteger;
32
typedef unsigned NSUInteger;
33
typedef float CGFloat;
35
#endif // MAC_OS_X_VERSION_MAX_ALLOWED < 1050
37
#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060
39
@protocol NSWindowDelegate <NSObject>
42
@protocol NSSplitViewDelegate <NSObject>
45
@protocol NSControlTextEditingDelegate <NSObject>
48
@protocol NSTextFieldDelegate <NSControlTextEditingDelegate>
51
#endif // MAC_OS_X_VERSION_MAX_ALLOWED < 1060
53
#endif // MAC_OS_X_VERSION_MAX_ALLOWED
56
//============================================================
58
//============================================================
60
@protocol MAMEDebugViewSubviewSupport <NSObject>
62
- (NSString *)selectedSubviewName;
63
- (int)selectedSubviewIndex;
64
- (void)selectSubviewAtIndex:(int)index;
65
- (void)selectSubviewForCPU:(const device_config *)device;
70
@protocol MAMEDebugViewExpressionSupport <NSObject>
72
- (NSString *)expression;
73
- (void)setExpression:(NSString *)exp;
79
//============================================================
81
//============================================================
83
@interface MAMEDebugCommandHistory : NSObject
85
NSInteger length, position;
87
NSMutableArray *history;
90
+ (NSInteger)defaultLength;
95
- (void)setLength:(NSInteger)l;
97
- (void)add:(NSString *)entry;
98
- (NSString *)previous:(NSString *)cur;
99
- (NSString *)next:(NSString *)cur;
106
@interface MAMEDebugView : NSView
109
running_machine *machine;
112
debug_view_xy totalSize, topLeft;
115
CGFloat fontWidth, fontHeight, fontAscent;
118
+ (NSFont *)defaultFont;
120
- (id)initWithFrame:(NSRect)f type:(int)t machine:(running_machine *)m;
124
- (NSSize)maximumFrameSize;
127
- (void)setFont:(NSFont *)f;
129
- (void)windowDidBecomeKey:(NSNotification *)notification;
130
- (void)windowDidResignKey:(NSNotification *)notification;
135
@interface MAMEMemoryView : MAMEDebugView <MAMEDebugViewSubviewSupport, MAMEDebugViewExpressionSupport>
139
- (id)initWithFrame:(NSRect)f machine:(running_machine *)m;
141
- (NSSize)maximumFrameSize;
143
- (NSString *)selectedSubviewName;
144
- (int)selectedSubviewIndex;
145
- (void)selectSubviewAtIndex:(int)index;
146
- (void)selectSubviewForCPU:(const device_config *)device;
148
- (NSString *)expression;
149
- (void)setExpression:(NSString *)exp;
151
- (IBAction)showChunkSize:(id)sender;
152
- (IBAction)showPhysicalAddresses:(id)sender;
153
- (IBAction)showReverseView:(id)sender;
154
- (IBAction)showReverseViewToggle:(id)sender;
156
- (void)insertActionItemsInMenu:(NSMenu *)menu atIndex:(NSInteger)index;
157
- (void)insertSubviewItemsInMenu:(NSMenu *)menu atIndex:(NSInteger)index;
162
@interface MAMEDisassemblyView : MAMEDebugView <MAMEDebugViewSubviewSupport, MAMEDebugViewExpressionSupport>
167
- (id)initWithFrame:(NSRect)f machine:(running_machine *)m useConsole:(BOOL)uc;
169
- (NSSize)maximumFrameSize;
171
- (NSString *)selectedSubviewName;
172
- (int)selectedSubviewIndex;
173
- (void)selectSubviewAtIndex:(int)index;
174
- (void)selectSubviewForCPU:(const device_config *)device;
176
- (NSString *)expression;
177
- (void)setExpression:(NSString *)exp;
179
- (IBAction)debugToggleBreakpoint:(id)sender;
180
- (IBAction)debugToggleBreakpointEnable:(id)sender;
181
- (IBAction)debugRunToCursor:(id)sender;
183
- (IBAction)showRightColumn:(id)sender;
185
- (void)insertActionItemsInMenu:(NSMenu *)menu atIndex:(NSInteger)index;
186
- (void)insertSubviewItemsInMenu:(NSMenu *)menu atIndex:(NSInteger)index;
191
@interface MAMERegistersView : MAMEDebugView <MAMEDebugViewSubviewSupport>
195
- (id)initWithFrame:(NSRect)f machine:(running_machine *)m;
197
- (NSSize)maximumFrameSize;
199
- (NSString *)selectedSubviewName;
200
- (int)selectedSubviewIndex;
201
- (void)selectSubviewAtIndex:(int)index;
202
- (void)selectSubviewForCPU:(const device_config *)device;
207
@interface MAMEConsoleView : MAMEDebugView
211
- (id)initWithFrame:(NSRect)f machine:(running_machine *)m;
216
@interface MAMEErrorLogView : MAMEDebugView
220
- (id)initWithFrame:(NSRect)f machine:(running_machine *)m;
225
@interface MAMEDebugWindowHandler : NSObject <NSWindowDelegate>
228
running_machine *machine;
231
+ (void)addCommonActionItems:(NSMenu *)menu;
232
+ (NSPopUpButton *)newActionButtonWithFrame:(NSRect)frame;
234
- (id)initWithMachine:(running_machine *)m title:(NSString *)t;
238
- (IBAction)debugRun:(id)sender;
239
- (IBAction)debugRunAndHide:(id)sender;
240
- (IBAction)debugRunToNextCPU:(id)sender;
241
- (IBAction)debugRunToNextInterrupt:(id)sender;
242
- (IBAction)debugRunToNextVBLANK:(id)sender;
244
- (IBAction)debugStepInto:(id)sender;
245
- (IBAction)debugStepOver:(id)sender;
246
- (IBAction)debugStepOut:(id)sender;
248
- (IBAction)debugSoftReset:(id)sender;
249
- (IBAction)debugHardReset:(id)sender;
251
- (IBAction)debugExit:(id)sender;
253
- (void)showDebugger:(NSNotification *)notification;
254
- (void)hideDebugger:(NSNotification *)notification;
259
@interface MAMEDebugConsole : MAMEDebugWindowHandler <NSTextFieldDelegate, NSSplitViewDelegate>
261
MAMEDebugCommandHistory *history;
262
NSMutableArray *auxiliaryWindows;
264
MAMERegistersView *regView;
265
MAMEDisassemblyView *dasmView;
266
MAMEDebugView *consoleView;
267
NSTextField *commandField;
270
- (id)initWithMachine:(running_machine *)m;
272
- (void)setCPU:(const device_config *)device;
274
- (IBAction)doCommand:(id)sender;
276
- (IBAction)debugNewMemoryWindow:(id)sender;
277
- (IBAction)debugNewDisassemblyWindow:(id)sender;
278
- (IBAction)debugNewErrorLogWindow:(id)sender;
280
- (void)showDebugger:(NSNotification *)notification;
281
- (void)auxiliaryWindowWillClose:(NSNotification *)notification;
283
- (BOOL)control:(NSControl *)control textView:(NSTextView *)textView doCommandBySelector:(SEL)command;
285
- (void)windowWillClose:(NSNotification *)notification;
287
- (CGFloat)splitView:(NSSplitView *)sender constrainMinCoordinate:(CGFloat)min ofSubviewAt:(NSInteger)offs;
288
- (CGFloat)splitView:(NSSplitView *)sender constrainMaxCoordinate:(CGFloat)max ofSubviewAt:(NSInteger)offs;
289
- (BOOL)splitView:(NSSplitView *)sender canCollapseSubview:(NSView *)subview;
290
- (void)splitView:(NSSplitView *)sender resizeSubviewsWithOldSize:(NSSize)oldSize;
295
@interface MAMEAuxiliaryDebugWindowHandler : MAMEDebugWindowHandler
297
MAMEDebugConsole *console;
300
+ (void)cascadeWindow:(NSWindow *)window;
302
- (id)initWithMachine:(running_machine *)m title:(NSString *)t console:(MAMEDebugConsole *)c;
304
- (IBAction)debugNewMemoryWindow:(id)sender;
305
- (IBAction)debugNewDisassemblyWindow:(id)sender;
306
- (IBAction)debugNewErrorLogWindow:(id)sender;
308
- (void)windowWillClose:(NSNotification *)notification;
310
- (void)cascadeWindowWithDesiredSize:(NSSize)desired forView:(NSView *)view;
315
@interface MAMEExpressionAuxiliaryDebugWindowHandler : MAMEAuxiliaryDebugWindowHandler <NSTextFieldDelegate>
317
MAMEDebugCommandHistory *history;
318
NSTextField *expressionField;
321
- (id)initWithMachine:(running_machine *)m title:(NSString *)t console:(MAMEDebugConsole *)c;
323
- (id <MAMEDebugViewExpressionSupport>)documentView;
325
- (IBAction)doExpression:(id)sender;
327
- (BOOL)control:(NSControl *)control textView:(NSTextView *)textView doCommandBySelector:(SEL)command;
332
@interface MAMEMemoryViewer : MAMEExpressionAuxiliaryDebugWindowHandler
334
MAMEMemoryView *memoryView;
337
- (id)initWithMachine:(running_machine *)m console:(MAMEDebugConsole *)c;
339
- (IBAction)changeSubview:(id)sender;
344
@interface MAMEDisassemblyViewer : MAMEExpressionAuxiliaryDebugWindowHandler
346
MAMEDisassemblyView *dasmView;
349
- (id)initWithMachine:(running_machine *)m console:(MAMEDebugConsole *)c;
351
- (IBAction)changeSubview:(id)sender;
356
@interface MAMEErrorLogViewer : MAMEAuxiliaryDebugWindowHandler
358
MAMEErrorLogView *logView;
361
- (id)initWithMachine:(running_machine *)m console:(MAMEDebugConsole *)c;