Cocoa Port:

- New feature: Users can now use some very user-friendly forms for submitting support requests and bug reports. The new forms can be found in the Help menu.
- The About box now shows the model identifier and running OS version.
- The About box display font for the read me files has been changed to Monaco 10.
This commit is contained in:
rogerman 2012-12-30 09:08:19 +00:00
parent a62168ccff
commit 6c66a740c6
10 changed files with 3864 additions and 165 deletions

View File

@ -19,7 +19,8 @@
#define STRING_DESMUME_WEBSITE "http://desmume.org"
#define STRING_DESMUME_SHORT_DESCRIPTION "Nintendo DS Emulator"
#define STRING_DESMUME_FORUM_SITE "http://forums.desmume.org/index.php"
#define STRING_DESMUME_BUG_SITE "http://sourceforge.net/tracker/?group_id=164579&atid=832291"
#define STRING_DESMUME_TECH_SUPPORT_SITE "http://forums.desmume.org/viewforum.php?id=4"
#define STRING_DESMUME_BUG_REPORT_SITE "http://sourceforge.net/tracker/?group_id=164579&atid=832291"
// User Interface Localized Strings
#define NSSTRING_TITLE_OPEN_ROM_PANEL NSLocalizedString(@"Open ROM", nil)
@ -51,6 +52,13 @@
#define NSSTRING_TITLE_SPEED_2X NSLocalizedString(@"Speed 2x", nil)
#define NSSTRING_TITLE_SLOT_NUMBER NSLocalizedString(@"Slot %d", nil)
#define NSSTRING_TITLE_TECH_SUPPORT_WINDOW_TITLE NSLocalizedString(@"Support Request Form", nil)
#define NSSTRING_TITLE_BUG_REPORT_WINDOW_TITLE NSLocalizedString(@"Bug Report Form", nil)
#define NSSTRING_TITLE_GO_TECH_SUPPORT_WEBPAGE_TITLE NSLocalizedString(@"Go to Tech Support Webpage", nil)
#define NSSTRING_TITLE_GO_BUG_REPORT_WEBPAGE_TITLE NSLocalizedString(@"Go to Bug Report Webpage", nil)
#define NSSTRING_HELP_COPY_PASTE_TECH_SUPPORT NSLocalizedString(@"Please copy-paste the above information into our tech support webpage. This will ensure the fastest response time from us.", nil)
#define NSSTRING_HELP_COPY_PASTE_BUG_REPORT NSLocalizedString(@"Please copy-paste the above information into our bug report webpage. This will ensure the fastest response time from us.", nil)
#define NSSTRING_ALERT_CRITICAL_FILE_MISSING_PRI NSLocalizedString(@"A critical file is missing. DeSmuME will now quit.", nil)
#define NSSTRING_ALERT_CRITICAL_FILE_MISSING_SEC NSLocalizedString(@"The file \"DefaultUserPrefs.plist\" is missing. Please reinstall DeSmuME.", nil)

View File

