blob: d5e4cd8d5dcae473b11cd15a586237a29c8cd69a (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
|
#import "ConfigurationController.h"
#import "PcsxController.h"
#import "PluginList.h"
#import "PcsxPlugin.h"
#include "psxcommon.h"
#include "plugins.h"
@implementation ConfigurationController
- (IBAction)setCheckbox:(id)sender
{
if ([sender isKindOfClass:[NSMatrix class]]) {
sender = [sender selectedCell];
}
NSString *key = [self keyForSender:sender];
if (key) {
[[NSUserDefaults standardUserDefaults] setInteger:[sender intValue] forKey:key];
[PcsxController setConfigFromDefaults];
}
}
- (IBAction)setCheckboxInverse:(id)sender
{
if ([sender isKindOfClass:[NSMatrix class]]) {
sender = [sender selectedCell];
}
NSString *key = [self keyForSender:sender];
if (key) {
[[NSUserDefaults standardUserDefaults] setInteger:![sender intValue] forKey:key];
[PcsxController setConfigFromDefaults];
}
}
- (IBAction)setVideoType:(id)sender
{
int tag = [[sender selectedItem] tag];
if (3 == tag) {
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"AutoDetectVideoType"];
} else if (1 == tag || 2 == tag) {
[[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"AutoDetectVideoType"];
[[NSUserDefaults standardUserDefaults] setBool:tag==2 forKey:@"VideoTypePAL"];
} else {
return;
}
[PcsxController setConfigFromDefaults];
if ([sender pullsDown]) {
NSArray *items = [sender itemArray];
int i;
for (i=0; i<[items count]; i++)
[[items objectAtIndex:i] setState:NSOffState];
[[sender selectedItem] setState:NSOnState];
}
}
- (void)awakeFromNib
{
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
[[self window] center];
// setup checkboxes
checkBoxDefaults = [[NSMutableDictionary alloc] init];
// check that the outlets are active before adding them
if (noXaAudioCell) [checkBoxDefaults setObject:noXaAudioCell forKey:@"NoXaAudio"];
if (sioIrqAlwaysCell) [checkBoxDefaults setObject:sioIrqAlwaysCell forKey:@"SioIrqAlways"];
if (bwMdecCell) [checkBoxDefaults setObject:bwMdecCell forKey:@"BlackAndWhiteMDECVideo"];
if (autoVTypeCell) [checkBoxDefaults setObject:autoVTypeCell forKey:@"AutoDetectVideoType"];
if (vTypePALCell) [checkBoxDefaults setObject:vTypePALCell forKey:@"VideoTypePAL"];
if (noCDAudioCell) [checkBoxDefaults setObject:noCDAudioCell forKey:@"NoCDAudio"];
if (usesHleCell) [checkBoxDefaults setObject:usesHleCell forKey:@"UseHLE"];
if (usesDynarecCell) [checkBoxDefaults setObject:usesDynarecCell forKey:@"NoDynarec"];
if (consoleOutputCell) [checkBoxDefaults setObject:consoleOutputCell forKey:@"ConsoleOutput"];
if (spuIrqAlwaysCell) [checkBoxDefaults setObject:spuIrqAlwaysCell forKey:@"SpuIrqAlways"];
if (rCountFixCell) [checkBoxDefaults setObject:rCountFixCell forKey:@"RootCounterFix"];
if (vSyncWAFixCell) [checkBoxDefaults setObject:vSyncWAFixCell forKey:@"VideoSyncWAFix"];
if (noFastBootCell) [checkBoxDefaults setObject:noFastBootCell forKey:@"NoFastBoot"];
// make the visuals match the defaults
NSEnumerator *enumerator= [checkBoxDefaults keyEnumerator];
id key;
while ((key = [enumerator nextObject])) {
if ([defaults integerForKey:key]) {
[[checkBoxDefaults objectForKey:key] setNextState];
}
}
// special cases
if (![PcsxController biosAvailable]) {
// no bios means always use HLE
[usesHleCell setState:NSOnState];
[usesHleCell setEnabled:NO];
}
int tag = [defaults integerForKey:@"AutoDetectVideoType"];
if (tag)
tag = 3;
else {
tag = [defaults integerForKey:@"VideoTypePAL"]+1;
}
[vTypePALCell setAutoenablesItems:NO];
if ([vTypePALCell pullsDown]) {
[[vTypePALCell itemAtIndex:[vTypePALCell indexOfItemWithTag:tag]] setState:NSOnState];
} else {
[vTypePALCell selectItemAtIndex:[vTypePALCell indexOfItemWithTag:tag]];
}
// setup plugin lists
PluginList *list = [PluginList list];
[list refreshPlugins];
[graphicsPlugin setPluginsTo:[list pluginsForType:PSE_LT_GPU] withType: PSE_LT_GPU];
[soundPlugin setPluginsTo:[list pluginsForType:PSE_LT_SPU] withType: PSE_LT_SPU];
[padPlugin setPluginsTo:[list pluginsForType:PSE_LT_PAD] withType: PSE_LT_PAD];
[cdromPlugin setPluginsTo:[list pluginsForType:PSE_LT_CDR] withType: PSE_LT_CDR];
}
- (void)dealloc
{
[checkBoxDefaults release];
[super dealloc];
}
- (NSString *)keyForSender:(id)sender
{
NSEnumerator *enumerator= [checkBoxDefaults keyEnumerator];
id key;
while ((key = [enumerator nextObject])) {
id object = [checkBoxDefaults objectForKey:key];
if ([object isEqual:sender])
return key;
}
return nil;
}
@end
|