summaryrefslogtreecommitdiff
path: root/macosx/plugins/Bladesio1/macsrc/PluginConfigController.m
diff options
context:
space:
mode:
authorSND\MaddTheSane_cp <SND\MaddTheSane_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2013-07-09 03:20:01 +0000
committerSND\MaddTheSane_cp <SND\MaddTheSane_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2013-07-09 03:20:01 +0000
commitc912deb4e76adb823b1bb5355b1171eb1241b42b (patch)
treea914f42122662759aa8bd13a2bf2447ad3c22e81 /macosx/plugins/Bladesio1/macsrc/PluginConfigController.m
parent2062efdfedb6fd9bef719a1b8ad000602ddf0e69 (diff)
Updating OS X plug-in code.
Now the net plug-in will warn you if you have a too large or non-ASCII characters. git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@85926 e17a0e51-4ae3-4d35-97c3-1a29b211df97
Diffstat (limited to 'macosx/plugins/Bladesio1/macsrc/PluginConfigController.m')
-rwxr-xr-xmacosx/plugins/Bladesio1/macsrc/PluginConfigController.m21
1 files changed, 9 insertions, 12 deletions
diff --git a/macosx/plugins/Bladesio1/macsrc/PluginConfigController.m b/macosx/plugins/Bladesio1/macsrc/PluginConfigController.m
index 609976ef..dbc85174 100755
--- a/macosx/plugins/Bladesio1/macsrc/PluginConfigController.m
+++ b/macosx/plugins/Bladesio1/macsrc/PluginConfigController.m
@@ -121,14 +121,18 @@ void ReadConfig()
NSMutableDictionary *writeDic = [NSMutableDictionary dictionaryWithDictionary:keyValues];
NSString *theAddress = [ipAddressField stringValue];
- if ([theAddress lengthOfBytesUsingEncoding:NSASCIIStringEncoding] > (sizeof(settings.ip) - 1)) {
- NSBeginAlertSheet(@"Address too long", nil, nil, nil, [self window], nil, NULL, NULL, NULL, @"The address is too long. Try to use only the IP address and not a host name.");
+ NSInteger asciiLen = [theAddress lengthOfBytesUsingEncoding:NSASCIIStringEncoding];
+ if (asciiLen > (sizeof(settings.ip) - 1)) {
+ NSBeginAlertSheet(@"Address too long", nil, nil, nil, [self window], nil, NULL, NULL, NULL, @"The address is too long.\n\nTry to use only the IP address and not a host name.");
+ return;
+ } else if (asciiLen == 0) {
+ NSBeginAlertSheet(@"Blank address", nil, nil, nil, [self window], nil, NULL, NULL, NULL, @"The address specified is either blank, or can't be converted to ASCII.\n\nTry connecting directly using the IP address using latin numerals.");
return;
}
[writeDic setObject:(([enabledButton state] == NSOnState) ? @YES : @NO) forKey:kSioEnabled];
[writeDic setObject:theAddress forKey:kSioIPAddress];
- [writeDic setObject:@((unsigned short)[portField intValue]) forKey:kSioPort];
+ [writeDic setObject:@((u16)[portField intValue]) forKey:kSioPort];
{
int player;
@@ -202,12 +206,5 @@ void ReadConfig()
@end
-char* PLUGLOC(char *toloc)
-{
- NSBundle *mainBundle = [NSBundle bundleForClass:[PluginConfigController class]];
- NSString *origString = nil, *transString = nil;
- origString = @(toloc);
- transString = [mainBundle localizedStringForKey:origString value:nil table:nil];
- return (char*)[transString UTF8String];
-}
-
+#import "OSXPlugLocalization.h"
+PLUGLOCIMP([PluginConfigController class]);