@ -201,6 +201,11 @@ static NSMutableDictionary *saveTypeValues = nil;
[self.bindings setValue:[self.header objectForKey:@"romInternalName"] forKey:@"romInternalName"];
[self.bindings setValue:[self.header objectForKey:@"romSerial"] forKey:@"romSerial"];
NSString *romNameAndSerialInfoString = @"Name: ";
romNameAndSerialInfoString = [romNameAndSerialInfoString stringByAppendingString:[self.header objectForKey:@"romInternalName"]];
romNameAndSerialInfoString = [[romNameAndSerialInfoString stringByAppendingString:@"\nSerial: "] stringByAppendingString:[self.header objectForKey:@"romSerial"]];
[self.bindings setValue:romNameAndSerialInfoString forKey:@"romNameAndSerialInfo"];
}
- (BOOL) loadData:(NSURL *)theURL
@ -477,9 +482,14 @@ static NSMutableDictionary *saveTypeValues = nil;
{
NSImage *iconImage = [[[NSImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"AppIcon_DeSmuME" ofType:@"icns"]] autorelease];
NSString *romNameAndSerialInfoString = @"Name: ";
romNameAndSerialInfoString = [romNameAndSerialInfoString stringByAppendingString:NSSTRING_STATUS_NO_ROM_LOADED];
romNameAndSerialInfoString = [[romNameAndSerialInfoString stringByAppendingString:@"\nSerial: "] stringByAppendingString:NSSTRING_STATUS_NO_ROM_LOADED];
return [NSMutableDictionary dictionaryWithObjectsAndKeys:
NSSTRING_STATUS_NO_ROM_LOADED, @"romInternalName",
NSSTRING_STATUS_NO_ROM_LOADED, @"romSerial",
romNameAndSerialInfoString, @"romNameAndSerialInfo",
NSSTRING_STATUS_NO_ROM_LOADED, @"bannerJapanese",
NSSTRING_STATUS_NO_ROM_LOADED, @"bannerEnglish",
NSSTRING_STATUS_NO_ROM_LOADED, @"bannerFrench",

View File

@ -46,6 +46,9 @@
+ (NSString *) appInternalNameAndVersionString;
+ (NSString *) appCompilerDetailString;
+ (NSString *) operatingSystemString;
+ (NSString *) modelIdentifierString;
@end
#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_4

View File

@ -20,6 +20,8 @@
#import "cocoa_globals.h"
#import "types.h"
#include <sys/types.h>
#include <sys/sysctl.h>
#include "../version.h"
#undef BOOL
@ -147,6 +149,37 @@ static NSDate *distantFutureDate = [[NSDate distantFuture] retain];
return [NSString stringWithCString:EMU_DESMUME_COMPILER_DETAIL() encoding:NSUTF8StringEncoding];
}
+ (NSString *) operatingSystemString
{
NSDictionary *systemDict = [NSDictionary dictionaryWithContentsOfFile:@"/System/Library/CoreServices/SystemVersion.plist"];
NSString *productString = (NSString *)[systemDict objectForKey:@"ProductName"];
NSString *versionString = (NSString *)[systemDict objectForKey:@"ProductVersion"];
NSString *buildString = (NSString *)[systemDict objectForKey:@"ProductBuildVersion"];
return [[[[[productString stringByAppendingString:@" v"] stringByAppendingString:versionString] stringByAppendingString:@" ("] stringByAppendingString:buildString] stringByAppendingString:@")"];
}
+ (NSString *) modelIdentifierString
{
NSString *modelIdentifierStr = @"";
size_t stringLength = 0;
char *modelCString = NULL;
sysctlbyname("hw.model", NULL, &stringLength, NULL, 0);
if (stringLength == 0)
{
return modelIdentifierStr;
}
modelCString = (char *)malloc(stringLength * sizeof(char));
sysctlbyname("hw.model", modelCString, &stringLength, NULL, 0);
modelIdentifierStr = [NSString stringWithCString:modelCString encoding:NSUTF8StringEncoding];
free(modelCString);
return modelIdentifierStr;
}
@end
#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_4

File diff suppressed because it is too large Load Diff

View File

@ -38,10 +38,13 @@
NSWindow *mainWindow;
NSWindow *prefWindow;
NSWindow *troubleshootingWindow;
NSWindow *cheatListWindow;
NSWindow *migrationWindow;
NSView *prefGeneralView;
InputPrefsView *inputPrefsView;
NSView *troubleshootingSupportRequestView;
NSView *troubleshootingBugReportView;
NSMenu *mLoadStateSlot;
NSMenu *mSaveStateSlot;
@ -66,12 +69,15 @@
@property (readonly) IBOutlet NSObjectController *cdsCoreController;
@property (readonly) IBOutlet NSWindow *mainWindow;
@property (readonly) IBOutlet NSWindow *prefWindow;
@property (readonly) IBOutlet NSWindow *troubleshootingWindow;
@property (readonly) IBOutlet NSWindow *cheatListWindow;
@property (readonly) IBOutlet NSWindow *migrationWindow;
@property (readonly) IBOutlet NSView *prefGeneralView;
@property (readonly) IBOutlet NSMenu *mLoadStateSlot;
@property (readonly) IBOutlet NSMenu *mSaveStateSlot;
@property (readonly) IBOutlet InputPrefsView *inputPrefsView;
@property (readonly) IBOutlet NSView *troubleshootingSupportRequestView;
@property (readonly) IBOutlet NSView *troubleshootingBugReportView;
@property (readonly) IBOutlet NSBox *boxGeneralInfo;
@property (readonly) IBOutlet NSBox *boxTitles;
@ -93,6 +99,7 @@
// Help Menu
- (IBAction) launchWebsite:(id)sender;
- (IBAction) launchForums:(id)sender;
- (IBAction) supportRequest:(id)sender;
- (IBAction) bugReport:(id)sender;
- (void) setupSlotMenuItems;

View File

@ -19,6 +19,7 @@
#import "appDelegate.h"
#import "emuWindowDelegate.h"
#import "preferencesWindowDelegate.h"
#import "troubleshootingWindowDelegate.h"
#import "cheatWindowDelegate.h"
#import "displayView.h"
#import "inputPrefsView.h"
@ -38,12 +39,15 @@
@dynamic dummyObject;
@synthesize mainWindow;
@synthesize prefWindow;
@synthesize troubleshootingWindow;
@synthesize cheatListWindow;
@synthesize migrationWindow;
@synthesize prefGeneralView;
@synthesize mLoadStateSlot;
@synthesize mSaveStateSlot;
@synthesize inputPrefsView;
@synthesize troubleshootingSupportRequestView;
@synthesize troubleshootingBugReportView;
@synthesize fileMigrationList;
@synthesize aboutWindowController;
@synthesize emuWindowController;
@ -94,7 +98,7 @@
{
EmuWindowDelegate *mainWindowDelegate = [mainWindow delegate];
PreferencesWindowDelegate *prefWindowDelegate = [prefWindow delegate];
CheatWindowDelegate *cheatWindowDelegate = [cheatListWindow delegate];
CheatWindowDelegate *cheatWindowDelegate = (CheatWindowDelegate *)[cheatListWindow delegate];
// Determine if we're running on Intel or PPC.
#if defined(__i386__) || defined(__x86_64__)
@ -121,7 +125,10 @@
NSString *buildInfoStr = @"Build Info:";
buildInfoStr = [[buildInfoStr stringByAppendingString:[CocoaDSUtil appInternalVersionString]] stringByAppendingString:[CocoaDSUtil appCompilerDetailString]];
buildInfoStr = [[buildInfoStr stringByAppendingString:@"\nBuild Date: "] stringByAppendingString:@__DATE__];
buildInfoStr = [[buildInfoStr stringByAppendingString:@"\nModel Identifier: "] stringByAppendingString:[CocoaDSUtil modelIdentifierString]];
buildInfoStr = [[buildInfoStr stringByAppendingString:@"\nOperating System: "] stringByAppendingString:[CocoaDSUtil operatingSystemString]];
NSFont *aboutTextFilesFont = [NSFont fontWithName:@"Monaco" size:10];
NSMutableDictionary *aboutWindowProperties = [NSMutableDictionary dictionaryWithObjectsAndKeys:
[[NSBundle mainBundle] pathForResource:@FILENAME_README ofType:@""], @"readMePath",
[[NSBundle mainBundle] pathForResource:@FILENAME_COPYING ofType:@""], @"licensePath",
@ -129,6 +136,7 @@
[[NSBundle mainBundle] pathForResource:@FILENAME_CHANGELOG ofType:@""], @"changeLogPath",
descriptionStr, @"descriptionString",
buildInfoStr, @"buildInfoString",
aboutTextFilesFont, @"aboutTextFilesFont",
nil];
[aboutWindowController setContent:aboutWindowProperties];
@ -307,9 +315,22 @@
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@STRING_DESMUME_FORUM_SITE]];
}
- (IBAction) supportRequest:(id)sender
{
TroubleshootingWindowDelegate *troubleshootingWindowDelegate = [troubleshootingWindow delegate];
[troubleshootingWindowDelegate switchViewByID:TROUBLESHOOTING_TECH_SUPPORT_VIEW_ID];
[troubleshootingWindow setTitle:NSSTRING_TITLE_TECH_SUPPORT_WINDOW_TITLE];
[troubleshootingWindow makeKeyAndOrderFront:sender];
}
- (IBAction) bugReport:(id)sender
{
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@STRING_DESMUME_BUG_SITE]];
TroubleshootingWindowDelegate *troubleshootingWindowDelegate = [troubleshootingWindow delegate];
[troubleshootingWindowDelegate switchViewByID:TROUBLESHOOTING_BUG_REPORT_VIEW_ID];
[troubleshootingWindow setTitle:NSSTRING_TITLE_BUG_REPORT_WINDOW_TITLE];
[troubleshootingWindow makeKeyAndOrderFront:sender];
}
- (void) setupSlotMenuItems

View File

@ -0,0 +1,66 @@
/*
Copyright (C) 2012 DeSmuME team
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with the this software. If not, see <http://www.gnu.org/licenses/>.
*/
#import <Cocoa/Cocoa.h>
enum TroubleshootingViewID
{
TROUBLESHOOTING_TECH_SUPPORT_VIEW_ID = 0,
TROUBLESHOOTING_BUG_REPORT_VIEW_ID
};
#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_5
@interface TroubleshootingWindowDelegate : NSObject <NSWindowDelegate>
#else
@interface TroubleshootingWindowDelegate : NSObject
#endif
{
NSObject *dummyObject;
NSWindow *window;
NSObjectController *troubleshootingWindowController;
NSObjectController *romInfoController;
NSView *viewSupportRequest;
NSView *viewBugReport;
NSView *viewFinishedForm;
NSView *currentForm;
NSMutableDictionary *bindings;
}
@property (readonly) IBOutlet NSObject *dummyObject;
@property (readonly) IBOutlet NSWindow *window;
@property (readonly) IBOutlet NSObjectController *troubleshootingWindowController;
@property (readonly) IBOutlet NSObjectController *romInfoController;
@property (readonly) IBOutlet NSView *viewSupportRequest;
@property (readonly) IBOutlet NSView *viewBugReport;
@property (readonly) IBOutlet NSView *viewFinishedForm;
@property (readonly) NSMutableDictionary *bindings;
- (IBAction) copyRomInfoToTextFields:(id)sender;
- (IBAction) continueToFinalForm:(id)sender;
- (IBAction) backForm:(id)sender;
- (IBAction) copyInfoToPasteboard:(id)sender;
- (IBAction) goToWebpage:(id)sender;
- (void) switchViewByID:(TroubleshootingViewID)viewID;
- (void) clearAllText;
- (void) switchContentView:(NSView *)theView;
@end

View File

@ -0,0 +1,226 @@
/*
Copyright (C) 2012 DeSmuME team
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with the this software. If not, see <http://www.gnu.org/licenses/>.
*/
#import "troubleshootingWindowDelegate.h"
#import "cocoa_util.h"
#import "cocoa_globals.h"
@implementation TroubleshootingWindowDelegate
@synthesize dummyObject;
@synthesize window;
@synthesize troubleshootingWindowController;
@synthesize romInfoController;
@synthesize viewSupportRequest;
@synthesize viewBugReport;
@synthesize viewFinishedForm;
@synthesize bindings;
- (id)init
{
self = [super init];
if(self == nil)
{
return nil;
}
bindings = [[NSMutableDictionary alloc] init];
if (bindings == nil)
{
[self release];
self = nil;
return self;
}
return self;
}
- (void)dealloc
{
[super dealloc];
}
- (IBAction) copyRomInfoToTextFields:(id)sender
{
NSMutableDictionary *romInfoBindings = (NSMutableDictionary *)[romInfoController content];
NSString *romNameStr = (NSString *)[romInfoBindings valueForKey:@"romInternalName"];
NSString *romSerialStr = (NSString *)[romInfoBindings valueForKey:@"romSerial"];
[bindings setValue:romNameStr forKey:@"romName"];
[bindings setValue:romSerialStr forKey:@"romSerial"];
}
- (IBAction) continueToFinalForm:(id)sender
{
static const NSString *unspecifiedStr = @"Unspecified"; // Do not expose localized version for this NSString -- we want this to be in English
// Force end of editing of any text fields.
[window makeFirstResponder:nil];
// Set final form text.
#ifdef PUBLIC_RELEASE
NSString *appVersionStr = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"];
#else
NSString *appVersionStr = [[CocoaDSUtil appInternalVersionString] stringByAppendingString:[CocoaDSUtil appCompilerDetailString]];
#endif
NSString *romNameStr = (NSString *)[bindings valueForKey:@"romName"];
if (romNameStr == nil)
{
romNameStr = unspecifiedStr;
}
NSString *romSerialStr = (NSString *)[bindings valueForKey:@"romSerial"];
if (romSerialStr == nil)
{
romSerialStr = unspecifiedStr;
}
NSString *finalFormTextStr = @"App Version: ";
finalFormTextStr = [finalFormTextStr stringByAppendingString:appVersionStr];
finalFormTextStr = [[finalFormTextStr stringByAppendingString:@"\nOperating System: "] stringByAppendingString:[CocoaDSUtil operatingSystemString]];
finalFormTextStr = [[finalFormTextStr stringByAppendingString:@"\nModel Identifier: "] stringByAppendingString:[CocoaDSUtil modelIdentifierString]];
finalFormTextStr = [[finalFormTextStr stringByAppendingString:@"\nROM Name: "] stringByAppendingString:romNameStr];
finalFormTextStr = [[finalFormTextStr stringByAppendingString:@"\nROM Serial: "] stringByAppendingString:romSerialStr];
if ([window contentView] == viewSupportRequest)
{
NSString *supportRequestTextStr = (NSString *)[bindings valueForKey:@"supportRequestText"];
if (supportRequestTextStr == nil)
{
supportRequestTextStr = unspecifiedStr;
}
finalFormTextStr = [[finalFormTextStr stringByAppendingString:@"\n\nSupport Request: "] stringByAppendingString:supportRequestTextStr];
[bindings setValue:NSSTRING_HELP_COPY_PASTE_TECH_SUPPORT forKey:@"copyPasteHelpText"];
[bindings setValue:NSSTRING_TITLE_GO_TECH_SUPPORT_WEBPAGE_TITLE forKey:@"goWebpageButtonTitle"];
}
else
{
NSString *bugReportObservedTextStr = (NSString *)[bindings valueForKey:@"bugReportObservedText"];
if (bugReportObservedTextStr == nil)
{
bugReportObservedTextStr = unspecifiedStr;
}
NSString *bugReportExpectedTextStr = (NSString *)[bindings valueForKey:@"bugReportExpectedText"];
if (bugReportExpectedTextStr == nil)
{
bugReportExpectedTextStr = unspecifiedStr;
}
finalFormTextStr = [[finalFormTextStr stringByAppendingString:@"\n\nObserved Behavior: "] stringByAppendingString:bugReportObservedTextStr];
finalFormTextStr = [[finalFormTextStr stringByAppendingString:@"\n\nExpected Behavior: "] stringByAppendingString:bugReportExpectedTextStr];
[bindings setValue:NSSTRING_HELP_COPY_PASTE_BUG_REPORT forKey:@"copyPasteHelpText"];
[bindings setValue:NSSTRING_TITLE_GO_BUG_REPORT_WEBPAGE_TITLE forKey:@"goWebpageButtonTitle"];
}
[bindings setValue:finalFormTextStr forKey:@"finalFormText"];
// Remember the current form and switch the window view.
currentForm = [window contentView];
[self switchContentView:viewFinishedForm];
}
- (IBAction) backForm:(id)sender
{
[self switchContentView:currentForm];
}
- (IBAction) copyInfoToPasteboard:(id)sender
{
NSPasteboard *pboard = [NSPasteboard generalPasteboard];
[pboard declareTypes:[NSArray arrayWithObjects:NSStringPboardType, nil] owner:self];
[pboard setString:(NSString *)[bindings valueForKey:@"finalFormText"] forType:NSStringPboardType];
}
- (IBAction) goToWebpage:(id)sender
{
if (currentForm == viewSupportRequest)
{
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@STRING_DESMUME_TECH_SUPPORT_SITE]];
}
else
{
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@STRING_DESMUME_BUG_REPORT_SITE]];
}
}
- (void) switchViewByID:(TroubleshootingViewID)viewID
{
NSView *viewToSwitch = nil;
switch (viewID)
{
case TROUBLESHOOTING_TECH_SUPPORT_VIEW_ID:
viewToSwitch = viewSupportRequest;
break;
case TROUBLESHOOTING_BUG_REPORT_VIEW_ID:
viewToSwitch = viewBugReport;
break;
default:
break;
}
if (viewToSwitch == nil)
{
return;
}
[self clearAllText];
[self switchContentView:viewToSwitch];
}
- (void) clearAllText
{
[bindings removeObjectForKey:@"romName"];
[bindings removeObjectForKey:@"romSerial"];
[bindings removeObjectForKey:@"supportRequestText"];
[bindings removeObjectForKey:@"bugReportObservedText"];
[bindings removeObjectForKey:@"bugReportExpectedText"];
[bindings removeObjectForKey:@"finalFormText"];
}
- (void) switchContentView:(NSView *)theView
{
if ([window contentView] == theView)
{
return;
}
NSRect newFrame = [window frameRectForContentRect:[theView frame]];
newFrame.origin.x = [window frame].origin.x;
newFrame.origin.y = [window frame].origin.y + [[window contentView] frame].size.height - [theView frame].size.height;
NSView *tempView = [[NSView alloc] initWithFrame:[[window contentView] frame]];
[window setContentView:tempView];
[window setFrame:newFrame display:YES animate:YES];
[window setContentView:theView];
[tempView release];
}
- (void)windowDidBecomeKey:(NSNotification *)notification
{
[troubleshootingWindowController setContent:bindings];
}
@end