diff --git a/desmume/src/cocoa/DeSmuME (XCode 3).xcodeproj/project.pbxproj b/desmume/src/cocoa/DeSmuME (XCode 3).xcodeproj/project.pbxproj index cffb13236..2b82cd952 100644 --- a/desmume/src/cocoa/DeSmuME (XCode 3).xcodeproj/project.pbxproj +++ b/desmume/src/cocoa/DeSmuME (XCode 3).xcodeproj/project.pbxproj @@ -261,8 +261,6 @@ AB2F3C2A15CF9C6000858373 /* OGLRender.cpp in Sources */ = {isa = PBXBuildFile; fileRef = ABD1FEC11345AC8400AF11D1 /* OGLRender.cpp */; }; AB2F3C2B15CF9C6000858373 /* appDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB3ACB6714C2361100D7D192 /* appDelegate.mm */; }; AB2F3C2C15CF9C6000858373 /* cheatWindowDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB3ACB6914C2361100D7D192 /* cheatWindowDelegate.mm */; }; - AB2F3C2D15CF9C6000858373 /* displayView.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB3ACB6B14C2361100D7D192 /* displayView.mm */; }; - AB2F3C2E15CF9C6000858373 /* emuWindowDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB3ACB6D14C2361100D7D192 /* emuWindowDelegate.mm */; }; AB2F3C2F15CF9C6000858373 /* inputPrefsView.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB3ACB6F14C2361100D7D192 /* inputPrefsView.mm */; }; AB2F3C3015CF9C6000858373 /* preferencesWindowDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB3ACB7114C2361100D7D192 /* preferencesWindowDelegate.mm */; }; AB2F3C3115CF9C6000858373 /* 2xsai.cpp in Sources */ = {isa = PBXBuildFile; fileRef = ABFE14FA14C92FF5005D6699 /* 2xsai.cpp */; }; @@ -283,8 +281,6 @@ AB2F3C4115CF9C6000858373 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = AB0A0D1914AACA9600E83E91 /* libz.dylib */; }; AB3ACB7814C2361100D7D192 /* appDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB3ACB6714C2361100D7D192 /* appDelegate.mm */; }; AB3ACB7914C2361100D7D192 /* cheatWindowDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB3ACB6914C2361100D7D192 /* cheatWindowDelegate.mm */; }; - AB3ACB7A14C2361100D7D192 /* displayView.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB3ACB6B14C2361100D7D192 /* displayView.mm */; }; - AB3ACB7B14C2361100D7D192 /* emuWindowDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB3ACB6D14C2361100D7D192 /* emuWindowDelegate.mm */; }; AB3ACB7C14C2361100D7D192 /* inputPrefsView.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB3ACB6F14C2361100D7D192 /* inputPrefsView.mm */; }; AB3ACB7D14C2361100D7D192 /* preferencesWindowDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB3ACB7114C2361100D7D192 /* preferencesWindowDelegate.mm */; }; AB3ACC4414C24D5400D7D192 /* AUTHORS in Resources */ = {isa = PBXBuildFile; fileRef = AB3ACC3814C24D5400D7D192 /* AUTHORS */; }; @@ -300,6 +296,14 @@ AB6A198416CAD66900384EED /* cocoa_GPU.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB6A198216CAD66900384EED /* cocoa_GPU.mm */; }; AB6A198516CAD66900384EED /* cocoa_GPU.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB6A198216CAD66900384EED /* cocoa_GPU.mm */; }; AB6A198616CAD66900384EED /* cocoa_GPU.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB6A198216CAD66900384EED /* cocoa_GPU.mm */; }; + AB700DBA16CDDBC400FBD336 /* DisplayWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = AB700DB816CDDBC400FBD336 /* DisplayWindow.xib */; }; + AB700DBB16CDDBC400FBD336 /* DisplayWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = AB700DB816CDDBC400FBD336 /* DisplayWindow.xib */; }; + AB700DBC16CDDBC400FBD336 /* DisplayWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = AB700DB816CDDBC400FBD336 /* DisplayWindow.xib */; }; + AB700DBD16CDDBC400FBD336 /* DisplayWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = AB700DB816CDDBC400FBD336 /* DisplayWindow.xib */; }; + AB700DDE16CDE4C300FBD336 /* DisplayWindowController.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB700DDD16CDE4C300FBD336 /* DisplayWindowController.mm */; }; + AB700DDF16CDE4C300FBD336 /* DisplayWindowController.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB700DDD16CDE4C300FBD336 /* DisplayWindowController.mm */; }; + AB700DE016CDE4C300FBD336 /* DisplayWindowController.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB700DDD16CDE4C300FBD336 /* DisplayWindowController.mm */; }; + AB700DE116CDE4C300FBD336 /* DisplayWindowController.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB700DDD16CDE4C300FBD336 /* DisplayWindowController.mm */; }; AB711ED21481C35F009011C8 /* KeyNames.plist in Resources */ = {isa = PBXBuildFile; fileRef = AB02475B13886BF300E9F9AB /* KeyNames.plist */; }; AB711ED31481C35F009011C8 /* DefaultKeyMappings.plist in Resources */ = {isa = PBXBuildFile; fileRef = ABC719E1138CB25E002827A9 /* DefaultKeyMappings.plist */; }; AB711ED81481C35F009011C8 /* DefaultUserPrefs.plist in Resources */ = {isa = PBXBuildFile; fileRef = ABBC0F8C1394B1AA0028B6BD /* DefaultUserPrefs.plist */; }; @@ -578,8 +582,6 @@ AB73AA181507C9F500A310C8 /* OGLRender.cpp in Sources */ = {isa = PBXBuildFile; fileRef = ABD1FEC11345AC8400AF11D1 /* OGLRender.cpp */; }; AB73AA191507C9F500A310C8 /* appDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB3ACB6714C2361100D7D192 /* appDelegate.mm */; }; AB73AA1A1507C9F500A310C8 /* cheatWindowDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB3ACB6914C2361100D7D192 /* cheatWindowDelegate.mm */; }; - AB73AA1B1507C9F500A310C8 /* displayView.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB3ACB6B14C2361100D7D192 /* displayView.mm */; }; - AB73AA1C1507C9F500A310C8 /* emuWindowDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB3ACB6D14C2361100D7D192 /* emuWindowDelegate.mm */; }; AB73AA1D1507C9F500A310C8 /* inputPrefsView.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB3ACB6F14C2361100D7D192 /* inputPrefsView.mm */; }; AB73AA1E1507C9F500A310C8 /* preferencesWindowDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB3ACB7114C2361100D7D192 /* preferencesWindowDelegate.mm */; }; AB73AA1F1507C9F500A310C8 /* 2xsai.cpp in Sources */ = {isa = PBXBuildFile; fileRef = ABFE14FA14C92FF5005D6699 /* 2xsai.cpp */; }; @@ -772,8 +774,6 @@ ABAD102015ACE7A00000EC47 /* OGLRender.cpp in Sources */ = {isa = PBXBuildFile; fileRef = ABD1FEC11345AC8400AF11D1 /* OGLRender.cpp */; }; ABAD102115ACE7A00000EC47 /* appDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB3ACB6714C2361100D7D192 /* appDelegate.mm */; }; ABAD102215ACE7A00000EC47 /* cheatWindowDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB3ACB6914C2361100D7D192 /* cheatWindowDelegate.mm */; }; - ABAD102315ACE7A00000EC47 /* displayView.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB3ACB6B14C2361100D7D192 /* displayView.mm */; }; - ABAD102415ACE7A00000EC47 /* emuWindowDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB3ACB6D14C2361100D7D192 /* emuWindowDelegate.mm */; }; ABAD102515ACE7A00000EC47 /* inputPrefsView.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB3ACB6F14C2361100D7D192 /* inputPrefsView.mm */; }; ABAD102615ACE7A00000EC47 /* preferencesWindowDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB3ACB7114C2361100D7D192 /* preferencesWindowDelegate.mm */; }; ABAD102715ACE7A00000EC47 /* 2xsai.cpp in Sources */ = {isa = PBXBuildFile; fileRef = ABFE14FA14C92FF5005D6699 /* 2xsai.cpp */; }; @@ -957,10 +957,6 @@ AB3ACB6714C2361100D7D192 /* appDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = appDelegate.mm; sourceTree = ""; }; AB3ACB6814C2361100D7D192 /* cheatWindowDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cheatWindowDelegate.h; sourceTree = ""; }; AB3ACB6914C2361100D7D192 /* cheatWindowDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = cheatWindowDelegate.mm; sourceTree = ""; }; - AB3ACB6A14C2361100D7D192 /* displayView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = displayView.h; sourceTree = ""; }; - AB3ACB6B14C2361100D7D192 /* displayView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = displayView.mm; sourceTree = ""; }; - AB3ACB6C14C2361100D7D192 /* emuWindowDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = emuWindowDelegate.h; sourceTree = ""; }; - AB3ACB6D14C2361100D7D192 /* emuWindowDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = emuWindowDelegate.mm; sourceTree = ""; }; AB3ACB6E14C2361100D7D192 /* inputPrefsView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = inputPrefsView.h; sourceTree = ""; }; AB3ACB6F14C2361100D7D192 /* inputPrefsView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = inputPrefsView.mm; sourceTree = ""; }; AB3ACB7014C2361100D7D192 /* preferencesWindowDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = preferencesWindowDelegate.h; sourceTree = ""; }; @@ -980,6 +976,9 @@ AB6A198116CAD66900384EED /* cocoa_GPU.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cocoa_GPU.h; sourceTree = ""; }; AB6A198216CAD66900384EED /* cocoa_GPU.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = cocoa_GPU.mm; sourceTree = ""; }; AB6FBEF5139B6258007BB045 /* slot1_retail_nand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = slot1_retail_nand.cpp; sourceTree = ""; }; + AB700DB916CDDBC400FBD336 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = translations/English.lproj/DisplayWindow.xib; sourceTree = ""; }; + AB700DDC16CDE4C300FBD336 /* DisplayWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DisplayWindowController.h; sourceTree = ""; }; + AB700DDD16CDE4C300FBD336 /* DisplayWindowController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DisplayWindowController.mm; sourceTree = ""; }; AB711F7F1481C35F009011C8 /* DeSmuME.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DeSmuME.app; sourceTree = BUILT_PRODUCTS_DIR; }; AB73AA331507C9F500A310C8 /* DeSmuME.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DeSmuME.app; sourceTree = BUILT_PRODUCTS_DIR; }; AB75226D14C7BB51009B97B3 /* AppIcon_FirmwareConfig.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = AppIcon_FirmwareConfig.icns; sourceTree = ""; }; @@ -1458,6 +1457,7 @@ children = ( ABC2ECD613B1C87000FAAA2A /* Images */, AB00E87C14205EBC00DE561F /* MainMenu.xib */, + AB700DB816CDDBC400FBD336 /* DisplayWindow.xib */, AB350D3A147A1D93007165AC /* HID_usage_strings.plist */, 8D1107310486CEB800E47090 /* Info.plist */, AB02791814415E4C0075E58C /* Info (Debug).plist */, @@ -1490,17 +1490,15 @@ children = ( AB3ACB6614C2361100D7D192 /* appDelegate.h */, AB3ACB6814C2361100D7D192 /* cheatWindowDelegate.h */, - AB3ACB6A14C2361100D7D192 /* displayView.h */, + AB700DDC16CDE4C300FBD336 /* DisplayWindowController.h */, AB6A187A16C9951C00384EED /* EmuControllerDelegate.h */, - AB3ACB6C14C2361100D7D192 /* emuWindowDelegate.h */, AB3ACB6E14C2361100D7D192 /* inputPrefsView.h */, AB3ACB7014C2361100D7D192 /* preferencesWindowDelegate.h */, ABA0356E169127BB00817C69 /* troubleshootingWindowDelegate.h */, AB3ACB6714C2361100D7D192 /* appDelegate.mm */, AB3ACB6914C2361100D7D192 /* cheatWindowDelegate.mm */, - AB3ACB6B14C2361100D7D192 /* displayView.mm */, + AB700DDD16CDE4C300FBD336 /* DisplayWindowController.mm */, AB6A187B16C9951C00384EED /* EmuControllerDelegate.mm */, - AB3ACB6D14C2361100D7D192 /* emuWindowDelegate.mm */, AB3ACB6F14C2361100D7D192 /* inputPrefsView.mm */, AB3ACB7114C2361100D7D192 /* preferencesWindowDelegate.mm */, ABA0356F169127C000817C69 /* troubleshootingWindowDelegate.mm */, @@ -2165,6 +2163,7 @@ AB2F3BC115CF9C6000858373 /* README in Resources */, AB2F3BC215CF9C6000858373 /* README.MAC in Resources */, AB2F3BC315CF9C6000858373 /* AppIcon_FirmwareConfig.icns in Resources */, + AB700DBA16CDDBC400FBD336 /* DisplayWindow.xib in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -2243,6 +2242,7 @@ AB3ACC4714C24D5400D7D192 /* README in Resources */, AB3ACC4914C24D5400D7D192 /* README.MAC in Resources */, AB75226F14C7BB51009B97B3 /* AppIcon_FirmwareConfig.icns in Resources */, + AB700DBB16CDDBC400FBD336 /* DisplayWindow.xib in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -2321,6 +2321,7 @@ AB73A9AE1507C9F500A310C8 /* README in Resources */, AB73A9B01507C9F500A310C8 /* README.MAC in Resources */, AB73A9B11507C9F500A310C8 /* AppIcon_FirmwareConfig.icns in Resources */, + AB700DBD16CDDBC400FBD336 /* DisplayWindow.xib in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -2399,6 +2400,7 @@ ABAD0FB715ACE7A00000EC47 /* README in Resources */, ABAD0FB815ACE7A00000EC47 /* README.MAC in Resources */, ABAD0FB915ACE7A00000EC47 /* AppIcon_FirmwareConfig.icns in Resources */, + AB700DBC16CDDBC400FBD336 /* DisplayWindow.xib in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -2622,8 +2624,6 @@ AB2F3C2A15CF9C6000858373 /* OGLRender.cpp in Sources */, AB2F3C2B15CF9C6000858373 /* appDelegate.mm in Sources */, AB2F3C2C15CF9C6000858373 /* cheatWindowDelegate.mm in Sources */, - AB2F3C2D15CF9C6000858373 /* displayView.mm in Sources */, - AB2F3C2E15CF9C6000858373 /* emuWindowDelegate.mm in Sources */, AB2F3C2F15CF9C6000858373 /* inputPrefsView.mm in Sources */, AB2F3C3015CF9C6000858373 /* preferencesWindowDelegate.mm in Sources */, AB2F3C3115CF9C6000858373 /* 2xsai.cpp in Sources */, @@ -2649,6 +2649,7 @@ AB279D6E16A4E6DE00ECC692 /* TDStretch.cpp in Sources */, AB6A187C16C9951C00384EED /* EmuControllerDelegate.mm in Sources */, AB6A198316CAD66900384EED /* cocoa_GPU.mm in Sources */, + AB700DDF16CDE4C300FBD336 /* DisplayWindowController.mm in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -2750,8 +2751,6 @@ AB711F6E1481C35F009011C8 /* cocoa_videofilter.mm in Sources */, AB3ACB7814C2361100D7D192 /* appDelegate.mm in Sources */, AB3ACB7914C2361100D7D192 /* cheatWindowDelegate.mm in Sources */, - AB3ACB7A14C2361100D7D192 /* displayView.mm in Sources */, - AB3ACB7B14C2361100D7D192 /* emuWindowDelegate.mm in Sources */, AB3ACB7C14C2361100D7D192 /* inputPrefsView.mm in Sources */, AB3ACB7D14C2361100D7D192 /* preferencesWindowDelegate.mm in Sources */, ABFE150F14C92FF5005D6699 /* 2xsai.cpp in Sources */, @@ -2807,6 +2806,7 @@ AB279D7916A4E6DE00ECC692 /* TDStretch.cpp in Sources */, AB6A187E16C9951C00384EED /* EmuControllerDelegate.mm in Sources */, AB6A198516CAD66900384EED /* cocoa_GPU.mm in Sources */, + AB700DE116CDE4C300FBD336 /* DisplayWindowController.mm in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -2908,8 +2908,6 @@ AB73AA181507C9F500A310C8 /* OGLRender.cpp in Sources */, AB73AA191507C9F500A310C8 /* appDelegate.mm in Sources */, AB73AA1A1507C9F500A310C8 /* cheatWindowDelegate.mm in Sources */, - AB73AA1B1507C9F500A310C8 /* displayView.mm in Sources */, - AB73AA1C1507C9F500A310C8 /* emuWindowDelegate.mm in Sources */, AB73AA1D1507C9F500A310C8 /* inputPrefsView.mm in Sources */, AB73AA1E1507C9F500A310C8 /* preferencesWindowDelegate.mm in Sources */, AB73AA1F1507C9F500A310C8 /* 2xsai.cpp in Sources */, @@ -2965,6 +2963,7 @@ AB279D6316A4E6DE00ECC692 /* TDStretch.cpp in Sources */, AB6A187F16C9951C00384EED /* EmuControllerDelegate.mm in Sources */, AB6A198616CAD66900384EED /* cocoa_GPU.mm in Sources */, + AB700DDE16CDE4C300FBD336 /* DisplayWindowController.mm in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -3066,8 +3065,6 @@ ABAD102015ACE7A00000EC47 /* OGLRender.cpp in Sources */, ABAD102115ACE7A00000EC47 /* appDelegate.mm in Sources */, ABAD102215ACE7A00000EC47 /* cheatWindowDelegate.mm in Sources */, - ABAD102315ACE7A00000EC47 /* displayView.mm in Sources */, - ABAD102415ACE7A00000EC47 /* emuWindowDelegate.mm in Sources */, ABAD102515ACE7A00000EC47 /* inputPrefsView.mm in Sources */, ABAD102615ACE7A00000EC47 /* preferencesWindowDelegate.mm in Sources */, ABAD102715ACE7A00000EC47 /* 2xsai.cpp in Sources */, @@ -3093,6 +3090,7 @@ AB279D8416A4E6DE00ECC692 /* TDStretch.cpp in Sources */, AB6A187D16C9951C00384EED /* EmuControllerDelegate.mm in Sources */, AB6A198416CAD66900384EED /* cocoa_GPU.mm in Sources */, + AB700DE016CDE4C300FBD336 /* DisplayWindowController.mm in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -3123,6 +3121,14 @@ name = HID_usage_strings.plist; sourceTree = ""; }; + AB700DB816CDDBC400FBD336 /* DisplayWindow.xib */ = { + isa = PBXVariantGroup; + children = ( + AB700DB916CDDBC400FBD336 /* English */, + ); + name = DisplayWindow.xib; + sourceTree = ""; + }; AB901BDD1420706100348EEC /* Localizable.strings */ = { isa = PBXVariantGroup; children = ( diff --git a/desmume/src/cocoa/DeSmuME (XCode 4).xcodeproj/project.pbxproj b/desmume/src/cocoa/DeSmuME (XCode 4).xcodeproj/project.pbxproj index d5cc669f5..aedab7d32 100644 --- a/desmume/src/cocoa/DeSmuME (XCode 4).xcodeproj/project.pbxproj +++ b/desmume/src/cocoa/DeSmuME (XCode 4).xcodeproj/project.pbxproj @@ -77,8 +77,6 @@ AB3A656316CC5438001F5D4A /* cocoa_GPU.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB3A656016CC5438001F5D4A /* cocoa_GPU.mm */; }; AB3ACB7214C2361100D7D192 /* appDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB3ACB6714C2361100D7D192 /* appDelegate.mm */; }; AB3ACB7314C2361100D7D192 /* cheatWindowDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB3ACB6914C2361100D7D192 /* cheatWindowDelegate.mm */; }; - AB3ACB7414C2361100D7D192 /* displayView.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB3ACB6B14C2361100D7D192 /* displayView.mm */; }; - AB3ACB7514C2361100D7D192 /* emuWindowDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB3ACB6D14C2361100D7D192 /* emuWindowDelegate.mm */; }; AB3ACB7614C2361100D7D192 /* inputPrefsView.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB3ACB6F14C2361100D7D192 /* inputPrefsView.mm */; }; AB3ACB7714C2361100D7D192 /* preferencesWindowDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB3ACB7114C2361100D7D192 /* preferencesWindowDelegate.mm */; }; AB3ACC3E14C24D5400D7D192 /* AUTHORS in Resources */ = {isa = PBXBuildFile; fileRef = AB3ACC3814C24D5400D7D192 /* AUTHORS */; }; @@ -360,8 +358,6 @@ AB796D5415CDCBA200C59155 /* cocoa_videofilter.mm in Sources */ = {isa = PBXBuildFile; fileRef = ABE5DFE4143FB1DA00835AD8 /* cocoa_videofilter.mm */; }; AB796D5515CDCBA200C59155 /* appDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB3ACB6714C2361100D7D192 /* appDelegate.mm */; }; AB796D5615CDCBA200C59155 /* cheatWindowDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB3ACB6914C2361100D7D192 /* cheatWindowDelegate.mm */; }; - AB796D5715CDCBA200C59155 /* displayView.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB3ACB6B14C2361100D7D192 /* displayView.mm */; }; - AB796D5815CDCBA200C59155 /* emuWindowDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB3ACB6D14C2361100D7D192 /* emuWindowDelegate.mm */; }; AB796D5915CDCBA200C59155 /* inputPrefsView.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB3ACB6F14C2361100D7D192 /* inputPrefsView.mm */; }; AB796D5A15CDCBA200C59155 /* preferencesWindowDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB3ACB7114C2361100D7D192 /* preferencesWindowDelegate.mm */; }; AB796D5B15CDCBA200C59155 /* 2xsai.cpp in Sources */ = {isa = PBXBuildFile; fileRef = ABFE14FA14C92FF5005D6699 /* 2xsai.cpp */; }; @@ -382,6 +378,10 @@ AB796D6B15CDCBA200C59155 /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ABC570D4134431DA00E7B0B1 /* OpenGL.framework */; }; AB796D6C15CDCBA200C59155 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = AB0A0D1914AACA9600E83E91 /* libz.dylib */; }; AB80E04D142BC4A800A52038 /* cocoa_util.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB80E04C142BC4A800A52038 /* cocoa_util.mm */; }; + AB8967D916D2ED0700F826F1 /* DisplayWindowController.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB8967D816D2ED0700F826F1 /* DisplayWindowController.mm */; }; + AB8967DA16D2ED0700F826F1 /* DisplayWindowController.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB8967D816D2ED0700F826F1 /* DisplayWindowController.mm */; }; + AB8967DD16D2ED2700F826F1 /* DisplayWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = AB8967DB16D2ED2700F826F1 /* DisplayWindow.xib */; }; + AB8967DE16D2ED2700F826F1 /* DisplayWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = AB8967DB16D2ED2700F826F1 /* DisplayWindow.xib */; }; AB901BDE1420706100348EEC /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = AB901BDD1420706100348EEC /* Localizable.strings */; }; AB91D46B13BD013800462471 /* fs-linux.cpp in Sources */ = {isa = PBXBuildFile; fileRef = ABD1FEB21345AC8400AF11D1 /* fs-linux.cpp */; }; ABA6574B14511EC90077E5E9 /* cocoa_cheat.mm in Sources */ = {isa = PBXBuildFile; fileRef = ABA6574A14511EC90077E5E9 /* cocoa_cheat.mm */; }; @@ -692,10 +692,6 @@ AB3ACB6714C2361100D7D192 /* appDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = appDelegate.mm; sourceTree = ""; }; AB3ACB6814C2361100D7D192 /* cheatWindowDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cheatWindowDelegate.h; sourceTree = ""; }; AB3ACB6914C2361100D7D192 /* cheatWindowDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = cheatWindowDelegate.mm; sourceTree = ""; }; - AB3ACB6A14C2361100D7D192 /* displayView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = displayView.h; sourceTree = ""; }; - AB3ACB6B14C2361100D7D192 /* displayView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = displayView.mm; sourceTree = ""; }; - AB3ACB6C14C2361100D7D192 /* emuWindowDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = emuWindowDelegate.h; sourceTree = ""; }; - AB3ACB6D14C2361100D7D192 /* emuWindowDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = emuWindowDelegate.mm; sourceTree = ""; }; AB3ACB6E14C2361100D7D192 /* inputPrefsView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = inputPrefsView.h; sourceTree = ""; }; AB3ACB6F14C2361100D7D192 /* inputPrefsView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = inputPrefsView.mm; sourceTree = ""; }; AB3ACB7014C2361100D7D192 /* preferencesWindowDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = preferencesWindowDelegate.h; sourceTree = ""; }; @@ -791,6 +787,9 @@ AB80E050142BC4FA00A52038 /* cocoa_util.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cocoa_util.h; sourceTree = ""; }; AB817A34143EE2DB00A7DFE9 /* videofilter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = videofilter.h; sourceTree = ""; }; AB817A35143EE2DB00A7DFE9 /* videofilter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = videofilter.cpp; sourceTree = ""; }; + AB8967D716D2ED0700F826F1 /* DisplayWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DisplayWindowController.h; sourceTree = ""; }; + AB8967D816D2ED0700F826F1 /* DisplayWindowController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DisplayWindowController.mm; sourceTree = ""; }; + AB8967DC16D2ED2700F826F1 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = translations/English.lproj/DisplayWindow.xib; sourceTree = ""; }; AB901BDF1420706B00348EEC /* Japanese */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; lineEnding = 0; name = Japanese; path = translations/Japanese.lproj/Localizable.strings; sourceTree = ""; }; AB901BE01420706F00348EEC /* French */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; lineEnding = 0; name = French; path = translations/French.lproj/Localizable.strings; sourceTree = ""; }; AB901BE11420707400348EEC /* Italian */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; lineEnding = 0; name = Italian; path = translations/Italian.lproj/Localizable.strings; sourceTree = ""; }; @@ -1202,6 +1201,7 @@ children = ( ABC2ECD613B1C87000FAAA2A /* Images */, AB00E87C14205EBC00DE561F /* MainMenu.xib */, + AB8967DB16D2ED2700F826F1 /* DisplayWindow.xib */, AB350D3A147A1D93007165AC /* HID_usage_strings.plist */, 8D1107310486CEB800E47090 /* Info.plist */, AB02791814415E4C0075E58C /* Info (Debug).plist */, @@ -1234,17 +1234,15 @@ children = ( AB3ACB6614C2361100D7D192 /* appDelegate.h */, AB3ACB6814C2361100D7D192 /* cheatWindowDelegate.h */, - AB3ACB6A14C2361100D7D192 /* displayView.h */, + AB8967D716D2ED0700F826F1 /* DisplayWindowController.h */, AB3A655C16CC5416001F5D4A /* EmuControllerDelegate.h */, - AB3ACB6C14C2361100D7D192 /* emuWindowDelegate.h */, AB3ACB6E14C2361100D7D192 /* inputPrefsView.h */, AB3ACB7014C2361100D7D192 /* preferencesWindowDelegate.h */, ABF2B9F81690412A000FF7C0 /* troubleshootingWindowDelegate.h */, AB3ACB6714C2361100D7D192 /* appDelegate.mm */, AB3ACB6914C2361100D7D192 /* cheatWindowDelegate.mm */, - AB3ACB6B14C2361100D7D192 /* displayView.mm */, + AB8967D816D2ED0700F826F1 /* DisplayWindowController.mm */, AB3A655D16CC5421001F5D4A /* EmuControllerDelegate.mm */, - AB3ACB6D14C2361100D7D192 /* emuWindowDelegate.mm */, AB3ACB6F14C2361100D7D192 /* inputPrefsView.mm */, AB3ACB7114C2361100D7D192 /* preferencesWindowDelegate.mm */, ABF2B9FA16904133000FF7C0 /* troubleshootingWindowDelegate.mm */, @@ -1903,6 +1901,7 @@ AB3ACC4114C24D5400D7D192 /* README in Resources */, AB3ACC4314C24D5400D7D192 /* README.MAC in Resources */, AB75226E14C7BB51009B97B3 /* AppIcon_FirmwareConfig.icns in Resources */, + AB8967DE16D2ED2700F826F1 /* DisplayWindow.xib in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1981,6 +1980,7 @@ AB796CEB15CDCBA200C59155 /* README in Resources */, AB796CEC15CDCBA200C59155 /* README.MAC in Resources */, AB796CED15CDCBA200C59155 /* AppIcon_FirmwareConfig.icns in Resources */, + AB8967DD16D2ED2700F826F1 /* DisplayWindow.xib in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -2192,8 +2192,6 @@ AB0F291D14BE6F4A009ABC6F /* OGLRender.cpp in Sources */, AB3ACB7214C2361100D7D192 /* appDelegate.mm in Sources */, AB3ACB7314C2361100D7D192 /* cheatWindowDelegate.mm in Sources */, - AB3ACB7414C2361100D7D192 /* displayView.mm in Sources */, - AB3ACB7514C2361100D7D192 /* emuWindowDelegate.mm in Sources */, AB3ACB7614C2361100D7D192 /* inputPrefsView.mm in Sources */, AB3ACB7714C2361100D7D192 /* preferencesWindowDelegate.mm in Sources */, ABFE150714C92FF5005D6699 /* 2xsai.cpp in Sources */, @@ -2240,6 +2238,7 @@ AB23567516C2FAD800DA782E /* OGLRender_3_2.cpp in Sources */, AB3A655F16CC5421001F5D4A /* EmuControllerDelegate.mm in Sources */, AB3A656216CC5438001F5D4A /* cocoa_GPU.mm in Sources */, + AB8967DA16D2ED0700F826F1 /* DisplayWindowController.mm in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -2351,8 +2350,6 @@ AB796D5415CDCBA200C59155 /* cocoa_videofilter.mm in Sources */, AB796D5515CDCBA200C59155 /* appDelegate.mm in Sources */, AB796D5615CDCBA200C59155 /* cheatWindowDelegate.mm in Sources */, - AB796D5715CDCBA200C59155 /* displayView.mm in Sources */, - AB796D5815CDCBA200C59155 /* emuWindowDelegate.mm in Sources */, AB796D5915CDCBA200C59155 /* inputPrefsView.mm in Sources */, AB796D5A15CDCBA200C59155 /* preferencesWindowDelegate.mm in Sources */, AB796D5B15CDCBA200C59155 /* 2xsai.cpp in Sources */, @@ -2398,6 +2395,7 @@ AB26D87C16B5253D00A2305C /* OGLRender_3_2.cpp in Sources */, AB3A655E16CC5421001F5D4A /* EmuControllerDelegate.mm in Sources */, AB3A656116CC5438001F5D4A /* cocoa_GPU.mm in Sources */, + AB8967D916D2ED0700F826F1 /* DisplayWindowController.mm in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -2573,6 +2571,14 @@ name = HID_usage_strings.plist; sourceTree = ""; }; + AB8967DB16D2ED2700F826F1 /* DisplayWindow.xib */ = { + isa = PBXVariantGroup; + children = ( + AB8967DC16D2ED2700F826F1 /* English */, + ); + name = DisplayWindow.xib; + sourceTree = ""; + }; AB901BDD1420706100348EEC /* Localizable.strings */ = { isa = PBXVariantGroup; children = ( diff --git a/desmume/src/cocoa/cocoa_core.h b/desmume/src/cocoa/cocoa_core.h index 5cb7d95cd..6d0f6047a 100644 --- a/desmume/src/cocoa/cocoa_core.h +++ b/desmume/src/cocoa/cocoa_core.h @@ -37,7 +37,8 @@ typedef struct unsigned int framesToSkip; uint64_t timeBudgetMachAbsTime; bool exitThread; - pthread_mutex_t *mutexCoreExecute; + pthread_mutex_t mutexCoreExecute; + pthread_mutex_t mutexOutputList; pthread_mutex_t mutexThreadExecute; pthread_cond_t condThreadExecute; } CoreThreadParam; @@ -68,7 +69,6 @@ typedef struct BOOL emuFlagEmulateEnsata; NSInteger cpuEmulationEngine; - pthread_mutex_t *mutexCoreExecute; OSSpinLock spinlockCdsController; OSSpinLock spinlockMasterExecute; OSSpinLock spinlockExecutionChange; diff --git a/desmume/src/cocoa/cocoa_core.mm b/desmume/src/cocoa/cocoa_core.mm index 078fa89dc..efdfda99f 100644 --- a/desmume/src/cocoa/cocoa_core.mm +++ b/desmume/src/cocoa/cocoa_core.mm @@ -66,7 +66,7 @@ volatile bool execute = true; @dynamic arm7ImageURL; @dynamic firmwareImageURL; -@synthesize mutexCoreExecute; +@dynamic mutexCoreExecute; static BOOL isCoreStarted = NO; @@ -94,8 +94,6 @@ static BOOL isCoreStarted = NO; emuFlagDebugConsole = NO; emuFlagEmulateEnsata = NO; - mutexCoreExecute = (pthread_mutex_t *)malloc(sizeof(pthread_mutex_t)); - pthread_mutex_init(mutexCoreExecute, NULL); spinlockMasterExecute = OS_SPINLOCK_INIT; spinlockCdsController = OS_SPINLOCK_INIT; spinlockExecutionChange = OS_SPINLOCK_INIT; @@ -119,12 +117,13 @@ static BOOL isCoreStarted = NO; threadParam.timeBudgetMachAbsTime = *(uint64_t *)&timeBudgetAbsTime; threadParam.exitThread = false; - threadParam.mutexCoreExecute = mutexCoreExecute; + pthread_mutex_init(&threadParam.mutexCoreExecute, NULL); + pthread_mutex_init(&threadParam.mutexOutputList, NULL); pthread_mutex_init(&threadParam.mutexThreadExecute, NULL); pthread_cond_init(&threadParam.condThreadExecute, NULL); pthread_create(&coreThread, NULL, &RunCoreThread, &threadParam); - [cdsGPU setMutexProducer:mutexCoreExecute]; + [cdsGPU setMutexProducer:self.mutexCoreExecute]; return self; } @@ -155,10 +154,6 @@ static BOOL isCoreStarted = NO; pthread_mutex_destroy(&threadParam.mutexThreadExecute); pthread_cond_destroy(&threadParam.condThreadExecute); - pthread_mutex_destroy(self.mutexCoreExecute); - free(self.mutexCoreExecute); - mutexCoreExecute = nil; - self.cdsController = nil; self.cdsFirmware = nil; self.cdsGPU = nil; @@ -166,6 +161,9 @@ static BOOL isCoreStarted = NO; [self removeAllOutputs]; [cdsOutputList release]; + pthread_mutex_destroy(&threadParam.mutexOutputList); + pthread_mutex_destroy(&threadParam.mutexCoreExecute); + [super dealloc]; } @@ -337,7 +335,7 @@ static BOOL isCoreStarted = NO; emulationFlags = theFlags; OSSpinLockUnlock(&spinlockEmulationFlags); - pthread_mutex_lock(self.mutexCoreExecute); + pthread_mutex_lock(&threadParam.mutexCoreExecute); if (theFlags & EMULATION_ADVANCED_BUS_LEVEL_TIMING_MASK) { @@ -438,7 +436,7 @@ static BOOL isCoreStarted = NO; CommonSettings.DebugConsole = false; } - pthread_mutex_unlock(self.mutexCoreExecute); + pthread_mutex_unlock(&threadParam.mutexCoreExecute); } - (NSUInteger) emulationFlags @@ -548,6 +546,11 @@ static BOOL isCoreStarted = NO; return [NSURL fileURLWithPath:[NSString stringWithCString:CommonSettings.Firmware encoding:NSUTF8StringEncoding]]; } +- (pthread_mutex_t *) mutexCoreExecute +{ + return &threadParam.mutexCoreExecute; +} + - (void) setEjectCardFlag { if (nds.cardEjected) @@ -572,9 +575,9 @@ static BOOL isCoreStarted = NO; - (void) changeRomSaveType:(NSInteger)saveTypeID { - pthread_mutex_lock(self.mutexCoreExecute); + pthread_mutex_lock(&threadParam.mutexCoreExecute); [CocoaDSRom changeRomSaveType:saveTypeID]; - pthread_mutex_unlock(self.mutexCoreExecute); + pthread_mutex_unlock(&threadParam.mutexCoreExecute); } - (void) changeExecutionSpeed @@ -648,18 +651,24 @@ static BOOL isCoreStarted = NO; - (void) addOutput:(CocoaDSOutput *)theOutput { + pthread_mutex_lock(&threadParam.mutexOutputList); theOutput.mutexProducer = self.mutexCoreExecute; [self.cdsOutputList addObject:theOutput]; + pthread_mutex_unlock(&threadParam.mutexOutputList); } - (void) removeOutput:(CocoaDSOutput *)theOutput { + pthread_mutex_lock(&threadParam.mutexOutputList); [self.cdsOutputList removeObject:theOutput]; + pthread_mutex_unlock(&threadParam.mutexOutputList); } - (void) removeAllOutputs { + pthread_mutex_lock(&threadParam.mutexOutputList); [self.cdsOutputList removeAllObjects]; + pthread_mutex_unlock(&threadParam.mutexOutputList); } - (void) runThread:(id)object @@ -709,9 +718,9 @@ static void* RunCoreThread(void *arg) NDS_endProcessingInput(); // Execute the frame and increment the frame counter. - pthread_mutex_lock(param->mutexCoreExecute); + pthread_mutex_lock(¶m->mutexCoreExecute); NDS_exec(); - pthread_mutex_unlock(param->mutexCoreExecute); + pthread_mutex_unlock(¶m->mutexCoreExecute); // Check if an internal execution error occurred that halted the emulation. if (!execute) @@ -727,6 +736,7 @@ static void* RunCoreThread(void *arg) param->frameCount++; } + pthread_mutex_lock(¶m->mutexOutputList); for(CocoaDSOutput *cdsOutput in cdsOutputList) { if (param->framesToSkip > 0 && [cdsOutput isMemberOfClass:[CocoaDSDisplay class]]) @@ -736,6 +746,7 @@ static void* RunCoreThread(void *arg) [cdsOutput doCoreEmuFrame]; } + pthread_mutex_unlock(¶m->mutexOutputList); // Determine the number of frames to skip based on how much time "debt" // we owe on timeBudget. diff --git a/desmume/src/cocoa/cocoa_globals.h b/desmume/src/cocoa/cocoa_globals.h index c778fb20f..27475fe36 100644 --- a/desmume/src/cocoa/cocoa_globals.h +++ b/desmume/src/cocoa/cocoa_globals.h @@ -1,6 +1,6 @@ /* Copyright (C) 2011 Roger Manuel - Copyright (C) 2013 DeSmuME team + Copyright (C) 2012-2013 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 @@ -48,6 +48,8 @@ #define NSSTRING_TITLE_ENABLE_HUD NSLocalizedString(@"Enable HUD", nil) #define NSSTRING_TITLE_HIDE_STATUS_BAR NSLocalizedString(@"Hide Status Bar", nil) #define NSSTRING_TITLE_SHOW_STATUS_BAR NSLocalizedString(@"Show Status Bar", nil) +#define NSSTRING_TITLE_HIDE_TOOLBAR NSLocalizedString(@"Hide Toolbar", nil) +#define NSSTRING_TITLE_SHOW_TOOLBAR NSLocalizedString(@"Show Toolbar", nil) #define NSSTRING_TITLE_SPEED_1X NSLocalizedString(@"Speed 1x", nil) #define NSSTRING_TITLE_SPEED_2X NSLocalizedString(@"Speed 2x", nil) #define NSSTRING_TITLE_SLOT_NUMBER NSLocalizedString(@"Slot %ld", nil) diff --git a/desmume/src/cocoa/cocoa_output.h b/desmume/src/cocoa/cocoa_output.h index f7f272b20..e75afba68 100644 --- a/desmume/src/cocoa/cocoa_output.h +++ b/desmume/src/cocoa/cocoa_output.h @@ -117,7 +117,6 @@ typedef struct @required - (void) doDisplayModeChanged:(NSInteger)displayModeID; -@property (retain) NSPort *sendPortDisplay; @property (assign) BOOL isHudEnabled; @property (assign) BOOL isHudEditingModeEnabled; diff --git a/desmume/src/cocoa/cocoa_output.mm b/desmume/src/cocoa/cocoa_output.mm index 7476c883b..5a7b31986 100644 --- a/desmume/src/cocoa/cocoa_output.mm +++ b/desmume/src/cocoa/cocoa_output.mm @@ -43,7 +43,7 @@ - (id)init { - self = [super init]; + self = [super initWithAutoreleaseInterval:0.1]; if (self == nil) { return self; @@ -65,17 +65,8 @@ - (void)dealloc { - // Exit the thread. - if (self.thread != nil) - { - self.threadExit = YES; - - // Wait until the thread has shut down. - while (self.thread != nil) - { - [NSThread sleepUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.01]]; - } - } + // Force the thread to exit now so that we can safely release other resources. + [self forceThreadExit]; self.frameData = nil; self.frameAttributesData = nil; @@ -474,7 +465,6 @@ if (theDelegate != nil) { [theDelegate retain]; - [theDelegate setSendPortDisplay:self.receivePort]; } [delegate release]; @@ -822,7 +812,6 @@ if (theDelegate != nil) { [theDelegate retain]; - [theDelegate setSendPortDisplay:self.receivePort]; } [videoDelegate release]; diff --git a/desmume/src/cocoa/cocoa_util.h b/desmume/src/cocoa/cocoa_util.h index c1c35665d..afe8dec4d 100644 --- a/desmume/src/cocoa/cocoa_util.h +++ b/desmume/src/cocoa/cocoa_util.h @@ -1,6 +1,6 @@ /* Copyright (C) 2011 Roger Manuel - Copyright (C) 2012 DeSmuME team + Copyright (C) 2012-2013 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 @@ -67,14 +67,15 @@ NSPort *receivePort; } -@property (retain) NSThread *thread; +@property (assign) NSThread *thread; @property (assign) BOOL threadExit; @property (assign) NSTimeInterval autoreleaseInterval; -@property (retain) NSPort *sendPort; -@property (readonly) NSPort *receivePort; +@property (assign) NSPort *sendPort; +@property (assign) NSPort *receivePort; - (id) initWithAutoreleaseInterval:(NSTimeInterval)interval; - (void) runThread:(id)object; +- (void) forceThreadExit; @end diff --git a/desmume/src/cocoa/cocoa_util.mm b/desmume/src/cocoa/cocoa_util.mm index 80387efc6..63c1032c9 100644 --- a/desmume/src/cocoa/cocoa_util.mm +++ b/desmume/src/cocoa/cocoa_util.mm @@ -1,6 +1,6 @@ /* Copyright (C) 2011 Roger Manuel - Copyright (C) 2013 DeSmuME team + Copyright (C) 2012-2013 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 @@ -35,6 +35,11 @@ static NSDate *distantFutureDate = [[NSDate distantFuture] retain]; + (void) messageSendOneWay:(NSPort *)sendPort msgID:(NSInteger)msgID { + if (sendPort == nil || ![sendPort isValid]) + { + return; + } + NSPortMessage *message = [[NSPortMessage alloc] initWithSendPort:sendPort receivePort:nil components:nil]; [message setMsgid:msgID]; [message sendBeforeDate:distantFutureDate]; @@ -43,6 +48,11 @@ static NSDate *distantFutureDate = [[NSDate distantFuture] retain]; + (void) messageSendOneWayWithMessageComponents:(NSPort *)sendPort msgID:(NSInteger)msgID array:(NSArray *)msgDataArray { + if (sendPort == nil || ![sendPort isValid]) + { + return; + } + NSPortMessage *message = [[NSPortMessage alloc] initWithSendPort:sendPort receivePort:nil components:msgDataArray]; [message setMsgid:msgID]; [message sendBeforeDate:distantFutureDate]; @@ -51,6 +61,11 @@ static NSDate *distantFutureDate = [[NSDate distantFuture] retain]; + (void) messageSendOneWayWithData:(NSPort *)sendPort msgID:(NSInteger)msgID data:(NSData *)msgData { + if (sendPort == nil || ![sendPort isValid]) + { + return; + } + NSArray *messageComponents = [[NSArray alloc] initWithObjects:msgData, nil]; [CocoaDSUtil messageSendOneWayWithMessageComponents:sendPort msgID:msgID array:messageComponents]; [messageComponents release]; @@ -58,6 +73,11 @@ static NSDate *distantFutureDate = [[NSDate distantFuture] retain]; + (void) messageSendOneWayWithInteger:(NSPort *)sendPort msgID:(NSInteger)msgID integerValue:(NSInteger)integerValue { + if (sendPort == nil || ![sendPort isValid]) + { + return; + } + NSData *messageData = [[NSData alloc] initWithBytes:&integerValue length:sizeof(NSInteger)]; [CocoaDSUtil messageSendOneWayWithData:sendPort msgID:msgID data:messageData]; [messageData release]; @@ -65,6 +85,11 @@ static NSDate *distantFutureDate = [[NSDate distantFuture] retain]; + (void) messageSendOneWayWithFloat:(NSPort *)sendPort msgID:(NSInteger)msgID floatValue:(float)floatValue { + if (sendPort == nil || ![sendPort isValid]) + { + return; + } + NSData *messageData = [[NSData alloc] initWithBytes:&floatValue length:sizeof(float)]; [CocoaDSUtil messageSendOneWayWithData:sendPort msgID:msgID data:messageData]; [messageData release]; @@ -72,6 +97,11 @@ static NSDate *distantFutureDate = [[NSDate distantFuture] retain]; + (void) messageSendOneWayWithBool:(NSPort *)sendPort msgID:(NSInteger)msgID boolValue:(BOOL)boolValue { + if (sendPort == nil || ![sendPort isValid]) + { + return; + } + NSData *messageData = [[NSData alloc] initWithBytes:&boolValue length:sizeof(BOOL)]; [CocoaDSUtil messageSendOneWayWithData:sendPort msgID:msgID data:messageData]; [messageData release]; @@ -79,6 +109,11 @@ static NSDate *distantFutureDate = [[NSDate distantFuture] retain]; + (void) messageSendOneWayWithRect:(NSPort *)sendPort msgID:(NSInteger)msgID rect:(NSRect)rect { + if (sendPort == nil || ![sendPort isValid]) + { + return; + } + NSData *messageData = [[NSData alloc] initWithBytes:&rect length:sizeof(NSRect)]; [CocoaDSUtil messageSendOneWayWithData:sendPort msgID:msgID data:messageData]; [messageData release]; @@ -239,21 +274,7 @@ static NSDate *distantFutureDate = [[NSDate distantFuture] retain]; - (void)dealloc { - // Exit the thread. - if (self.thread != nil) - { - // Tell the thread to shut down. - self.threadExit = YES; - - // Wait until the thread has shut down. - while (self.thread != nil) - { - [NSThread sleepUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.01]]; - } - } - - self.sendPort = nil; - [receivePort release]; + [self forceThreadExit]; [super dealloc]; } @@ -261,24 +282,48 @@ static NSDate *distantFutureDate = [[NSDate distantFuture] retain]; - (void) runThread:(id)object { NSAutoreleasePool *threadPool = [[NSAutoreleasePool alloc] init]; - NSRunLoop *runLoop = [[NSRunLoop currentRunLoop] retain]; + NSRunLoop *runLoop = [NSRunLoop currentRunLoop]; - [runLoop addPort:self.receivePort forMode:NSDefaultRunLoopMode]; - self.thread = [NSThread currentThread]; + [runLoop addPort:[self receivePort] forMode:NSDefaultRunLoopMode]; + [self setThread:[NSThread currentThread]]; do { NSAutoreleasePool *runLoopPool = [[NSAutoreleasePool alloc] init]; - NSDate *runDate = [[NSDate alloc] initWithTimeIntervalSinceNow:self.autoreleaseInterval]; + NSDate *runDate = [[NSDate alloc] initWithTimeIntervalSinceNow:[self autoreleaseInterval]]; [runLoop runUntilDate:runDate]; [runDate release]; [runLoopPool release]; - } while (!self.threadExit); + } while (![self threadExit]); - self.thread = nil; - [runLoop release]; + NSPort *tempSendPort = [self sendPort]; + [self setSendPort:nil]; + [tempSendPort invalidate]; + [tempSendPort release]; + + NSPort *tempReceivePort = [self receivePort]; + [self setReceivePort:nil]; + [tempReceivePort invalidate]; + [tempReceivePort release]; [threadPool release]; + [self setThread:nil]; +} + +- (void) forceThreadExit +{ + if ([self thread] == nil) + { + return; + } + + [self setThreadExit:YES]; + + // Wait until the thread has shut down. + while ([self thread] != nil) + { + [NSThread sleepUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.01]]; + } } - (void)handlePortMessage:(NSPortMessage *)portMessage @@ -288,7 +333,7 @@ static NSDate *distantFutureDate = [[NSDate distantFuture] retain]; switch (message) { case MESSAGE_EXIT_THREAD: - self.threadExit = YES; + [self setThreadExit:YES]; break; default: diff --git a/desmume/src/cocoa/translations/English.lproj/DisplayWindow.xib b/desmume/src/cocoa/translations/English.lproj/DisplayWindow.xib new file mode 100644 index 000000000..3f550d5b8 --- /dev/null +++ b/desmume/src/cocoa/translations/English.lproj/DisplayWindow.xib @@ -0,0 +1,1900 @@ + + + + 1060 + 10K549 + 851 + 1038.36 + 461.00 + + com.apple.InterfaceBuilder.CocoaPlugin + 851 + + + YES + + + + YES + com.apple.InterfaceBuilder.CocoaPlugin + + + YES + + YES + + + YES + + + + YES + + DisplayWindowController + + + FirstResponder + + + NSApplication + + + 271 + 2 + {{830, 370}, {256, 408}} + 74973184 + DeSmuME + NSWindow + + + D5552DCE-722B-4ECB-8E0A-8B7CF76EAC70 + + + YES + YES + YES + YES + 1 + 2 + + YES + + YES + 0135754F-463F-4625-9D27-DEF701AEF50E + 2E728430-6055-404B-944F-25594ACBEC39 + 321036F9-6034-47B1-9CC5-2461D98700F0 + 41A299FB-4A95-4FA3-9982-8523FF04ACDE + C626F2C1-4353-4288-AD59-40FB7F4C1A58 + EDBFD998-E031-4AC5-A86A-7114D66FF847 + NSToolbarFlexibleSpaceItem + NSToolbarSpaceItem + + + YES + + + 0135754F-463F-4625-9D27-DEF701AEF50E + + Open ROM + Open ROM + + + + NSImage + Icon_OpenROM_420x420 + + + + {0, 0} + {0, 0} + YES + YES + -1 + YES + 0 + + + + 2E728430-6055-404B-944F-25594ACBEC39 + + Execute + Execute/Pause + + + + NSImage + Icon_Execute_420x420 + + + + {0, 0} + {0, 0} + YES + YES + -1 + YES + 0 + + + + 321036F9-6034-47B1-9CC5-2461D98700F0 + + Reset + Reset + + + + NSImage + Icon_Reset_420x420 + + + + {0, 0} + {0, 0} + YES + YES + -1 + YES + 0 + + + + 41A299FB-4A95-4FA3-9982-8523FF04ACDE + + Rotate Right + Rotate Right + + + + NSImage + Icon_RotateCW_420x420 + + + + {0, 0} + {0, 0} + YES + YES + 90 + YES + 0 + + + + C626F2C1-4353-4288-AD59-40FB7F4C1A58 + + Rotate Left + Rotate Left + + + + NSImage + Icon_RotateCCW_420x420 + + + + {0, 0} + {0, 0} + YES + YES + -90 + YES + 0 + + + + EDBFD998-E031-4AC5-A86A-7114D66FF847 + + Speed 2x + Speed 1x/2x + + + + NSImage + Icon_Speed2x_420x420 + + + + {0, 0} + {0, 0} + YES + YES + 200 + YES + 0 + + + NSToolbarFlexibleSpaceItem + + Flexible Space + + + + + + {1, 5} + {20000, 32} + YES + YES + -1 + YES + 0 + + YES + YES + + + 1048576 + 2147483647 + + NSImage + NSMenuCheckmark + + + NSImage + NSMenuMixedState + + + + + NSToolbarSpaceItem + + Space + + + + + + {32, 5} + {32, 32} + YES + YES + -1 + YES + 0 + + YES + YES + + + 1048576 + 2147483647 + + + + + + + + YES + + + + + + + + + + + YES + + + + + + + + + + {1.79769e+308, 1.79769e+308} + {256, 408} + + + 256 + + YES + + + 5156 + + {{2, 3}, {16, 16}} + + 28938 + 100 + + + + 289 + + YES + + YES + Apple PDF pasteboard type + Apple PICT pasteboard type + Apple PNG pasteboard type + NSFilenamesPboardType + NeXT Encapsulated PostScript v1.2 pasteboard type + NeXT TIFF v4.0 pasteboard type + + + {{160, 1}, {20, 20}} + + YES + + 130560 + 33554432 + + NSImage + Icon_VolumeFull_16x16 + + 0 + 2 + 0 + YES + + YES + + + + 294 + {{17, 5}, {137, 14}} + + YES + + 68288064 + 272634880 + + + LucidaGrande + 11 + 16 + + Status Text + + + 6 + System + controlColor + + 3 + MC42NjY2NjY2NjY3AA + + + + 6 + System + controlTextColor + + 3 + MAA + + + + + + + 45 + {{0, 24}, {256, 384}} + + YES + DisplayView + + + + 289 + {{180, 3}, {56, 15}} + + YES + + -2079981824 + 131072 + + + 100 + 0.0 + 100 + 0.0 + 0 + 1 + NO + NO + + + + {256, 408} + + + {{0, 0}, {1920, 1178}} + {256, 476} + {1.79769e+308, 1.79769e+308} + + + + 268 + + YES + + + 268 + {{176, 5}, {126, 26}} + + YES + + -2076049856 + 2048 + + LucidaGrande + 13 + 1044 + + + 109199615 + 1 + + + 400 + 75 + + + TIFF + + 2147483647 + 1 + + + _popUpItemAction: + + + YES + + OtherViews + + YES + + + + BMP + + 2147483647 + + + _popUpItemAction: + 1 + + + + + GIF + + 2147483647 + + + _popUpItemAction: + 2 + + + + + JPEG + + 2147483647 + + + _popUpItemAction: + 3 + + + + + PNG + + 2147483647 + + + _popUpItemAction: + 4 + + + + + JPEG 2000 + + 2147483647 + + + _popUpItemAction: + 5 + + + + + + 1 + YES + YES + 2 + + + + + 268 + {{38, 11}, {136, 17}} + + YES + + 68288064 + 71304192 + Select Image Format: + + + + + + + + {350, 35} + NSView + + + + + YES + + + window + + + + 22 + + + + hidden: isShowingStatusBar + + + + + + hidden: isShowingStatusBar + hidden + isShowingStatusBar + + NSValueTransformerName + NSNegateBoolean + + 2 + + + 52 + + + + enabled: isShowingStatusBar + + + + + + enabled: isShowingStatusBar + enabled + isShowingStatusBar + + NSValueTransformerName + NSNegateBoolean + + 2 + + + 53 + + + + hidden: isShowingStatusBar + + + + + + hidden: isShowingStatusBar + hidden + isShowingStatusBar + + NSValueTransformerName + NSNegateBoolean + + 2 + + + 54 + + + + changeCoreSpeed: + + + + 56 + + + + changeRotationRelative: + + + + 57 + + + + changeRotationRelative: + + + + 58 + + + + executeCoreToggle: + + + + 59 + + + + openRom: + + + + 60 + + + + resetCore: + + + + 61 + + + + delegate + + + + 62 + + + + view + + + + 64 + + + + value: emuControl.currentVolumeIcon + + + + + + value: emuControl.currentVolumeIcon + value + emuControl.currentVolumeIcon + 2 + + + 65 + + + + value: emuControl.statusText + + + + + + value: emuControl.statusText + value + emuControl.statusText + + YES + + YES + NSAllowsEditingMultipleValuesSelection + NSRaisesForNotApplicableKeys + NSValidatesImmediately + + + YES + + + + + + 2 + + + 67 + + + + animate: emuControl.isWorking + + + + + + animate: emuControl.isWorking + animate + emuControl.isWorking + 2 + + + 68 + + + + value: emuControl.currentVolumeValue + + + + + + value: emuControl.currentVolumeValue + value + emuControl.currentVolumeValue + 2 + + + 88 + + + + changeVolume: + + + + 89 + + + + hidden: isShowingStatusBar + + + + + + hidden: isShowingStatusBar + hidden + isShowingStatusBar + + NSValueTransformerName + NSNegateBoolean + + 2 + + + 92 + + + + saveScreenshotPanelAccessoryView + + + + 105 + + + + selectedTag: screenshotFileFormat + + + + + + selectedTag: screenshotFileFormat + selectedTag + screenshotFileFormat + 2 + + + 106 + + + + + YES + + 0 + + + + + + -2 + + + File's Owner + + + -1 + + + First Responder + + + -3 + + + Application + + + 3 + + + YES + + + + + + + 4 + + + YES + + + + + + + + + + + + + 5 + + + YES + + + + + + + + + + 6 + + + YES + + + + + + 8 + + + YES + + + + + + 10 + + + + + 12 + + + + + 13 + + + + + 14 + + + + + 15 + + + + + 16 + + + + + 17 + + + + + 18 + + + + + 19 + + + + + 20 + + + + + 21 + + + + + 63 + + + + + 84 + + + YES + + + + + + 85 + + + + + 93 + + + YES + + + + + Screenshot Save Panel Accessory + + + 94 + + + YES + + + + + + 95 + + + YES + + + + + + 96 + + + + + 97 + + + YES + + + + + + 98 + + + YES + + + + + + + + + + + 99 + + + + + 100 + + + + + 101 + + + + + 102 + + + + + 103 + + + + + 104 + + + + + + + YES + + YES + -1.IBPluginDependency + -2.IBPluginDependency + -3.IBPluginDependency + 10.IBPluginDependency + 10.IBViewBoundsToFrameTransform + 100.IBPluginDependency + 101.IBPluginDependency + 102.IBPluginDependency + 103.IBPluginDependency + 104.IBPluginDependency + 13.IBPluginDependency + 14.IBPluginDependency + 15.IBPluginDependency + 16.IBPluginDependency + 17.IBPluginDependency + 18.IBPluginDependency + 19.IBPluginDependency + 20.IBPluginDependency + 21.IBPluginDependency + 3.IBEditorWindowLastContentRect + 3.IBPluginDependency + 3.IBWindowTemplateEditedContentRect + 3.NSWindowTemplate.visibleAtLaunch + 3.editorWindowContentRectSynchronizationRect + 3.windowTemplate.hasMinSize + 3.windowTemplate.maxSize + 3.windowTemplate.minSize + 4.IBEditorWindowLastContentRect + 4.IBPluginDependency + 5.IBPluginDependency + 6.IBPluginDependency + 6.IBViewBoundsToFrameTransform + 63.IBPluginDependency + 63.IBViewBoundsToFrameTransform + 8.IBViewBoundsToFrameTransform + 84.IBPluginDependency + 84.IBViewBoundsToFrameTransform + 85.IBPluginDependency + 93.IBEditorWindowLastContentRect + 93.IBPluginDependency + 93.IBViewBoundsToFrameTransform + 94.IBPluginDependency + 94.IBViewBoundsToFrameTransform + 95.IBPluginDependency + 95.IBViewBoundsToFrameTransform + 96.IBPluginDependency + 97.IBPluginDependency + 98.IBEditorWindowLastContentRect + 98.IBPluginDependency + 99.IBPluginDependency + + + YES + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + P4AAAL+AAABAQAAAwjAAAA + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + {{1316, 313}, {256, 408}} + com.apple.InterfaceBuilder.CocoaPlugin + {{1316, 313}, {256, 408}} + + {{33, 99}, {480, 360}} + + {3.40282e+38, 3.40282e+38} + {256, 408} + {{1056, 575}, {616, 0}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + P4AAAL+AAABBiAAAwYgAAA + + com.apple.InterfaceBuilder.CocoaPlugin + + AQAAAABDnAAAA + + + AULcAAA/gAAAA + + com.apple.InterfaceBuilder.CocoaPlugin + + P4AAAL+AAABCwAAAwZAAAA + + com.apple.InterfaceBuilder.CocoaPlugin + {{1220, 906}, {350, 35}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + P4AAAL+AAABDMAAAwegAAA + + com.apple.InterfaceBuilder.CocoaPlugin + + P4AAAL+AAABCGAAAwgwAAA + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + {{1185, 897}, {126, 123}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + + + YES + + + YES + + + + + YES + + + YES + + + + 106 + + + + YES + + DisplayView + NSView + + IBProjectSource + userinterface/DisplayWindowController.h + + + + DisplayWindowController + NSWindowController + + YES + + YES + changeCoreSpeed: + changeRotationRelative: + changeVolume: + copy: + executeCoreToggle: + openRom: + resetCore: + saveScreenshotAs: + toggleKeepMinDisplaySizeAtNormal: + toggleStatusBar: + + + YES + id + id + id + id + id + id + id + id + id + id + + + + YES + + YES + changeCoreSpeed: + changeRotationRelative: + changeVolume: + copy: + executeCoreToggle: + openRom: + resetCore: + saveScreenshotAs: + toggleKeepMinDisplaySizeAtNormal: + toggleStatusBar: + + + YES + + changeCoreSpeed: + id + + + changeRotationRelative: + id + + + changeVolume: + id + + + copy: + id + + + executeCoreToggle: + id + + + openRom: + id + + + resetCore: + id + + + saveScreenshotAs: + id + + + toggleKeepMinDisplaySizeAtNormal: + id + + + toggleStatusBar: + id + + + + + YES + + YES + saveScreenshotPanelAccessoryView + view + + + YES + NSView + DisplayView + + + + YES + + YES + saveScreenshotPanelAccessoryView + view + + + YES + + saveScreenshotPanelAccessoryView + NSView + + + view + DisplayView + + + + + + + + YES + + NSActionCell + NSCell + + IBFrameworkSource + AppKit.framework/Headers/NSActionCell.h + + + + NSApplication + NSResponder + + IBFrameworkSource + AppKit.framework/Headers/NSApplication.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSApplicationScripting.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSColorPanel.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSHelpManager.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSPageLayout.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSUserInterfaceItemSearching.h + + + + NSButton + NSControl + + IBFrameworkSource + AppKit.framework/Headers/NSButton.h + + + + NSButtonCell + NSActionCell + + IBFrameworkSource + AppKit.framework/Headers/NSButtonCell.h + + + + NSCell + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSCell.h + + + + NSControl + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSControl.h + + + + NSFormatter + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSFormatter.h + + + + NSImageCell + NSCell + + IBFrameworkSource + AppKit.framework/Headers/NSImageCell.h + + + + NSImageView + NSControl + + IBFrameworkSource + AppKit.framework/Headers/NSImageView.h + + + + NSMenu + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSMenu.h + + + + NSMenuItem + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSMenuItem.h + + + + NSMenuItemCell + NSButtonCell + + IBFrameworkSource + AppKit.framework/Headers/NSMenuItemCell.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSAccessibility.h + + + + NSObject + + + + NSObject + + + + NSObject + + + + NSObject + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSDictionaryController.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSDragging.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSFontManager.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSFontPanel.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSKeyValueBinding.h + + + + NSObject + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSNibLoading.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSOutlineView.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSPasteboard.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSSavePanel.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSTableView.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSToolbarItem.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSView.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSArchiver.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSClassDescription.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSError.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSFileManager.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueCoding.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueObserving.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyedArchiver.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSObject.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSObjectScripting.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSPortCoder.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSRunLoop.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSScriptClassDescription.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSScriptKeyValueCoding.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSScriptObjectSpecifiers.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSScriptWhoseTests.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSThread.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURL.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURLConnection.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURLDownload.h + + + + NSPopUpButton + NSButton + + IBFrameworkSource + AppKit.framework/Headers/NSPopUpButton.h + + + + NSPopUpButtonCell + NSMenuItemCell + + IBFrameworkSource + AppKit.framework/Headers/NSPopUpButtonCell.h + + + + NSProgressIndicator + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSProgressIndicator.h + + + + NSResponder + + IBFrameworkSource + AppKit.framework/Headers/NSInterfaceStyle.h + + + + NSResponder + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSResponder.h + + + + NSSlider + NSControl + + IBFrameworkSource + AppKit.framework/Headers/NSSlider.h + + + + NSSliderCell + NSActionCell + + IBFrameworkSource + AppKit.framework/Headers/NSSliderCell.h + + + + NSTextField + NSControl + + IBFrameworkSource + AppKit.framework/Headers/NSTextField.h + + + + NSTextFieldCell + NSActionCell + + IBFrameworkSource + AppKit.framework/Headers/NSTextFieldCell.h + + + + NSToolbar + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSToolbar.h + + + + NSToolbarItem + NSObject + + + + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSClipView.h + + + + NSView + + + + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSRulerView.h + + + + NSView + NSResponder + + + + NSWindow + + IBFrameworkSource + AppKit.framework/Headers/NSDrawer.h + + + + NSWindow + NSResponder + + IBFrameworkSource + AppKit.framework/Headers/NSWindow.h + + + + NSWindow + + IBFrameworkSource + AppKit.framework/Headers/NSWindowScripting.h + + + + NSWindowController + NSResponder + + showWindow: + id + + + showWindow: + + showWindow: + id + + + + IBFrameworkSource + AppKit.framework/Headers/NSWindowController.h + + + + + 0 + IBCocoaFramework + + com.apple.InterfaceBuilder.CocoaPlugin.macosx + + + + com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3 + + + YES + ../../DeSmuME (XCode 3).xcodeproj + 3 + + YES + + YES + Icon_Execute_420x420 + Icon_OpenROM_420x420 + Icon_Reset_420x420 + Icon_RotateCCW_420x420 + Icon_RotateCW_420x420 + Icon_Speed2x_420x420 + Icon_VolumeFull_16x16 + NSMenuCheckmark + NSMenuMixedState + + + YES + {420, 420} + {420, 420} + {420, 420} + {420, 420} + {420, 420} + {420, 420} + {20, 20} + {9, 8} + {7, 2} + + + + diff --git a/desmume/src/cocoa/translations/English.lproj/MainMenu.strings b/desmume/src/cocoa/translations/English.lproj/MainMenu.strings index 86234ad6c..d37af29eb 100644 Binary files a/desmume/src/cocoa/translations/English.lproj/MainMenu.strings and b/desmume/src/cocoa/translations/English.lproj/MainMenu.strings differ diff --git a/desmume/src/cocoa/translations/English.lproj/MainMenu.xib b/desmume/src/cocoa/translations/English.lproj/MainMenu.xib index 842fd528b..1201a40f0 100644 --- a/desmume/src/cocoa/translations/English.lproj/MainMenu.xib +++ b/desmume/src/cocoa/translations/English.lproj/MainMenu.xib @@ -12,7 +12,8 @@ YES - + + YES @@ -187,6 +188,15 @@ File YES + + + New Display Window + n + 1048576 + 2147483647 + + + Load ROM… @@ -222,15 +232,6 @@ _NSRecentDocumentsMenu - - - Unload ROM - w - 1048576 - 2147483647 - - - YES @@ -261,6 +262,34 @@ + + + Close Window + w + 1048576 + 2147483647 + + + + + + Unload ROM + w + 1572864 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + Open State File... @@ -1063,17 +1092,9 @@ - - - Show Sound Settings... - - 2147483647 - - - - Show Video Output Settings... + Show Display Video Settings... 2147483647 @@ -1095,6 +1116,14 @@ + + + Show Sound Settings... + + 2147483647 + + + YES @@ -3265,7 +3294,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA -1229176577 100 - + NSImage Icon_Speed2x_420x420 @@ -3333,7 +3362,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA -1229176577 100 - + NSImage Icon_Execute_420x420 @@ -3419,7 +3448,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA -1229176577 100 - + NSImage Icon_Reset_420x420 @@ -3450,6 +3479,9 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA AppDelegate + + EmuControllerDelegate + 15 2 @@ -4083,363 +4115,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA {{0, 0}, {1920, 1178}} {1.79769e+308, 1.79769e+308} - - 271 - 2 - {{830, 370}, {256, 408}} - 1148715008 - DeSmuME - NSWindow - - - D5552DCE-722B-4ECB-8E0A-8B7CF76EAC70 - - - YES - YES - YES - YES - 1 - 2 - - YES - - YES - 0135754F-463F-4625-9D27-DEF701AEF50E - 2E728430-6055-404B-944F-25594ACBEC39 - 321036F9-6034-47B1-9CC5-2461D98700F0 - 41A299FB-4A95-4FA3-9982-8523FF04ACDE - C626F2C1-4353-4288-AD59-40FB7F4C1A58 - EDBFD998-E031-4AC5-A86A-7114D66FF847 - NSToolbarFlexibleSpaceItem - NSToolbarSpaceItem - - - YES - - - 0135754F-463F-4625-9D27-DEF701AEF50E - - Open ROM - Open ROM - - - - NSImage - Icon_OpenROM_420x420 - - - - {0, 0} - {0, 0} - YES - YES - -1 - YES - 0 - - - - 2E728430-6055-404B-944F-25594ACBEC39 - - Execute - Execute/Pause - - - - - - {0, 0} - {0, 0} - YES - YES - -1 - YES - 0 - - - - 321036F9-6034-47B1-9CC5-2461D98700F0 - - Reset - Reset - - - - - - {0, 0} - {0, 0} - YES - YES - -1 - YES - 0 - - - - 41A299FB-4A95-4FA3-9982-8523FF04ACDE - - Rotate Right - Rotate Right - - - - NSImage - Icon_RotateCW_420x420 - - - - {0, 0} - {0, 0} - YES - YES - 90 - YES - 0 - - - - C626F2C1-4353-4288-AD59-40FB7F4C1A58 - - Rotate Left - Rotate Left - - - - NSImage - Icon_RotateCCW_420x420 - - - - {0, 0} - {0, 0} - YES - YES - -90 - YES - 0 - - - - EDBFD998-E031-4AC5-A86A-7114D66FF847 - - Speed 2x - Speed 1x/2x - - - - - - {0, 0} - {0, 0} - YES - YES - 200 - YES - 0 - - - NSToolbarFlexibleSpaceItem - - Flexible Space - - - - - - {1, 5} - {20000, 32} - YES - YES - -1 - YES - 0 - - YES - YES - - - 1048576 - 2147483647 - - - - - - NSToolbarSpaceItem - - Space - - - - - - {32, 5} - {32, 32} - YES - YES - -1 - YES - 0 - - YES - YES - - - 1048576 - 2147483647 - - - - - - - - YES - - - - - - - - - - - YES - - - - - - - - - - {1.79769e+308, 1.79769e+308} - {256, 408} - - - 256 - - YES - - - 5165 - - {{0, 24}, {256, 384}} - - - YES - - - AAAABQAAAAgAAAAYAAAACwAAAAgAAAAAA - - - - - - 5156 - - {{2, 3}, {16, 16}} - - - 28938 - 100 - - - - 289 - {{180, 3}, {56, 15}} - - - YES - - -2079981824 - 131072 - - - 100 - 0.0 - 100 - 0.0 - 0 - 1 - NO - NO - - - - - 289 - - YES - - YES - Apple PDF pasteboard type - Apple PICT pasteboard type - Apple PNG pasteboard type - NSFilenamesPboardType - NeXT Encapsulated PostScript v1.2 pasteboard type - NeXT TIFF v4.0 pasteboard type - - - {{160, 1}, {20, 20}} - - - YES - - 130560 - 33554432 - - NSImage - Icon_VolumeFull_16x16 - - 0 - 2 - 0 - YES - - YES - - - - 294 - {{17, 5}, {137, 14}} - - - YES - - 68288064 - 272634880 - - - LucidaGrande - 11 - 16 - - Status Text - - - - - - - {256, 408} - - - - {{0, 0}, {1920, 1178}} - {256, 476} - {1.79769e+308, 1.79769e+308} - - - EmuControllerDelegate - - - EmuWindowDelegate - 7 2 @@ -8947,7 +8622,10 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 130560 33554432 - + + NSImage + Icon_VolumeFull_16x16 + 0 2 0 @@ -10449,7 +10127,11 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 67239424 272633856 Files from previous versions may not be fully compatible with the current version, especially Save State files. File migration cannot guarantee that all your old files will continue to work. - + + LucidaGrande + 11 + 16 + @@ -10956,7 +10638,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA {1.79769e+308, 1.79769e+308} - + 256 YES @@ -10975,14 +10657,12 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 256 {270, 321} - YES 256 {270, 17} - @@ -10990,7 +10670,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA -2147483392 {{256, 0}, {16, 17}} - YES @@ -11100,7 +10779,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA {{1, 17}, {270, 321}} - @@ -11111,7 +10789,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA -2147483392 {{256, 17}, {15, 306}} - _doScroller: 0.99689440993788825 @@ -11121,7 +10798,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA -2147483392 {{1, 323}, {270, 15}} - 1 _doScroller: @@ -11136,7 +10812,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA {{1, 0}, {270, 17}} - @@ -11146,7 +10821,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA {{20, 49}, {272, 339}} - 562 @@ -11161,7 +10835,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 268 {{113, 12}, {185, 32}} - YES 67239424 @@ -11182,7 +10855,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 268 {{47, 19}, {28, 23}} - YES -2080244224 @@ -11204,7 +10876,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 268 {{20, 19}, {28, 23}} - YES -2080244224 @@ -11236,7 +10907,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 268 {{100, 372}, {209, 26}} - YES -2076049856 @@ -11301,7 +10971,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 301 {{2, 33}, {320, 290}} - NSView @@ -11309,7 +10978,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 268 {{16, 402}, {129, 18}} - YES 67239424 @@ -11332,7 +11000,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 268 {{15, 378}, {83, 17}} - YES 68288064 @@ -11353,7 +11020,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 12 {{14, 320}, {292, 5}} - {0, 0} 67239424 @@ -11376,7 +11042,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 268 {{103, 331}, {203, 39}} - YES -1805517311 @@ -11394,7 +11059,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 268 {{15, 353}, {83, 17}} - YES 68288064 @@ -11411,7 +11075,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 268 {{114, 6}, {96, 32}} - YES 67239424 @@ -11430,12 +11093,10 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA {{1, 1}, {324, 428}} - {{297, 16}, {326, 444}} - {0, 0} 67239424 @@ -11459,7 +11120,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 268 {{89, 446}, {70, 14}} - YES 68288064 @@ -11480,7 +11140,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 268 {{89, 421}, {69, 14}} - YES 68288064 @@ -11497,7 +11156,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 268 {{160, 421}, {135, 14}} - YES 70385217 @@ -11515,7 +11173,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 268 {{161, 446}, {134, 14}} - YES 70385217 @@ -11533,7 +11190,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 268 {{90, 394}, {190, 18}} - YES -2080244224 @@ -11568,7 +11224,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA {{20, 396}, {64, 64}} - YES 130560 @@ -11583,8 +11238,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA {640, 480} - - {{0, 0}, {1920, 1178}} {1.79769e+308, 1.79769e+308} @@ -11593,7 +11246,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA CheatWindowDelegate - + 256 YES @@ -11602,7 +11255,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 292 {{17, 4}, {294, 14}} - YES 68288064 @@ -11620,7 +11272,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA {{214, 220}, {16, 16}} - 28938 100 @@ -11629,7 +11280,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 268 {{133, 369}, {136, 22}} - YES -1539178944 @@ -11686,7 +11336,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 268 {{59, 374}, {60, 14}} - YES 68288064 @@ -11703,7 +11352,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 268 {{59, 398}, {72, 14}} - YES 68288064 @@ -11720,7 +11368,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 268 {{133, 393}, {136, 22}} - YES -2076049856 @@ -11777,7 +11424,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 268 {{0, 237}, {328, 134}} - NSView @@ -11785,7 +11431,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 268 {{233, 213}, {80, 28}} - YES 67239424 @@ -11806,7 +11451,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 268 {{59, 222}, {150, 14}} - YES 68288064 @@ -11824,7 +11468,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 268 {{17, 222}, {45, 14}} - YES 68288064 @@ -11851,14 +11494,12 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 256 {286, 176} - YES 256 {286, 17} - @@ -11866,7 +11507,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA -2147483392 {{224, 0}, {16, 17}} - YES @@ -11946,7 +11586,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA {{1, 17}, {286, 176}} - @@ -11957,7 +11596,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA -2147483392 {{224, 17}, {15, 102}} - _doScroller: 0.94863013698630139 @@ -11967,7 +11605,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA -2147483392 {{1, 294}, {338, 15}} - 1 _doScroller: @@ -11982,7 +11619,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA {{1, 0}, {286, 17}} - @@ -11992,7 +11628,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA {{20, 20}, {288, 194}} - 562 @@ -12004,8 +11639,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA {328, 434} - - NSView @@ -12030,7 +11663,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA {1.79769e+308, 1.79769e+308} {500, 272} - + 256 YES @@ -12049,14 +11682,12 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 256 {500, 287} - YES 256 {500, 17} - @@ -12064,7 +11695,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA -2147483392 {{224, 0}, {16, 17}} - YES @@ -12146,7 +11776,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA {{1, 17}, {500, 287}} - @@ -12157,7 +11786,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA -2147483392 {{224, 17}, {15, 102}} - _doScroller: 0.94773519163763065 @@ -12167,7 +11795,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA -2147483392 {{1, 249}, {568, 15}} - 1 _doScroller: @@ -12182,7 +11809,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA {{1, 0}, {500, 17}} - @@ -12192,7 +11818,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA {{-1, 57}, {502, 305}} - 562 @@ -12207,7 +11832,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 268 {{17, 370}, {120, 14}} - YES 68288064 @@ -12224,7 +11848,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 268 {{17, 392}, {63, 14}} - YES 68288064 @@ -12241,7 +11864,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 292 {{14, 12}, {114, 32}} - YES 67239424 @@ -12262,7 +11884,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 292 {{128, 12}, {114, 32}} - YES 67239424 @@ -12283,7 +11904,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 289 {{390, 12}, {96, 32}} - 1 YES @@ -12305,7 +11925,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 289 {{294, 12}, {96, 32}} - YES 67239424 @@ -12326,7 +11945,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 265 {{378, 370}, {42, 14}} - YES 68288064 @@ -12343,7 +11961,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 268 {{139, 370}, {237, 14}} - YES 68288064 @@ -12361,7 +11978,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 265 {{422, 370}, {61, 14}} - YES 68288064 @@ -12379,7 +11995,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 268 {{82, 392}, {401, 14}} - YES 68288064 @@ -12394,15 +12009,13 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA {500, 416} - - {{0, 0}, {1920, 1178}} {500, 294} {1.79769e+308, 1.79769e+308} - + 268 YES @@ -12411,7 +12024,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 268 {{233, 54}, {80, 28}} - YES 67239424 @@ -12432,7 +12044,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 268 {{20, 59}, {210, 19}} - YES 343014976 @@ -12494,7 +12105,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 268 {{17, 86}, {294, 14}} - YES 67239424 @@ -12511,7 +12121,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 268 {{17, 100}, {294, 14}} - YES 67239424 @@ -12525,12 +12134,10 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA {328, 134} - - NSView - + 268 YES @@ -12539,7 +12146,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 268 {{17, 86}, {294, 14}} - YES 67239424 @@ -12556,7 +12162,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 268 {{17, 100}, {294, 14}} - YES 67239424 @@ -12573,7 +12178,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 268 {{116, 47}, {96, 28}} - YES 67239424 @@ -12591,12 +12195,10 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA {328, 134} - - NSView - + 268 YES @@ -12605,7 +12207,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 268 {{17, 72}, {294, 28}} - YES 67239424 @@ -12622,7 +12223,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 268 {{17, 100}, {294, 14}} - YES 67239424 @@ -12639,7 +12239,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 268 {{163, 13}, {150, 28}} - 1 YES @@ -12661,7 +12260,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 268 {{163, 40}, {150, 28}} - YES 67239424 @@ -12682,7 +12280,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 268 {{15, 13}, {150, 28}} - 3 YES @@ -12704,7 +12301,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 268 {{15, 40}, {150, 28}} - 2 YES @@ -12723,12 +12319,10 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA {328, 134} - - NSView - + 301 YES @@ -12737,7 +12331,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 268 {{197, 191}, {109, 32}} - YES 67239424 @@ -12758,7 +12351,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 268 {{17, 20}, {286, 42}} - YES 67239424 @@ -12775,7 +12367,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 268 {{17, 262}, {128, 17}} - YES 68288064 @@ -12792,7 +12383,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 265 {{149, 257}, {27, 27}} - YES -2080244224 @@ -12817,7 +12407,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 268 {{79, 230}, {38, 17}} - YES 68288064 @@ -12838,7 +12427,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 268 {{67, 198}, {128, 22}} - YES -1804468671 @@ -12910,7 +12498,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 268 {{17, 201}, {45, 17}} - YES 68288064 @@ -12927,7 +12514,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 268 {{122, 228}, {73, 22}} - YES -1804468671 @@ -12945,7 +12531,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 268 {{17, 231}, {60, 17}} - YES 68288064 @@ -12972,7 +12557,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 268 {{18, 14}, {190, 78}} - YES 4 1 @@ -13191,12 +12775,10 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA {{1, 1}, {226, 102}} - {{46, 72}, {228, 118}} - {0, 0} 67239424 @@ -13217,12 +12799,10 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA {320, 290} - - NSView - + 301 YES @@ -13264,7 +12844,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA {{0, 125}, {278, 53}} - @@ -13336,7 +12915,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA {{1, 1}, {278, 223}} - @@ -13348,7 +12926,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA -2147483392 {{231, 1}, {15, 172}} - _doScroller: 0.68253968253968256 @@ -13358,7 +12935,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA -2147483392 {{-100, -100}, {87, 18}} - 1 _doScroller: @@ -13368,7 +12944,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA {{20, 20}, {280, 225}} - 530 @@ -13380,7 +12955,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 268 {{17, 253}, {138, 17}} - YES 68288064 @@ -13394,12 +12968,10 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA {320, 290} - - NSView - + 301 YES @@ -13420,7 +12992,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA {{101, 133}, {128, 128}} - YES 130560 @@ -13441,7 +13012,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 268 {{17, 35}, {286, 72}} - YES 67239424 @@ -13459,8 +13029,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA {320, 290} - - NSView @@ -14871,7 +14439,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 2 {{1651, 276}, {204, 521}} -461896704 - Video Output Settings + Display Video Settings NSPanel {1.79769e+308, 1.79769e+308} @@ -15494,7 +15062,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA {1.79769e+308, 1.79769e+308} - + 256 YES @@ -16395,6 +15963,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA {284, 560} + {{0, 0}, {1920, 1178}} {1.79769e+308, 1.79769e+308} @@ -17275,7 +16844,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 130560 33554432 - + 0 2 0 @@ -19189,129 +18758,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA {450, 35} NSView - - - 268 - - YES - - - 268 - {{176, 5}, {126, 26}} - - YES - - -2076049856 - 2048 - - - 109199615 - 1 - - - 400 - 75 - - - TIFF - - 2147483647 - 1 - - - _popUpItemAction: - - - YES - - OtherViews - - YES - - - - BMP - - 2147483647 - - - _popUpItemAction: - 1 - - - - - GIF - - 2147483647 - - - _popUpItemAction: - 2 - - - - - JPEG - - 2147483647 - - - _popUpItemAction: - 3 - - - - - PNG - - 2147483647 - - - _popUpItemAction: - 4 - - - - - JPEG 2000 - - 2147483647 - - - _popUpItemAction: - 5 - - - - - - 1 - YES - YES - 2 - - - - - 268 - {{38, 11}, {136, 17}} - - YES - - 68288064 - 71304192 - Select Image Format: - - - - - - - - {350, 35} - NSView - 7 2 @@ -20684,23 +20130,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA CocoaDSCore - - - YES - displayMode - displayModeString - videoFilterType - videoFilterTypeString - scale - rotation - useBilinearOutput - useVerticalSync - displayOrientation - displayOrder - - YES - - YES @@ -20737,18 +20166,16 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA render3DThreads render3DLineHack render3DMultisample + mainWindow + mainWindow.displayRotation + mainWindow.videoFilterType + mainWindow.useBilinearOutput + mainWindow.useVerticalSync + mainWindow.screenshotFileFormat EmuControllerDelegate - - - YES - isShowingStatusBar - - YES - - YES @@ -21066,14 +20493,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 860 - - - delegate - - - - 1070 - launchWebsite: @@ -21666,14 +21085,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 2612 - - - writeDefaultsDisplayRotation: - - - - 2624 - migrationWindow @@ -21889,14 +21300,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 3071 - - - copy: - - - - 3251 - cut: @@ -22113,38 +21516,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 3362 - - - mainWindow - - - - 3436 - - - - runToolbarCustomizationPalette: - - - - 3437 - - - - toggleToolbarShown: - - - - 3438 - - - - window - - - - 3439 - prefWindowController @@ -22425,22 +21796,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 3562 - - - cdsDisplayController - - - - 3580 - - - - emuWindowController - - - - 3599 - selectVideoFilterType: @@ -22449,158 +21804,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 3647 - - - changeVideoFilter: - - - - 3669 - - - - changeVideoFilter: - - - - 3670 - - - - changeVideoFilter: - - - - 3671 - - - - changeVideoFilter: - - - - 3672 - - - - changeVideoFilter: - - - - 3673 - - - - changeVideoFilter: - - - - 3674 - - - - changeVideoFilter: - - - - 3675 - - - - changeVideoFilter: - - - - 3676 - - - - changeVideoFilter: - - - - 3677 - - - - changeVideoFilter: - - - - 3678 - - - - changeVideoFilter: - - - - 3679 - - - - changeVideoFilter: - - - - 3680 - - - - changeVideoFilter: - - - - 3681 - - - - changeVideoFilter: - - - - 3682 - - - - changeVideoFilter: - - - - 3683 - - - - changeVideoFilter: - - - - 3684 - - - - changeVideoFilter: - - - - 3685 - - - - changeVideoFilter: - - - - 3686 - - - - changeBilinearOutput: - - - - 3697 - makeKeyAndOrderFront: @@ -22609,14 +21812,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 3792 - - - writeDefaultsVideoOutputSettings: - - - - 3796 - value: values.Render3D_HighPrecisionColorInterpolation @@ -22729,134 +21924,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 3902 - - - changeRotationRelative: - - - - 3910 - - - - changeRotationRelative: - - - - 3911 - - - - changeRotation: - - - - 3912 - - - - changeRotation: - - - - 3913 - - - - changeRotation: - - - - 3914 - - - - changeRotation: - - - - 3915 - - - - changeRotation: - - - - 3917 - - - - changeRotation: - - - - 3918 - - - - changeScale: - - - - 3919 - - - - changeScale: - - - - 3920 - - - - changeScale: - - - - 3921 - - - - changeScale: - - - - 3922 - - - - changeScale: - - - - 3923 - - - - changeDisplayMode: - - - - 3940 - - - - changeDisplayMode: - - - - 3941 - - - - changeDisplayMode: - - - - 3942 - boxARMBinaries @@ -23225,14 +22292,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 4280 - - - writeDefaultsHUDSettings: - - - - 4463 - firmwareConfigSheet @@ -23681,14 +22740,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 5143 - - - emuWindowController - - - - 5144 - cheatDatabaseController @@ -23713,14 +22764,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 5147 - - - emuWindowController - - - - 5148 - prefWindowController @@ -23785,22 +22828,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 5318 - - - changeRotationRelative: - - - - 5425 - - - - changeRotationRelative: - - - - 5426 - value: selection.nickname @@ -24113,14 +23140,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 5525 - - - displayView - - - - 5565 - value: arrangedObjects.addressString @@ -24153,102 +23172,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 5567 - - - value: selection.rotation - - - - - - value: selection.rotation - value - selection.rotation - - YES - - YES - NSAllowsEditingMultipleValuesSelection - NSConditionallySetsEnabled - NSRaisesForNotApplicableKeys - NSValidatesImmediately - - - YES - - - - - - - 2 - - - 5568 - - - - value: selection.rotation - - - - - - value: selection.rotation - value - selection.rotation - - YES - - YES - NSAllowsEditingMultipleValuesSelection - NSRaisesForNotApplicableKeys - NSValidatesImmediately - - - YES - - - - - - 2 - - - 5569 - - - - value: selection.useBilinearOutput - - - - - - value: selection.useBilinearOutput - value - selection.useBilinearOutput - 2 - - - 5570 - - - - selectedTag: selection.videoFilterType - - - - - - selectedTag: selection.videoFilterType - selectedTag - selection.videoFilterType - 2 - - - 5579 - value: selection.iconImage @@ -25228,38 +24151,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 5647 - - - toggleStatusBar: - - - - 5650 - - - - toggleKeepMinDisplaySizeAtNormal: - - - - 5704 - - - - saveScreenshotAs: - - - - 5705 - - - - saveScreenshotPanelAccessoryView - - - - 5706 - makeKeyAndOrderFront: @@ -26078,54 +24969,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 5932 - - - selectScreenshotFileFormat: - - - - 5951 - - - - selectScreenshotFileFormat: - - - - 5952 - - - - selectScreenshotFileFormat: - - - - 5953 - - - - selectScreenshotFileFormat: - - - - 5954 - - - - selectScreenshotFileFormat: - - - - 5955 - - - - selectScreenshotFileFormat: - - - - 5956 - value: selection.isSpeedLimitEnabled @@ -26239,86 +25082,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 5976 - - - hidden: selection.isShowingStatusBar - - - - - - hidden: selection.isShowingStatusBar - hidden - selection.isShowingStatusBar - - NSValueTransformerName - NSNegateBoolean - - 2 - - - 5981 - - - - hidden: selection.isShowingStatusBar - - - - - - hidden: selection.isShowingStatusBar - hidden - selection.isShowingStatusBar - - NSValueTransformerName - NSNegateBoolean - - 2 - - - 5983 - - - - hidden: selection.isShowingStatusBar - - - - - - hidden: selection.isShowingStatusBar - hidden - selection.isShowingStatusBar - - NSValueTransformerName - NSNegateBoolean - - 2 - - - 5985 - - - - hidden: selection.isShowingStatusBar - - - - - - hidden: selection.isShowingStatusBar - hidden - selection.isShowingStatusBar - - NSValueTransformerName - NSNegateBoolean - - 2 - - - 5987 - selectedTag: values.Sound_AudioOutputEngine @@ -27588,62 +26351,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 6164 - - - value: selection.useVerticalSync - - - - - - value: selection.useVerticalSync - value - selection.useVerticalSync - 2 - - - 6166 - - - - changeVerticalSync: - - - - 6167 - - - - changeDisplayOrientation: - - - - 6175 - - - - changeDisplayOrientation: - - - - 6176 - - - - changeDisplayOrder: - - - - 6178 - - - - changeDisplayOrder: - - - - 6179 - selectedTag: values.DisplayViewCombo_Orientation @@ -27708,14 +26415,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 6232 - - - changeVideoFilter: - - - - 6237 - selectVideoFilterType: @@ -28395,14 +27094,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 6663 - - - emuControlController - - - - 6664 - changeAudioEngine: @@ -28971,129 +27662,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 6750 - - - changeCoreSpeed: - - - - 6752 - - - - changeVolume: - - - - 6753 - - - - resetCore: - - - - 6754 - - - - executeCoreToggle: - - - - 6755 - - - - openRom: - - - - 6756 - - - - value: selection.currentVolumeIcon - - - - - - value: selection.currentVolumeIcon - value - selection.currentVolumeIcon - 2 - - - 6758 - - - - value: selection.currentVolumeValue - - - - - - value: selection.currentVolumeValue - value - selection.currentVolumeValue - 2 - - - 6760 - - - - value: selection.statusText - - - - - - value: selection.statusText - value - selection.statusText - - YES - - YES - NSAllowsEditingMultipleValuesSelection - NSRaisesForNotApplicableKeys - NSValidatesImmediately - - - YES - - - - - - 2 - - - 6762 - - - - animate: selection.isWorking - - - - - - animate: selection.isWorking - animate - selection.isWorking - - NSRaisesForNotApplicableKeys - - - 2 - - - 6763 - value: selection.currentVolumeValue @@ -29442,7 +28010,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA enabled: selection.currentRom - + enabled: selection.currentRom @@ -29485,7 +28053,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA - + 2 @@ -29496,7 +28064,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA enabled: selection.currentRom - + enabled: selection.currentRom @@ -29541,7 +28109,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA NSIsNotNil - + 2 @@ -29552,7 +28120,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA enabled: selection.currentRom - + enabled: selection.currentRom @@ -29595,7 +28163,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA - + 2 @@ -29646,7 +28214,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA enabled: selection.currentRom - + enabled: selection.currentRom @@ -29689,7 +28257,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA - + 2 @@ -29830,7 +28398,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA enabled: selection.currentRom - + enabled: selection.currentRom @@ -29875,7 +28443,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA NSIsNotNil - + 2 @@ -29922,7 +28490,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA enabled: selection.currentRom - + enabled: selection.currentRom @@ -29965,7 +28533,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA - + 2 @@ -30012,7 +28580,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA enabled: selection.currentRom - + enabled: selection.currentRom @@ -30032,7 +28600,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA enabled2: selection.isSearchStarted - + enabled2: selection.isSearchStarted @@ -30055,7 +28623,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA - + 2 @@ -30091,7 +28659,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA NSNegateBoolean - + 2 @@ -30102,7 +28670,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA enabled: selection.currentRom - + enabled: selection.currentRom @@ -30122,7 +28690,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA enabled2: selection.isSearchStarted - + enabled2: selection.isSearchStarted @@ -30145,7 +28713,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA - + 2 @@ -30181,7 +28749,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA NSNegateBoolean - + 2 @@ -30192,7 +28760,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA enabled: selection.currentRom - + enabled: selection.currentRom @@ -30212,7 +28780,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA enabled2: selection.isSearchStarted - + enabled2: selection.isSearchStarted @@ -30235,7 +28803,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA - + 2 @@ -30271,7 +28839,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA NSNegateBoolean - + 2 @@ -30282,7 +28850,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA enabled: selection.currentRom - + enabled: selection.currentRom @@ -30327,12 +28895,348 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA NSNegateBoolean - + 2 6930 + + + emuController + + + + 6939 + + + + newDisplayWindow: + + + + 6940 + + + + changeScale: + + + + 6941 + + + + changeScale: + + + + 6942 + + + + changeScale: + + + + 6943 + + + + changeScale: + + + + 6944 + + + + changeScale: + + + + 6945 + + + + toggleKeepMinDisplaySizeAtNormal: + + + + 6946 + + + + toggleStatusBar: + + + + 6947 + + + + runToolbarCustomizationPalette: + + + + 6948 + + + + toggleToolbarShown: + + + + 6949 + + + + changeDisplayMode: + + + + 6950 + + + + changeDisplayMode: + + + + 6951 + + + + changeDisplayMode: + + + + 6952 + + + + changeDisplayOrientation: + + + + 6953 + + + + changeDisplayOrientation: + + + + 6954 + + + + changeDisplayOrder: + + + + 6955 + + + + changeDisplayOrder: + + + + 6956 + + + + changeRotationRelative: + + + + 6957 + + + + changeRotationRelative: + + + + 6958 + + + + changeRotation: + + + + 6959 + + + + changeRotation: + + + + 6960 + + + + changeRotation: + + + + 6961 + + + + changeRotation: + + + + 6962 + + + + changeRotation: + + + + 6963 + + + + changeRotation: + + + + 6964 + + + + value: selection.mainWindow.displayRotation + + + + + + value: selection.mainWindow.displayRotation + value + selection.mainWindow.displayRotation + 2 + + + 6966 + + + + value: selection.mainWindow.displayRotation + + + + + + value: selection.mainWindow.displayRotation + value + selection.mainWindow.displayRotation + 2 + + + 6967 + + + + selectedTag: selection.mainWindow.videoFilterType + + + + + + selectedTag: selection.mainWindow.videoFilterType + selectedTag + selection.mainWindow.videoFilterType + 2 + + + 6989 + + + + value: selection.mainWindow.useBilinearOutput + + + + + + value: selection.mainWindow.useBilinearOutput + value + selection.mainWindow.useBilinearOutput + 2 + + + 6990 + + + + value: selection.mainWindow.useVerticalSync + + + + + + value: selection.mainWindow.useVerticalSync + value + selection.mainWindow.useVerticalSync + 2 + + + 6991 + + + + writeDefaultsDisplayRotation: + + + + 6992 + + + + writeDefaultsHUDSettings: + + + + 6993 + + + + writeDefaultsDisplayVideoSettings: + + + + 6994 + + + + copy: + + + + 6995 + + + + saveScreenshotAs: + + + + 6997 + + + + closeWindow: + + + + 7000 + @@ -30416,7 +29320,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA - @@ -30426,6 +29329,10 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA + + + + @@ -30581,11 +29488,8 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA YES - - - @@ -30595,6 +29499,9 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA + + + @@ -30608,29 +29515,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA - - 371 - - - YES - - - - - - - 372 - - - YES - - - - - - - - 494 @@ -30777,39 +29661,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA - - 650 - - - - - 651 - - - YES - - - - - - 652 - - - - - 661 - - - YES - - - - - - 662 - - - 714 @@ -30836,12 +29687,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA Cheat Search Drawer - - 766 - - - Emulation Window Delegate - 783 @@ -32866,12 +31711,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA - - 1709 - - - Main Display View - 1721 @@ -34080,12 +32919,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA ROM Info Panel Controller - - 2772 - - - Emulation Window Controller - 2789 @@ -34599,58 +33432,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA - - 3382 - - - CocoaDS Display Controller - - - 641 - - - YES - - - - - - - - - - - - - 1236 - - - - - 1234 - - - - - 1233 - - - - - 1232 - - - - - 647 - - - - - 646 - - - 3456 @@ -34886,16 +33667,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA - - 3526 - - - - - 3527 - - - 3644 @@ -35129,20 +33900,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA - - 653 - - - YES - - - - - - 654 - - - 3784 @@ -38967,93 +37724,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA - - 5690 - - - YES - - - - - Screenshot Save Panel Accessory - - - 5691 - - - YES - - - - - - 5692 - - - YES - - - - - - 5693 - - - YES - - - - - - 5694 - - - YES - - - - - - - - - - - 5695 - - - - - 5696 - - - - - 5697 - - - - - 5698 - - - - - 5699 - - - - - 5700 - - - - - 5701 - - - 5702 @@ -41404,6 +40074,21 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA Emulation Control Controller + + 6931 + + + + + 6998 + + + + + 6999 + + + @@ -41461,10 +40146,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 112.IBPluginDependency 112.ImportedFromIB2 1120.IBPluginDependency - 1232.IBPluginDependency - 1233.IBPluginDependency - 1234.IBPluginDependency - 1236.IBPluginDependency 124.IBPluginDependency 124.ImportedFromIB2 125.IBEditorWindowLastContentRect @@ -41732,9 +40413,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 1681.IBPluginDependency 1681.toolbarItem.selectable 1682.IBPluginDependency - 1709.CustomClassName - 1709.IBPluginDependency - 1709.IBViewBoundsToFrameTransform 1721.IBPluginDependency 1736.IBNumberFormatterBehaviorMetadataKey 1736.IBNumberFormatterLocalizesFormatMetadataKey @@ -41986,7 +40664,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 2609.IBPluginDependency 2610.IBPluginDependency 2653.IBPluginDependency - 2772.IBPluginDependency 2789.IBEditorWindowLastContentRect 2789.IBPluginDependency 2789.IBWindowTemplateEditedContentRect @@ -42096,7 +40773,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 3285.IBPluginDependency 3285.IBViewBoundsToFrameTransform 3286.IBPluginDependency - 3382.IBPluginDependency 3456.IBEditorWindowLastContentRect 3456.IBPluginDependency 3456.IBWindowTemplateEditedContentRect @@ -42141,8 +40817,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 3521.IBPluginDependency 3522.IBPluginDependency 3523.IBPluginDependency - 3526.IBPluginDependency - 3527.IBPluginDependency 3644.IBPluginDependency 3648.IBPluginDependency 3648.IBViewBoundsToFrameTransform @@ -42158,14 +40832,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 3692.IBViewBoundsToFrameTransform 3693.IBPluginDependency 3709.IBPluginDependency - 371.IBEditorWindowLastContentRect - 371.IBPluginDependency - 371.IBWindowTemplateEditedContentRect - 371.NSWindowTemplate.visibleAtLaunch - 371.editorWindowContentRectSynchronizationRect - 371.windowTemplate.hasMinSize - 371.windowTemplate.maxSize - 371.windowTemplate.minSize 3712.IBEditorWindowLastContentRect 3712.IBPluginDependency 3712.IBWindowTemplateEditedContentRect @@ -42183,7 +40849,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 3718.IBViewBoundsToFrameTransform 3719.IBAttributePlaceholdersKey 3719.IBPluginDependency - 372.IBPluginDependency 3720.IBAttributePlaceholdersKey 3720.IBPluginDependency 3721.IBPluginDependency @@ -42943,27 +41608,10 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 5687.IBPluginDependency 5688.IBPluginDependency 5689.IBPluginDependency - 5690.IBEditorWindowLastContentRect - 5690.IBPluginDependency - 5690.IBViewBoundsToFrameTransform - 5691.IBPluginDependency - 5691.IBViewBoundsToFrameTransform - 5692.IBPluginDependency - 5692.IBViewBoundsToFrameTransform - 5693.IBPluginDependency - 5694.IBEditorWindowLastContentRect - 5694.IBPluginDependency - 5695.IBPluginDependency - 5696.IBPluginDependency - 5697.IBPluginDependency - 5698.IBPluginDependency - 5699.IBPluginDependency 57.IBEditorWindowLastContentRect 57.IBPluginDependency 57.ImportedFromIB2 57.editorWindowContentRectSynchronizationRect - 5700.IBPluginDependency - 5701.IBPluginDependency 5702.IBPluginDependency 5703.IBPluginDependency 5713.IBPluginDependency @@ -43383,8 +42031,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 6408.IBViewBoundsToFrameTransform 6409.IBPluginDependency 6409.IBViewBoundsToFrameTransform - 641.IBEditorWindowLastContentRect - 641.IBPluginDependency 6410.IBPluginDependency 6410.IBViewBoundsToFrameTransform 6411.IBPluginDependency @@ -43421,8 +42067,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 6440.IBPluginDependency 6441.IBPluginDependency 6451.IBPluginDependency - 646.IBPluginDependency - 647.IBPluginDependency 6484.IBPluginDependency 6484.IBViewBoundsToFrameTransform 6485.IBPluginDependency @@ -43439,15 +42083,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 6497.IBPluginDependency 6498.IBPluginDependency 6499.IBPluginDependency - 650.IBPluginDependency - 650.IBViewBoundsToFrameTransform - 651.IBPluginDependency - 651.IBViewBoundsToFrameTransform - 652.IBPluginDependency - 653.IBPluginDependency - 653.IBViewBoundsToFrameTransform - 654.IBPluginDependency - 661.IBViewBoundsToFrameTransform 6611.IBPluginDependency 6611.IBViewBoundsToFrameTransform 6612.IBPluginDependency @@ -43474,6 +42109,9 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 6635.IBAttributePlaceholdersKey 6651.IBPluginDependency 6652.IBPluginDependency + 6931.IBPluginDependency + 6998.IBPluginDependency + 6999.IBPluginDependency 714.IBEditorWindowLastContentRect 714.IBPluginDependency 714.IBViewBoundsToFrameTransform @@ -43484,7 +42122,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 74.ImportedFromIB2 75.IBPluginDependency 75.ImportedFromIB2 - 766.IBPluginDependency 783.IBPluginDependency 784.IBEditorWindowLastContentRect 784.IBPluginDependency @@ -43776,12 +42413,8 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - {{855, 1093}, {143, 23}} + {{1009, 1073}, {143, 23}} com.apple.InterfaceBuilder.CocoaPlugin {{522, 812}, {146, 23}} @@ -44292,19 +42925,14 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - OpenGLDisplayView - com.apple.InterfaceBuilder.CocoaPlugin - - AQAAAABBwAAAA - com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - {{935, 883}, {213, 198}} + {{1389, 431}, {213, 198}} com.apple.InterfaceBuilder.CocoaPlugin - {{935, 883}, {213, 198}} + {{1389, 431}, {213, 198}} com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -44813,7 +43441,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin {{873, 105}, {700, 364}} com.apple.InterfaceBuilder.CocoaPlugin {{873, 105}, {700, 364}} @@ -44965,7 +43592,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA P4AAAL+AAABBcAAAwgAAAA com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin {{1241, 208}, {335, 163}} com.apple.InterfaceBuilder.CocoaPlugin {{1241, 208}, {335, 163}} @@ -45030,8 +43656,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin P4AAAL+AAABBkAAAw9UAAA @@ -45065,14 +43689,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - {{1177, 511}, {256, 408}} - com.apple.InterfaceBuilder.CocoaPlugin - {{1177, 511}, {256, 408}} - - {{33, 99}, {480, 360}} - - {3.40282e+38, 3.40282e+38} - {256, 408} {{1333, 146}, {288, 511}} com.apple.InterfaceBuilder.CocoaPlugin {{1333, 146}, {288, 511}} @@ -45112,7 +43728,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin ToolTip @@ -45558,7 +44173,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - {{1470, 1073}, {101, 63}} + {{1234, 1043}, {101, 63}} com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -46635,34 +45250,13 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - {{1162, 787}, {350, 35}} - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - P4AAAL+AAABCGAAAwgwAAA - - com.apple.InterfaceBuilder.CocoaPlugin - - P4AAAL+AAABDMAAAwiQAAA - - com.apple.InterfaceBuilder.CocoaPlugin - {{1327, 695}, {126, 123}} - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - {{853, 953}, {203, 183}} + {{657, 953}, {203, 183}} com.apple.InterfaceBuilder.CocoaPlugin {{23, 794}, {245, 183}} com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin InitialTabViewItem @@ -47291,11 +45885,11 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - {{1234, 1033}, {123, 43}} + {{1234, 1003}, {123, 43}} com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - {{1234, 1013}, {178, 43}} + {{1234, 983}, {178, 43}} com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -47563,8 +46157,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA AUMaAABC4AAAA - {{975, 901}, {616, 0}} - com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin P4AAAL+AAABDOgAAwwwAAA @@ -47610,8 +46202,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin P4AAAL+AAABBiAAAwugAAA @@ -47632,23 +46222,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - - P4AAAL+AAABAQAAAwjAAAA - - com.apple.InterfaceBuilder.CocoaPlugin - - P4AAAL+AAABC/AAAwZgAAA - - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - P4AAAL+AAABBiAAAwYgAAA - - com.apple.InterfaceBuilder.CocoaPlugin - - AULcAAA/gAAAA - - com.apple.InterfaceBuilder.CocoaPlugin P4AAAL+AAABDqwAAwpQAAA @@ -47726,6 +46299,9 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin {{1271, 124}, {328, 434}} com.apple.InterfaceBuilder.CocoaPlugin @@ -47737,19 +46313,18 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - {{1487, 933}, {136, 163}} + {{1234, 903}, {136, 163}} com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - {{1470, 1013}, {70, 103}} + {{1234, 983}, {70, 103}} com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - {{1103, 481}, {194, 241}} + {{1299, 599}, {194, 241}} com.apple.InterfaceBuilder.CocoaPlugin - {{1103, 481}, {194, 241}} + {{1299, 599}, {194, 241}} YES @@ -47759,14 +46334,14 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA com.apple.InterfaceBuilder.CocoaPlugin - {{1383, 498}, {204, 521}} + {{1413, 517}, {204, 521}} com.apple.InterfaceBuilder.CocoaPlugin - {{1383, 498}, {204, 521}} + {{1413, 517}, {204, 521}} com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - {{747, 833}, {262, 303}} + {{747, 783}, {262, 353}} com.apple.InterfaceBuilder.CocoaPlugin {{145, 474}, {199, 203}} @@ -48075,7 +46650,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA - 6930 + 7000 @@ -48165,12 +46740,10 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA cheatListWindow cheatWindowController emuControlController - emuWindowController fileMigrationList inputPrefsView mLoadStateSlot mSaveStateSlot - mainWindow migrationWindow prefGeneralView prefWindow @@ -48191,13 +46764,11 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA NSWindow NSObjectController NSObjectController - NSObjectController NSArrayController InputPrefsView NSMenu NSMenu NSWindow - NSWindow NSView NSWindow NSObjectController @@ -48220,12 +46791,10 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA cheatListWindow cheatWindowController emuControlController - emuWindowController fileMigrationList inputPrefsView mLoadStateSlot mSaveStateSlot - mainWindow migrationWindow prefGeneralView prefWindow @@ -48279,10 +46848,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA emuControlController NSObjectController - - emuWindowController - NSObjectController - fileMigrationList NSArrayController @@ -48299,10 +46864,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA mSaveStateSlot NSMenu - - mainWindow - NSWindow - migrationWindow NSWindow @@ -48619,8 +47180,14 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA changeAudioEngine: changeCoreEmuFlags: changeCoreSpeed: + changeDisplayMode: + changeDisplayOrder: + changeDisplayOrientation: changeFirmwareSettings: changeRomSaveType: + changeRotation: + changeRotationRelative: + changeScale: changeSpuAdvancedLogic: changeSpuInterpolationMode: changeSpuSyncMethod: @@ -48629,6 +47196,8 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA cheatsDisable: closeRom: closeSheet: + closeWindow: + copy: executeCoreToggle: exportRomSave: importRomSave: @@ -48638,15 +47207,23 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA openRom: resetCore: revertEmuSaveState: + runToolbarCustomizationPalette: saveEmuSaveState: saveEmuSaveStateAs: saveEmuSaveStateSlot: + saveScreenshotAs: selectExportRomSaveFormat: speedLimitDisable: toggleAutoFrameSkip: toggleGPUState: + toggleKeepMinDisplaySizeAtNormal: + toggleStatusBar: + toggleToolbarShown: writeDefaults3DRenderingSettings: + writeDefaultsDisplayRotation: + writeDefaultsDisplayVideoSettings: writeDefaultsEmulationSettings: + writeDefaultsHUDSettings: writeDefaultsSoundSettings: @@ -48683,6 +47260,22 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA id id id + id + id + id + id + id + id + id + id + id + id + id + id + id + id + id + id @@ -48692,8 +47285,14 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA changeAudioEngine: changeCoreEmuFlags: changeCoreSpeed: + changeDisplayMode: + changeDisplayOrder: + changeDisplayOrientation: changeFirmwareSettings: changeRomSaveType: + changeRotation: + changeRotationRelative: + changeScale: changeSpuAdvancedLogic: changeSpuInterpolationMode: changeSpuSyncMethod: @@ -48702,6 +47301,8 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA cheatsDisable: closeRom: closeSheet: + closeWindow: + copy: executeCoreToggle: exportRomSave: importRomSave: @@ -48711,15 +47312,23 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA openRom: resetCore: revertEmuSaveState: + runToolbarCustomizationPalette: saveEmuSaveState: saveEmuSaveStateAs: saveEmuSaveStateSlot: + saveScreenshotAs: selectExportRomSaveFormat: speedLimitDisable: toggleAutoFrameSkip: toggleGPUState: + toggleKeepMinDisplaySizeAtNormal: + toggleStatusBar: + toggleToolbarShown: writeDefaults3DRenderingSettings: + writeDefaultsDisplayRotation: + writeDefaultsDisplayVideoSettings: writeDefaultsEmulationSettings: + writeDefaultsHUDSettings: writeDefaultsSoundSettings: @@ -48736,6 +47345,18 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA changeCoreSpeed: id + + changeDisplayMode: + id + + + changeDisplayOrder: + id + + + changeDisplayOrientation: + id + changeFirmwareSettings: id @@ -48744,6 +47365,18 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA changeRomSaveType: id + + changeRotation: + id + + + changeRotationRelative: + id + + + changeScale: + id + changeSpuAdvancedLogic: id @@ -48776,6 +47409,14 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA closeSheet: id + + closeWindow: + id + + + copy: + id + executeCoreToggle: id @@ -48812,6 +47453,10 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA revertEmuSaveState: id + + runToolbarCustomizationPalette: + id + saveEmuSaveState: id @@ -48824,6 +47469,10 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA saveEmuSaveStateSlot: id + + saveScreenshotAs: + id + selectExportRomSaveFormat: id @@ -48840,14 +47489,38 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA toggleGPUState: id + + toggleKeepMinDisplaySizeAtNormal: + id + + + toggleStatusBar: + id + + + toggleToolbarShown: + id + writeDefaults3DRenderingSettings: id + + writeDefaultsDisplayRotation: + id + + + writeDefaultsDisplayVideoSettings: + id + writeDefaultsEmulationSettings: id + + writeDefaultsHUDSettings: + id + writeDefaultsSoundSettings: id @@ -48954,218 +47627,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA userinterface/EmuControllerDelegate.h - - EmuWindowDelegate - NSObject - - YES - - YES - changeBilinearOutput: - changeDisplayMode: - changeDisplayOrder: - changeDisplayOrientation: - changeRotation: - changeRotationRelative: - changeScale: - changeVerticalSync: - changeVideoFilter: - copy: - hudDisable: - saveScreenshotAs: - selectScreenshotFileFormat: - toggleKeepMinDisplaySizeAtNormal: - toggleStatusBar: - writeDefaultsDisplayRotation: - writeDefaultsHUDSettings: - writeDefaultsVideoOutputSettings: - - - YES - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - - - - YES - - YES - changeBilinearOutput: - changeDisplayMode: - changeDisplayOrder: - changeDisplayOrientation: - changeRotation: - changeRotationRelative: - changeScale: - changeVerticalSync: - changeVideoFilter: - copy: - hudDisable: - saveScreenshotAs: - selectScreenshotFileFormat: - toggleKeepMinDisplaySizeAtNormal: - toggleStatusBar: - writeDefaultsDisplayRotation: - writeDefaultsHUDSettings: - writeDefaultsVideoOutputSettings: - - - YES - - changeBilinearOutput: - id - - - changeDisplayMode: - id - - - changeDisplayOrder: - id - - - changeDisplayOrientation: - id - - - changeRotation: - id - - - changeRotationRelative: - id - - - changeScale: - id - - - changeVerticalSync: - id - - - changeVideoFilter: - id - - - copy: - id - - - hudDisable: - id - - - saveScreenshotAs: - id - - - selectScreenshotFileFormat: - id - - - toggleKeepMinDisplaySizeAtNormal: - id - - - toggleStatusBar: - id - - - writeDefaultsDisplayRotation: - id - - - writeDefaultsHUDSettings: - id - - - writeDefaultsVideoOutputSettings: - id - - - - - YES - - YES - cdsDisplayController - displayView - emuControlController - emuWindowController - saveScreenshotPanelAccessoryView - window - - - YES - NSObjectController - NSView - NSObjectController - NSObjectController - NSView - NSWindow - - - - YES - - YES - cdsDisplayController - displayView - emuControlController - emuWindowController - saveScreenshotPanelAccessoryView - window - - - YES - - cdsDisplayController - NSObjectController - - - displayView - NSView - - - emuControlController - NSObjectController - - - emuWindowController - NSObjectController - - - saveScreenshotPanelAccessoryView - NSView - - - window - NSWindow - - - - - IBProjectSource - userinterface/emuWindowDelegate.h - - InputPrefsView NSView @@ -49196,14 +47657,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA userinterface/inputPrefsView.h - - OpenGLDisplayView - NSOpenGLView - - IBProjectSource - userinterface/displayView.h - - PreferencesWindowDelegate NSObject @@ -49396,7 +47849,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA displayRotationField displayRotationMenu displayRotationMenuCustomItem - emuWindowController + emuController firmwareConfigSheet prefWindowController previewImageView @@ -49439,7 +47892,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA displayRotationField displayRotationMenu displayRotationMenuCustomItem - emuWindowController + emuController firmwareConfigSheet prefWindowController previewImageView @@ -49478,7 +47931,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA NSMenuItem - emuWindowController + emuController NSObjectController @@ -50185,14 +48638,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA AppKit.framework/Headers/NSObjectController.h - - NSOpenGLView - NSView - - IBFrameworkSource - AppKit.framework/Headers/NSOpenGLView.h - - NSPanel NSWindow @@ -50479,11 +48924,8 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA Icon_Execute_420x420 Icon_Input_420x420 Icon_Microphone_420x420 - Icon_OpenROM_420x420 Icon_Pause_420x420 Icon_Reset_420x420 - Icon_RotateCCW_420x420 - Icon_RotateCW_420x420 Icon_ShowHUD_420x420 Icon_Speaker_420x420 Icon_Speed2x_420x420 @@ -50541,9 +48983,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA {420, 420} {420, 420} {420, 420} - {420, 420} - {420, 420} - {420, 420} {20, 20} {15, 15} {8, 8} diff --git a/desmume/src/cocoa/userinterface/displayView.h b/desmume/src/cocoa/userinterface/DisplayWindowController.h similarity index 58% rename from desmume/src/cocoa/userinterface/displayView.h rename to desmume/src/cocoa/userinterface/DisplayWindowController.h index 934970ef6..c3235c576 100644 --- a/desmume/src/cocoa/userinterface/displayView.h +++ b/desmume/src/cocoa/userinterface/DisplayWindowController.h @@ -1,6 +1,5 @@ /* - Copyright (C) 2011 Roger Manuel - Copyright (C) 2011-2013 DeSmuME team + Copyright (C) 2013 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 @@ -14,7 +13,7 @@ You should have received a copy of the GNU General Public License along with the this software. If not, see . -*/ + */ #import #include @@ -22,104 +21,22 @@ #import "cocoa_output.h" -enum OGLVertexAttributeID -{ - OGLVertexAttributeID_Position = 0, - OGLVertexAttributeID_TexCoord0 = 8 -}; - -@class DisplayViewDelegate; @class CocoaDSController; +@class EmuControllerDelegate; -@protocol DisplayViewDelegate - -@required -- (void) doInitVideoOutput:(NSDictionary *)properties; -- (void) doProcessVideoFrame:(const void *)videoFrameData displayMode:(const NSInteger)displayModeID width:(const NSInteger)frameWidth height:(const NSInteger)frameHeight; - -@property (retain) DisplayViewDelegate *dispViewDelegate; - -@optional -- (void) doResizeView:(NSRect)rect; -- (void) doTransformView:(const DisplayOutputTransformData *)transformData; -- (void) doRedraw; -- (void) doDisplayModeChanged:(NSInteger)displayModeID; -- (void) doDisplayOrientationChanged:(NSInteger)displayOrientationID; -- (void) doDisplayOrderChanged:(NSInteger)displayOrderID; -- (void) doBilinearOutputChanged:(BOOL)useBilinear; -- (void) doVerticalSyncChanged:(BOOL)useVerticalSync; -- (void) doVideoFilterChanged:(NSInteger)videoFilterTypeID frameSize:(NSSize)videoFilterDestSize; - -@end - -@interface DisplayViewDelegate : NSObject +@interface DisplayView : NSView { - NSView *view; - NSPort *sendPortDisplay; - NSPort *sendPortInput; - CocoaDSController *cdsController; + // Display thread BOOL isHudEnabled; BOOL isHudEditingModeEnabled; - NSSize normalSize; - NSMutableDictionary *bindings; - - OSSpinLock spinlockNormalSize; - OSSpinLock spinlockScale; - OSSpinLock spinlockRotation; - OSSpinLock spinlockUseBilinearOutput; - OSSpinLock spinlockUseVerticalSync; - OSSpinLock spinlockDisplayType; - OSSpinLock spinlockDisplayOrientation; - OSSpinLock spinlockDisplayOrder; -} - -@property (retain) NSView *view; -@property (retain) NSPort *sendPortInput; -@property (retain) CocoaDSController *cdsController; -@property (readonly) NSSize normalSize; -@property (assign) double scale; -@property (assign) double rotation; -@property (assign) BOOL useBilinearOutput; -@property (assign) BOOL useVerticalSync; -@property (assign) NSInteger displayMode; -@property (assign) NSInteger displayOrientation; -@property (assign) NSInteger displayOrder; -@property (readonly) NSMutableDictionary *bindings; - -- (void) setVideoFilterType:(NSInteger)theType; -- (void) setViewToBlack; -- (void) setViewToWhite; -- (void) requestScreenshot:(NSURL *)fileURL fileType:(NSBitmapImageFileType)fileType; -- (void) copyToPasteboard; -- (NSPoint) dsPointFromEvent:(NSEvent *)theEvent; -- (NSPoint) convertPointToDS:(NSPoint)clickLoc; -- (BOOL) handleKeyPress:(NSEvent *)theEvent keyPressed:(BOOL)keyPressed; -- (BOOL) handleMouseButton:(NSEvent *)theEvent buttonPressed:(BOOL)buttonPressed; - -@end - -@interface ImageDisplayView : NSImageView -{ - DisplayViewDelegate *dispViewDelegate; - NSImage *imageData; - NSBitmapImageRep *currentImageRep; -} - -- (NSBitmapImageRep *) bitmapImageRep:(const void *)videoFrameData displayMode:(const NSInteger)displayModeID width:(const NSInteger)imageWidth height:(const NSInteger)imageHeight; - -@end - -@interface OpenGLDisplayView : NSOpenGLView -{ + // OpenGL context + NSOpenGLContext *context; CGLContextObj cglDisplayContext; - BOOL isShaderSupported; - - DisplayViewDelegate *dispViewDelegate; NSInteger lastDisplayMode; NSInteger currentDisplayOrientation; GLenum glTexPixelFormat; @@ -130,13 +47,11 @@ enum OGLVertexAttributeID GLuint vboVertexID; GLuint vboTexCoordID; GLuint vboElementID; - + GLuint vaoMainStatesID; GLuint vertexShaderID; GLuint fragmentShaderID; GLuint shaderProgram; - GLuint vaoMainStatesID; - GLint uniformAngleDegrees; GLint uniformScalar; GLint uniformViewSize; @@ -145,10 +60,13 @@ enum OGLVertexAttributeID GLfloat texCoordBuffer[2 * 8]; GLubyte vtxIndexBuffer[12]; + BOOL isShaderSupported; unsigned int vtxBufferOffset; } -- (void) setupOpenGL; +@property (retain) CocoaDSController *cdsController; + +- (void) startupOpenGL; - (void) shutdownOpenGL; - (void) setupShaderIO; - (BOOL) setupShadersWithVertexProgram:(const char *)vertShaderProgram fragmentProgram:(const char *)fragShaderProgram; @@ -160,4 +78,86 @@ enum OGLVertexAttributeID - (void) updateDisplayVerticesUsingDisplayMode:(const NSInteger)displayModeID orientation:(const NSInteger)displayOrientationID; - (void) updateTexCoordS:(GLfloat)s T:(GLfloat)t; +- (NSPoint) dsPointFromEvent:(NSEvent *)theEvent; +- (NSPoint) convertPointToDS:(NSPoint)clickLoc; +- (BOOL) handleKeyPress:(NSEvent *)theEvent keyPressed:(BOOL)keyPressed; +- (BOOL) handleMouseButton:(NSEvent *)theEvent buttonPressed:(BOOL)buttonPressed; +- (void) clearToBlack; +- (void) clearToWhite; +- (void) requestScreenshot:(NSURL *)fileURL fileType:(NSBitmapImageFileType)fileType; + +@end + +@interface DisplayWindowController : NSWindowController +{ + DisplayView *view; + NSView *saveScreenshotPanelAccessoryView; + + EmuControllerDelegate *emuControl; + CocoaDSDisplayVideo *cdsVideoOutput; + + NSSize _normalSize; + double _displayScale; + double _displayRotation; + BOOL _useBilinearOutput; + BOOL _useVerticalSync; + NSInteger _displayMode; + NSInteger _displayOrientation; + NSInteger _displayOrder; + NSInteger _videoFilterType; + NSInteger screenshotFileFormat; + + NSSize _minDisplayViewSize; + BOOL _isMinSizeNormal; + NSUInteger _statusBarHeight; + + OSSpinLock spinlockNormalSize; + OSSpinLock spinlockScale; + OSSpinLock spinlockRotation; + OSSpinLock spinlockUseBilinearOutput; + OSSpinLock spinlockUseVerticalSync; + OSSpinLock spinlockDisplayMode; + OSSpinLock spinlockDisplayOrientation; + OSSpinLock spinlockDisplayOrder; + OSSpinLock spinlockVideoFilterType; +} + +@property (readonly) IBOutlet DisplayView *view; +@property (readonly) IBOutlet NSView *saveScreenshotPanelAccessoryView; + +@property (retain) EmuControllerDelegate *emuControl; +@property (assign) CocoaDSDisplayVideo *cdsVideoOutput; + +@property (readonly) NSSize normalSize; +@property (assign) double displayScale; +@property (assign) double displayRotation; +@property (assign) BOOL useBilinearOutput; +@property (assign) BOOL useVerticalSync; +@property (assign) NSInteger displayMode; +@property (assign) NSInteger displayOrientation; +@property (assign) NSInteger displayOrder; +@property (assign) NSInteger videoFilterType; +@property (assign) NSInteger screenshotFileFormat; +@property (assign) BOOL isMinSizeNormal; +@property (assign) BOOL isShowingStatusBar; + +- (id)initWithWindowNibName:(NSString *)windowNibName emuControlDelegate:(EmuControllerDelegate *)theEmuController; + +- (void) setCdsController:(CocoaDSController *)theController; +- (void) setupUserDefaults; +- (double) resizeWithTransform:(NSSize)normalBounds scalar:(double)scalar rotation:(double)angleDegrees; +- (double) maxContentScalar:(NSSize)contentBounds; + +- (IBAction) copy:(id)sender; +- (IBAction) changeVolume:(id)sender; +- (IBAction) toggleKeepMinDisplaySizeAtNormal:(id)sender; +- (IBAction) toggleStatusBar:(id)sender; + +- (IBAction) executeCoreToggle:(id)sender; +- (IBAction) resetCore:(id)sender; +- (IBAction) changeCoreSpeed:(id)sender; +- (IBAction) openRom:(id)sender; +- (IBAction) changeRotationRelative:(id)sender; +- (IBAction) saveScreenshotAs:(id)sender; + @end diff --git a/desmume/src/cocoa/userinterface/displayView.mm b/desmume/src/cocoa/userinterface/DisplayWindowController.mm similarity index 55% rename from desmume/src/cocoa/userinterface/displayView.mm rename to desmume/src/cocoa/userinterface/DisplayWindowController.mm index c3c70b43c..3c72c7e42 100644 --- a/desmume/src/cocoa/userinterface/displayView.mm +++ b/desmume/src/cocoa/userinterface/DisplayWindowController.mm @@ -1,6 +1,5 @@ /* - Copyright (C) 2011 Roger Manuel - Copyright (C) 2011-2013 DeSmuME team + Copyright (C) 2013 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 @@ -14,11 +13,12 @@ You should have received a copy of the GNU General Public License along with the this software. If not, see . -*/ + */ -#import "displayView.h" +#import "DisplayWindowController.h" #import "EmuControllerDelegate.h" +#import "cocoa_file.h" #import "cocoa_input.h" #import "cocoa_globals.h" #import "cocoa_videofilter.h" @@ -28,10 +28,8 @@ #include #include -#undef BOOL - // VERTEX SHADER FOR DISPLAY OUTPUT -const char *vertexProgram_100 = {"\ +static const char *vertexProgram_100 = {"\ attribute vec2 inPosition; \n\ attribute vec2 inTexCoord0; \n\ \n\ @@ -60,7 +58,7 @@ const char *vertexProgram_100 = {"\ "}; // FRAGMENT SHADER FOR DISPLAY OUTPUT -const char *fragmentProgram_100 = {"\ +static const char *fragmentProgram_100 = {"\ varying vec2 vtxTexCoord; \n\ uniform sampler2D tex; \n\ \n\ @@ -70,134 +68,182 @@ const char *fragmentProgram_100 = {"\ } \n\ "}; +enum OGLVertexAttributeID +{ + OGLVertexAttributeID_Position = 0, + OGLVertexAttributeID_TexCoord0 = 8 +}; -@implementation DisplayViewDelegate +@implementation DisplayWindowController +@synthesize emuControl; +@synthesize cdsVideoOutput; @synthesize view; -@synthesize sendPortDisplay; -@synthesize sendPortInput; -@synthesize cdsController; -@synthesize isHudEnabled; -@synthesize isHudEditingModeEnabled; +@synthesize saveScreenshotPanelAccessoryView; + @dynamic normalSize; -@dynamic scale; -@dynamic rotation; +@dynamic displayScale; +@dynamic displayRotation; @dynamic useBilinearOutput; @dynamic useVerticalSync; @dynamic displayMode; @dynamic displayOrientation; @dynamic displayOrder; -@synthesize bindings; +@dynamic videoFilterType; +@synthesize screenshotFileFormat; +@dynamic isMinSizeNormal; +@dynamic isShowingStatusBar; -- (id)init + +- (id)initWithWindowNibName:(NSString *)windowNibName emuControlDelegate:(EmuControllerDelegate *)theEmuController { - self = [super init]; + self = [super initWithWindowNibName:windowNibName]; if (self == nil) { return self; } - bindings = [[NSMutableDictionary alloc] init]; - if (bindings == nil) - { - [self release]; - self = nil; - return self; - } + emuControl = [theEmuController retain]; + cdsVideoOutput = nil; - view = nil; spinlockNormalSize = OS_SPINLOCK_INIT; spinlockScale = OS_SPINLOCK_INIT; spinlockRotation = OS_SPINLOCK_INIT; spinlockUseBilinearOutput = OS_SPINLOCK_INIT; spinlockUseVerticalSync = OS_SPINLOCK_INIT; - spinlockDisplayType = OS_SPINLOCK_INIT; + spinlockDisplayMode = OS_SPINLOCK_INIT; spinlockDisplayOrientation = OS_SPINLOCK_INIT; spinlockDisplayOrder = OS_SPINLOCK_INIT; + spinlockVideoFilterType = OS_SPINLOCK_INIT; - normalSize = NSMakeSize(GPU_DISPLAY_WIDTH, GPU_DISPLAY_HEIGHT * 2.0); - sendPortDisplay = nil; - cdsController = nil; - isHudEnabled = NO; - isHudEditingModeEnabled = NO; + screenshotFileFormat = NSTIFFFileType; - [bindings setValue:[NSNumber numberWithDouble:1.0] forKey:@"scale"]; - [bindings setValue:[NSNumber numberWithDouble:0.0] forKey:@"rotation"]; - [bindings setValue:[NSNumber numberWithBool:YES] forKey:@"useBilinearOutput"]; - [bindings setValue:[NSNumber numberWithBool:NO] forKey:@"useVerticalSync"]; - [bindings setValue:[NSNumber numberWithInteger:DS_DISPLAY_TYPE_COMBO] forKey:@"displayMode"]; - [bindings setValue:@"Combo" forKey:@"displayModeString"]; - [bindings setValue:[NSNumber numberWithInteger:VideoFilterTypeID_None] forKey:@"videoFilterType"]; - [bindings setValue:[CocoaVideoFilter typeStringByID:VideoFilterTypeID_None] forKey:@"videoFilterTypeString"]; + _minDisplayViewSize = NSMakeSize(GPU_DISPLAY_WIDTH, GPU_DISPLAY_HEIGHT * 2); + _isMinSizeNormal = YES; + _statusBarHeight = WINDOW_STATUS_BAR_HEIGHT; - return self; + // These need to be initialized since these have dependencies on each other. + _displayMode = DS_DISPLAY_TYPE_COMBO; + _displayOrientation = DS_DISPLAY_ORIENTATION_VERTICAL; + + // Setup default values per user preferences. + [self setupUserDefaults]; + + [[self window] setTitle:(NSString *)[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleName"]]; + + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(saveScreenshotAsFinish:) + name:@"org.desmume.DeSmuME.requestScreenshotDidFinish" + object:nil]; + + return self; } - (void)dealloc { - self.view = nil; - self.cdsController = nil; - [bindings release]; + [[NSNotificationCenter defaultCenter] removeObserver:self]; + [self setEmuControl:nil]; [super dealloc]; } +#pragma mark Dynamic Property Methods + - (NSSize) normalSize { OSSpinLockLock(&spinlockNormalSize); - NSSize theSize = normalSize; + const NSSize theSize = _normalSize; OSSpinLockUnlock(&spinlockNormalSize); return theSize; } -- (void) setScale:(double)s +- (void) setDisplayScale:(double)s { + // Resize the window when displayScale changes. + // No need to set the view's scale here since window resizing will implicitly change it. + const double constrainedScale = [self resizeWithTransform:[self normalSize] scalar:s rotation:[self displayRotation]]; + OSSpinLockLock(&spinlockScale); - [bindings setValue:[NSNumber numberWithDouble:s] forKey:@"scale"]; + _displayScale = constrainedScale; OSSpinLockUnlock(&spinlockScale); - DisplayOutputTransformData transformData = { s, - [self rotation], + DisplayOutputTransformData transformData = { constrainedScale, + [self displayRotation], 0.0, 0.0, 0.0 }; - [CocoaDSUtil messageSendOneWayWithData:[self sendPortDisplay] + [CocoaDSUtil messageSendOneWayWithData:[[self cdsVideoOutput] receivePort] msgID:MESSAGE_TRANSFORM_VIEW data:[NSData dataWithBytes:&transformData length:sizeof(DisplayOutputTransformData)]]; } -- (double) scale +- (double) displayScale { OSSpinLockLock(&spinlockScale); - double s = [[bindings valueForKey:@"scale"] doubleValue]; + const double s = _displayScale; OSSpinLockUnlock(&spinlockScale); return s; } -- (void) setRotation:(double)angleDegrees +- (void) setDisplayRotation:(double)angleDegrees { + double newAngleDegrees = fmod(angleDegrees, 360.0); + if (newAngleDegrees < 0.0) + { + newAngleDegrees = 360.0 + newAngleDegrees; + } + + if (newAngleDegrees == 360.0) + { + newAngleDegrees = 0.0; + } + OSSpinLockLock(&spinlockRotation); - [bindings setValue:[NSNumber numberWithDouble:angleDegrees] forKey:@"rotation"]; + _displayRotation = newAngleDegrees; OSSpinLockUnlock(&spinlockRotation); - DisplayOutputTransformData transformData = { [self scale], + NSWindow *theWindow = [self window]; + + // Set the minimum content size for the window, since this will change based on rotation. + NSSize minContentSize = GetTransformedBounds(_minDisplayViewSize, 1.0, CLOCKWISE_DEGREES(newAngleDegrees)); + minContentSize.height += _statusBarHeight; + [theWindow setContentMinSize:minContentSize]; + + // Resize the window. + const NSSize oldBounds = [theWindow frame].size; + const double constrainedScale = [self resizeWithTransform:[self normalSize] scalar:[self displayScale] rotation:newAngleDegrees]; + const NSSize newBounds = [theWindow frame].size; + + OSSpinLockLock(&spinlockScale); + _displayScale = constrainedScale; + OSSpinLockUnlock(&spinlockScale); + + // If the window size didn't change, it is possible that the old and new rotation angles + // are 180 degrees offset from each other. In this case, we'll need to force the + // display view to update itself. + if (oldBounds.width == newBounds.width && oldBounds.height == newBounds.height) + { + [view setNeedsDisplay:YES]; + } + + DisplayOutputTransformData transformData = { constrainedScale, angleDegrees, 0.0, 0.0, 0.0 }; - [CocoaDSUtil messageSendOneWayWithData:[self sendPortDisplay] + [CocoaDSUtil messageSendOneWayWithData:[[self cdsVideoOutput] receivePort] msgID:MESSAGE_TRANSFORM_VIEW data:[NSData dataWithBytes:&transformData length:sizeof(DisplayOutputTransformData)]]; } -- (double) rotation +- (double) displayRotation { OSSpinLockLock(&spinlockRotation); - double angleDegrees = [[bindings valueForKey:@"rotation"] doubleValue]; + const double angleDegrees = _displayRotation; OSSpinLockUnlock(&spinlockRotation); return angleDegrees; @@ -206,16 +252,16 @@ const char *fragmentProgram_100 = {"\ - (void) setUseBilinearOutput:(BOOL)theState { OSSpinLockLock(&spinlockUseBilinearOutput); - [bindings setValue:[NSNumber numberWithBool:theState] forKey:@"useBilinearOutput"]; + _useBilinearOutput = theState; OSSpinLockUnlock(&spinlockUseBilinearOutput); - [CocoaDSUtil messageSendOneWayWithBool:self.sendPortDisplay msgID:MESSAGE_CHANGE_BILINEAR_OUTPUT boolValue:theState]; + [CocoaDSUtil messageSendOneWayWithBool:[[self cdsVideoOutput] receivePort] msgID:MESSAGE_CHANGE_BILINEAR_OUTPUT boolValue:theState]; } - (BOOL) useBilinearOutput { OSSpinLockLock(&spinlockUseBilinearOutput); - BOOL theState = [[bindings valueForKey:@"useBilinearOutput"] boolValue]; + const BOOL theState = _useBilinearOutput; OSSpinLockUnlock(&spinlockUseBilinearOutput); return theState; @@ -224,16 +270,16 @@ const char *fragmentProgram_100 = {"\ - (void) setUseVerticalSync:(BOOL)theState { OSSpinLockLock(&spinlockUseVerticalSync); - [bindings setValue:[NSNumber numberWithBool:theState] forKey:@"useVerticalSync"]; + _useVerticalSync = theState; OSSpinLockUnlock(&spinlockUseVerticalSync); - [CocoaDSUtil messageSendOneWayWithBool:self.sendPortDisplay msgID:MESSAGE_CHANGE_VERTICAL_SYNC boolValue:theState]; + [CocoaDSUtil messageSendOneWayWithBool:[[self cdsVideoOutput] receivePort] msgID:MESSAGE_CHANGE_VERTICAL_SYNC boolValue:theState]; } - (BOOL) useVerticalSync { OSSpinLockLock(&spinlockUseVerticalSync); - BOOL theState = [[bindings valueForKey:@"useVerticalSync"] boolValue]; + const BOOL theState = _useVerticalSync; OSSpinLockUnlock(&spinlockUseVerticalSync); return theState; @@ -272,32 +318,34 @@ const char *fragmentProgram_100 = {"\ break; } - OSSpinLockLock(&spinlockDisplayType); - NSInteger oldMode = [[bindings valueForKey:@"displayMode"] integerValue]; - [bindings setValue:[NSNumber numberWithInteger:displayModeID] forKey:@"displayMode"]; - [bindings setValue:modeString forKey:@"displayModeString"]; - OSSpinLockUnlock(&spinlockDisplayType); + OSSpinLockLock(&spinlockDisplayMode); + const NSInteger oldMode = _displayMode; + _displayMode = displayModeID; + OSSpinLockUnlock(&spinlockDisplayMode); OSSpinLockLock(&spinlockNormalSize); - normalSize = newDisplaySize; + _normalSize = newDisplaySize; OSSpinLockUnlock(&spinlockNormalSize); - [CocoaDSUtil messageSendOneWayWithInteger:self.sendPortDisplay msgID:MESSAGE_CHANGE_DISPLAY_TYPE integerValue:displayModeID]; + [self setIsMinSizeNormal:[self isMinSizeNormal]]; + [self resizeWithTransform:[self normalSize] scalar:[self displayScale] rotation:[self displayRotation]]; + + [CocoaDSUtil messageSendOneWayWithInteger:[[self cdsVideoOutput] receivePort] msgID:MESSAGE_CHANGE_DISPLAY_TYPE integerValue:displayModeID]; // If the display mode swaps between Main Only and Touch Only, the view will not resize to implicitly // redraw the view. So when swapping between these two display modes, explicitly tell the view to redraw. if ( (oldMode == DS_DISPLAY_TYPE_MAIN && displayModeID == DS_DISPLAY_TYPE_TOUCH) || - (oldMode == DS_DISPLAY_TYPE_TOUCH && displayModeID == DS_DISPLAY_TYPE_MAIN) ) + (oldMode == DS_DISPLAY_TYPE_TOUCH && displayModeID == DS_DISPLAY_TYPE_MAIN) ) { - [CocoaDSUtil messageSendOneWay:self.sendPortDisplay msgID:MESSAGE_REDRAW_VIEW]; + [CocoaDSUtil messageSendOneWay:[[self cdsVideoOutput] receivePort] msgID:MESSAGE_REDRAW_VIEW]; } } - (NSInteger) displayMode { - OSSpinLockLock(&spinlockDisplayType); - NSInteger displayModeID = [[bindings valueForKey:@"displayMode"] integerValue]; - OSSpinLockUnlock(&spinlockDisplayType); + OSSpinLockLock(&spinlockDisplayMode); + const NSInteger displayModeID = _displayMode; + OSSpinLockUnlock(&spinlockDisplayMode); return displayModeID; } @@ -305,7 +353,7 @@ const char *fragmentProgram_100 = {"\ - (void) setDisplayOrientation:(NSInteger)theOrientation { OSSpinLockLock(&spinlockDisplayOrientation); - [bindings setValue:[NSNumber numberWithInteger:theOrientation] forKey:@"displayOrientation"]; + _displayOrientation = theOrientation; OSSpinLockUnlock(&spinlockDisplayOrientation); if ([self displayMode] == DS_DISPLAY_TYPE_COMBO) @@ -322,17 +370,20 @@ const char *fragmentProgram_100 = {"\ } OSSpinLockLock(&spinlockNormalSize); - normalSize = newDisplaySize; + _normalSize = newDisplaySize; OSSpinLockUnlock(&spinlockNormalSize); + + [self setIsMinSizeNormal:[self isMinSizeNormal]]; + [self resizeWithTransform:[self normalSize] scalar:[self displayScale] rotation:[self displayRotation]]; } - [CocoaDSUtil messageSendOneWayWithInteger:self.sendPortDisplay msgID:MESSAGE_CHANGE_DISPLAY_ORIENTATION integerValue:theOrientation]; + [CocoaDSUtil messageSendOneWayWithInteger:[[self cdsVideoOutput] receivePort] msgID:MESSAGE_CHANGE_DISPLAY_ORIENTATION integerValue:theOrientation]; } - (NSInteger) displayOrientation { OSSpinLockLock(&spinlockDisplayOrientation); - NSInteger theOrientation = [[bindings valueForKey:@"displayOrientation"] integerValue]; + const NSInteger theOrientation = _displayOrientation; OSSpinLockUnlock(&spinlockDisplayOrientation); return theOrientation; @@ -341,532 +392,488 @@ const char *fragmentProgram_100 = {"\ - (void) setDisplayOrder:(NSInteger)theOrder { OSSpinLockLock(&spinlockDisplayOrder); - [bindings setValue:[NSNumber numberWithInteger:theOrder] forKey:@"displayOrder"]; + _displayOrder = theOrder; OSSpinLockUnlock(&spinlockDisplayOrder); - [CocoaDSUtil messageSendOneWayWithInteger:self.sendPortDisplay msgID:MESSAGE_CHANGE_DISPLAY_ORDER integerValue:theOrder]; + [CocoaDSUtil messageSendOneWayWithInteger:[[self cdsVideoOutput] receivePort] msgID:MESSAGE_CHANGE_DISPLAY_ORDER integerValue:theOrder]; } - (NSInteger) displayOrder { OSSpinLockLock(&spinlockDisplayOrder); - NSInteger theOrder = [[bindings valueForKey:@"displayOrder"] integerValue]; + const NSInteger theOrder = _displayOrder; OSSpinLockUnlock(&spinlockDisplayOrder); return theOrder; } -- (void) setVideoFilterType:(NSInteger)theType +- (void) setVideoFilterType:(NSInteger)typeID { - [bindings setValue:[NSNumber numberWithInteger:theType] forKey:@"videoFilterType"]; - [bindings setValue:[CocoaVideoFilter typeStringByID:(VideoFilterTypeID)theType] forKey:@"videoFilterTypeString"]; - [CocoaDSUtil messageSendOneWayWithInteger:self.sendPortDisplay msgID:MESSAGE_CHANGE_VIDEO_FILTER integerValue:theType]; -} - -- (void) setViewToBlack -{ - [CocoaDSUtil messageSendOneWay:self.sendPortDisplay msgID:MESSAGE_SET_VIEW_TO_BLACK]; -} - -- (void) setViewToWhite -{ - [CocoaDSUtil messageSendOneWay:self.sendPortDisplay msgID:MESSAGE_SET_VIEW_TO_WHITE]; -} - -- (NSPoint) dsPointFromEvent:(NSEvent *)theEvent -{ - // Convert the clicked location from window coordinates, to view coordinates, - // and finally to DS touchscreen coordinates. - NSPoint touchLoc = [theEvent locationInWindow]; - touchLoc = [view convertPoint:touchLoc fromView:nil]; - touchLoc = [self convertPointToDS:touchLoc]; + OSSpinLockLock(&spinlockVideoFilterType); + _videoFilterType = typeID; + OSSpinLockUnlock(&spinlockVideoFilterType); - return touchLoc; + [CocoaDSUtil messageSendOneWayWithInteger:[[self cdsVideoOutput] receivePort] msgID:MESSAGE_CHANGE_VIDEO_FILTER integerValue:typeID]; } -- (NSPoint) convertPointToDS:(NSPoint)clickLoc +- (NSInteger) videoFilterType { - double viewAngle = [self rotation]; - if (viewAngle != 0.0) - { - viewAngle = CLOCKWISE_DEGREES(viewAngle); - } + OSSpinLockLock(&spinlockVideoFilterType); + const NSInteger typeID = _videoFilterType; + OSSpinLockUnlock(&spinlockVideoFilterType); - NSPoint touchLoc = GetNormalPointFromTransformedPoint(clickLoc, [self normalSize], [[self view] bounds].size, [self scale], viewAngle); + return typeID; +} + +- (void) setIsMinSizeNormal:(BOOL)theState +{ + _isMinSizeNormal = theState; - // Normalize the touch location to the DS. if ([self displayMode] == DS_DISPLAY_TYPE_COMBO) { - NSInteger theOrientation = [self displayOrientation]; - NSInteger theOrder = [self displayOrder]; + if ([self displayOrientation] == DS_DISPLAY_ORIENTATION_HORIZONTAL) + { + _minDisplayViewSize.width = GPU_DISPLAY_WIDTH * 2; + _minDisplayViewSize.height = GPU_DISPLAY_HEIGHT; + } + else + { + _minDisplayViewSize.width = GPU_DISPLAY_WIDTH; + _minDisplayViewSize.height = GPU_DISPLAY_HEIGHT * 2; + } + } + else + { + _minDisplayViewSize.width = GPU_DISPLAY_WIDTH; + _minDisplayViewSize.height = GPU_DISPLAY_HEIGHT; + } + + if (!_isMinSizeNormal) + { + _minDisplayViewSize.width /= 4; + _minDisplayViewSize.height /= 4; + } + + // Set the minimum content size, keeping the display rotation in mind. + NSSize transformedMinSize = GetTransformedBounds(_minDisplayViewSize, 1.0, CLOCKWISE_DEGREES([self displayRotation])); + transformedMinSize.height += _statusBarHeight; + [[self window] setContentMinSize:transformedMinSize]; +} + +- (BOOL) isMinSizeNormal +{ + return _isMinSizeNormal; +} + +- (void) setIsShowingStatusBar:(BOOL)showStatusBar +{ + NSRect frameRect = [[self window] frame]; + + if (showStatusBar) + { + _statusBarHeight = WINDOW_STATUS_BAR_HEIGHT; + frameRect.size.height += WINDOW_STATUS_BAR_HEIGHT; - if (theOrientation == DS_DISPLAY_ORIENTATION_VERTICAL && theOrder == DS_DISPLAY_ORDER_TOUCH_FIRST) + NSRect screenFrame = [[NSScreen mainScreen] visibleFrame]; + if (frameRect.size.height > screenFrame.size.height) { - touchLoc.y -= GPU_DISPLAY_HEIGHT; + NSRect windowContentRect = [[[self window] contentView] bounds]; + double widthToHeightRatio = windowContentRect.size.width / windowContentRect.size.height; + windowContentRect.size.height -= frameRect.size.height - screenFrame.size.height; + windowContentRect.size.width = windowContentRect.size.height * widthToHeightRatio; + + frameRect.size.height = screenFrame.size.height; + frameRect.size.width = windowContentRect.size.width; } - else if (theOrientation == DS_DISPLAY_ORIENTATION_HORIZONTAL && theOrder == DS_DISPLAY_ORDER_MAIN_FIRST) + else { - touchLoc.x -= GPU_DISPLAY_WIDTH; + frameRect.origin.y -= WINDOW_STATUS_BAR_HEIGHT; + } + } + else + { + _statusBarHeight = 0; + frameRect.origin.y += WINDOW_STATUS_BAR_HEIGHT; + frameRect.size.height -= WINDOW_STATUS_BAR_HEIGHT; + } + + [[NSUserDefaults standardUserDefaults] setBool:showStatusBar forKey:@"DisplayView_ShowStatusBar"]; + [[self window] setFrame:frameRect display:YES animate:NO]; +} + +- (BOOL) isShowingStatusBar +{ + return !(_statusBarHeight == 0); +} + +#pragma mark Class Methods + +- (void) setCdsController:(CocoaDSController *)theController +{ + [view setCdsController:theController]; +} + +- (void) setupUserDefaults +{ + // Set the display window per user preferences. + [self setIsShowingStatusBar:[[NSUserDefaults standardUserDefaults] boolForKey:@"DisplayView_ShowStatusBar"]]; + + // Set the display settings per user preferences. + [self setDisplayMode:[[NSUserDefaults standardUserDefaults] integerForKey:@"DisplayView_Mode"]]; + [self setDisplayOrientation:[[NSUserDefaults standardUserDefaults] integerForKey:@"DisplayViewCombo_Orientation"]]; + [self setDisplayOrder:[[NSUserDefaults standardUserDefaults] integerForKey:@"DisplayViewCombo_Order"]]; + [self setDisplayScale:([[NSUserDefaults standardUserDefaults] doubleForKey:@"DisplayView_Size"] / 100.0)]; + [self setDisplayRotation:[[NSUserDefaults standardUserDefaults] doubleForKey:@"DisplayView_Rotation"]]; + [self setVideoFilterType:[[NSUserDefaults standardUserDefaults] integerForKey:@"DisplayView_VideoFilter"]]; + [self setUseBilinearOutput:[[NSUserDefaults standardUserDefaults] boolForKey:@"DisplayView_UseBilinearOutput"]]; + [self setUseVerticalSync:[[NSUserDefaults standardUserDefaults] boolForKey:@"DisplayView_UseVerticalSync"]]; +} + +- (double) resizeWithTransform:(NSSize)normalBounds scalar:(double)scalar rotation:(double)angleDegrees +{ + NSWindow *theWindow = [self window]; + + // Convert angle to clockwise-direction degrees. + angleDegrees = CLOCKWISE_DEGREES(angleDegrees); + + // Get the maximum scalar size within drawBounds. Constrain scalar to maxScalar if necessary. + const NSSize checkSize = GetTransformedBounds(normalBounds, 1.0, angleDegrees); + const double maxScalar = [self maxContentScalar:checkSize]; + if (scalar > maxScalar) + { + scalar = maxScalar; + } + + // Get the new bounds for the window's content view based on the transformed draw bounds. + const NSSize transformedBounds = GetTransformedBounds(normalBounds, scalar, angleDegrees); + + // Get the center of the content view in screen coordinates. + const NSRect windowContentRect = [[theWindow contentView] bounds]; + const double translationX = (windowContentRect.size.width - transformedBounds.width) / 2.0; + const double translationY = ((windowContentRect.size.height - _statusBarHeight) - transformedBounds.height) / 2.0; + + // Resize the window. + const NSRect windowFrame = [theWindow frame]; + const NSRect newFrame = [theWindow frameRectForContentRect:NSMakeRect(windowFrame.origin.x + translationX, windowFrame.origin.y + translationY, transformedBounds.width, transformedBounds.height + _statusBarHeight)]; + [theWindow setFrame:newFrame display:YES animate:NO]; + + // Return the actual scale used for the view (may be constrained). + return scalar; +} + +- (double) maxContentScalar:(NSSize)contentBounds +{ + // Determine the maximum scale based on the visible screen size (which + // doesn't include the menu bar or dock). + const NSRect screenFrame = [[NSScreen mainScreen] visibleFrame]; + const NSRect windowFrame = [[self window] frameRectForContentRect:NSMakeRect(0.0, 0.0, contentBounds.width, contentBounds.height + _statusBarHeight)]; + const NSSize visibleScreenBounds = { (screenFrame.size.width - (windowFrame.size.width - contentBounds.width)), (screenFrame.size.height - (windowFrame.size.height - contentBounds.height)) }; + + return GetMaxScalarInBounds(contentBounds.width, contentBounds.height, visibleScreenBounds.width, visibleScreenBounds.height); +} + +- (void) saveScreenshotAsFinish:(NSNotification *)aNotification +{ + NSURL *fileURL = (NSURL *)[[aNotification userInfo] valueForKey:@"fileURL"]; + NSBitmapImageFileType fileType = (NSBitmapImageFileType)[(NSNumber *)[[aNotification userInfo] valueForKey:@"fileType"] integerValue]; + NSImage *screenshotImage = (NSImage *)[[aNotification userInfo] valueForKey:@"screenshotImage"]; + + const BOOL fileSaved = [CocoaDSFile saveScreenshot:fileURL bitmapData:[[screenshotImage representations] objectAtIndex:0] fileType:fileType]; + if (!fileSaved) + { + [CocoaDSUtil quickDialogUsingTitle:NSSTRING_ERROR_TITLE_LEGACY message:NSSTRING_ERROR_SCREENSHOT_FAILED_LEGACY]; + } + + [emuControl restoreCoreState]; +} + +#pragma mark IBActions + +- (IBAction) copy:(id)sender +{ + [CocoaDSUtil messageSendOneWay:[[self cdsVideoOutput] receivePort] msgID:MESSAGE_COPY_TO_PASTEBOARD]; +} + +- (IBAction) changeVolume:(id)sender +{ + [emuControl changeVolume:sender]; +} + +- (IBAction) toggleKeepMinDisplaySizeAtNormal:(id)sender +{ + NSWindow *theWindow = [self window]; + + if ([self isMinSizeNormal]) + { + [self setIsMinSizeNormal:NO]; + } + else + { + [self setIsMinSizeNormal:YES]; + + // Set the minimum content size, keeping the display rotation in mind. + NSSize transformedMinSize = GetTransformedBounds(_minDisplayViewSize, 1.0, CLOCKWISE_DEGREES([self displayRotation])); + transformedMinSize.height += _statusBarHeight; + + // Resize the window if it's smaller than the minimum content size. + NSRect windowContentRect = [theWindow contentRectForFrameRect:[theWindow frame]]; + if (windowContentRect.size.width < transformedMinSize.width || windowContentRect.size.height < transformedMinSize.height) + { + // Prepare to resize. + NSRect oldFrameRect = [theWindow frame]; + windowContentRect.size = transformedMinSize; + NSRect newFrameRect = [theWindow frameRectForContentRect:windowContentRect]; + + // Keep the window centered when expanding the size. + newFrameRect.origin.x = oldFrameRect.origin.x - ((newFrameRect.size.width - oldFrameRect.size.width) / 2); + newFrameRect.origin.y = oldFrameRect.origin.y - ((newFrameRect.size.height - oldFrameRect.size.height) / 2); + + // Set the window size. + [theWindow setFrame:newFrameRect display:YES animate:NO]; + } + } +} + +- (IBAction) toggleStatusBar:(id)sender +{ + [self setIsShowingStatusBar:([self isShowingStatusBar]) ? NO : YES]; +} + +- (IBAction) executeCoreToggle:(id)sender +{ + [emuControl executeCoreToggle:sender]; +} + +- (IBAction) resetCore:(id)sender +{ + [emuControl resetCore:sender]; +} + +- (IBAction) changeCoreSpeed:(id)sender +{ + [emuControl changeCoreSpeed:sender]; +} + +- (IBAction) openRom:(id)sender +{ + [emuControl openRom:sender]; +} + +- (IBAction) changeRotationRelative:(id)sender +{ + const double angleDegrees = [self displayRotation] + (double)[CocoaDSUtil getIBActionSenderTag:sender]; + [self setDisplayRotation:angleDegrees]; +} + +- (IBAction) saveScreenshotAs:(id)sender +{ + [emuControl pauseCore]; + + NSSavePanel *panel = [NSSavePanel savePanel]; + [panel setCanCreateDirectories:YES]; + [panel setTitle:NSSTRING_TITLE_SAVE_SCREENSHOT_PANEL]; + [panel setAccessoryView:saveScreenshotPanelAccessoryView]; + + const NSInteger buttonClicked = [panel runModal]; + if(buttonClicked == NSOKButton) + { + [view requestScreenshot:[panel URL] fileType:(NSBitmapImageFileType)[self screenshotFileFormat]]; + } + else + { + [emuControl restoreCoreState]; + } +} + +#pragma mark NSWindowDelegate Protocol + +- (void)windowDidLoad +{ + cdsVideoOutput = [[CocoaDSDisplayVideo alloc] init]; + [cdsVideoOutput setDelegate:view]; + + [NSThread detachNewThreadSelector:@selector(runThread:) toTarget:cdsVideoOutput withObject:nil]; + while ([cdsVideoOutput thread] == nil) + { + [NSThread sleepUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.01]]; + } + + [emuControl addOutputToCore:cdsVideoOutput]; +} + +- (void)windowDidBecomeMain:(NSNotification *)notification +{ + [emuControl setMainWindow:self]; + [view setNextResponder:[self window]]; +} + +- (NSSize)windowWillResize:(NSWindow *)sender toSize:(NSSize)frameSize +{ + // Get a content Rect so that we can make our comparison. + // This will be based on the proposed frameSize. + const NSRect frameRect = NSMakeRect(0.0f, 0.0f, frameSize.width, frameSize.height); + const NSRect contentRect = [sender contentRectForFrameRect:frameRect]; + + // Find the maximum scalar we can use for the display view, bounded by the + // content Rect. + const NSSize checkSize = GetTransformedBounds([self normalSize], 1.0, [self displayRotation]); + const NSSize contentBounds = NSMakeSize(contentRect.size.width, contentRect.size.height - _statusBarHeight); + const double maxS = GetMaxScalarInBounds(checkSize.width, checkSize.height, contentBounds.width, contentBounds.height); + + // Make a new content Rect with our max scalar, and convert it back to a frame Rect. + const NSRect finalContentRect = NSMakeRect(0.0f, 0.0f, checkSize.width * maxS, (checkSize.height * maxS) + _statusBarHeight); + const NSRect finalFrameRect = [sender frameRectForContentRect:finalContentRect]; + + // Set the final size based on our new frame Rect. + return finalFrameRect.size; +} + +- (void)windowDidResize:(NSNotification *)notification +{ + // Get the max scalar within the window's current content bounds. + const NSSize checkSize = GetTransformedBounds([self normalSize], 1.0, [self displayRotation]); + NSSize contentBounds = [[[self window] contentView] bounds].size; + contentBounds.height -= _statusBarHeight; + const double maxS = GetMaxScalarInBounds(checkSize.width, checkSize.height, contentBounds.width, contentBounds.height); + + // Set the display view's properties. + [self setDisplayScale:maxS]; + + // Resize the view. + NSRect newContentFrame = [[[self window] contentView] bounds]; + newContentFrame.origin.y = _statusBarHeight; + newContentFrame.size.height -= _statusBarHeight; + [view setFrame:newContentFrame]; +} + +- (BOOL)windowShouldClose:(id)sender +{ + BOOL shouldClose = YES; + + if ([[emuControl windowList] count] > 1) // If this isn't the last window, then just close it without doing anything else. + { + return shouldClose; + } + else if ([emuControl currentRom] != nil) // If a ROM is loaded, just close the ROM, but don't close the window. + { + [emuControl closeRom:nil]; + shouldClose = NO; + } + else // If no ROM is loaded, close the window and terminate the application. + { + [NSApp terminate:sender]; + } + + return shouldClose; +} + +- (void)windowWillClose:(NSNotification *)notification +{ + [emuControl removeOutputFromCore:[self cdsVideoOutput]]; + [[self cdsVideoOutput] forceThreadExit]; + [[self cdsVideoOutput] release]; + [self setCdsVideoOutput:nil]; + + [[emuControl windowList] removeObject:self]; + [emuControl updateAllWindowTitles]; +} + +- (BOOL)validateToolbarItem:(NSToolbarItem *)theItem +{ + BOOL enable = YES; + const SEL theAction = [theItem action]; + + if (theAction == @selector(executeCoreToggle:)) + { + if (![emuControl masterExecuteFlag] || + [emuControl currentRom] == nil || + [emuControl isUserInterfaceBlockingExecution]) + { + enable = NO; + } + + if ([emuControl executionState] == CORESTATE_PAUSE) + { + [theItem setLabel:NSSTRING_TITLE_EXECUTE_CONTROL]; + [theItem setImage:[emuControl iconExecute]]; + } + else + { + [theItem setLabel:NSSTRING_TITLE_PAUSE_CONTROL]; + [theItem setImage:[emuControl iconPause]]; + } + } + else if (theAction == @selector(resetCore:)) + { + if ([emuControl currentRom] == nil || [emuControl isUserInterfaceBlockingExecution]) + { + enable = NO; + } + } + else if (theAction == @selector(changeCoreSpeed:)) + { + NSInteger speedScalar = (NSInteger)([emuControl speedScalar] * 100.0); + + if (speedScalar == (NSInteger)(SPEED_SCALAR_DOUBLE * 100.0)) + { + [theItem setLabel:NSSTRING_TITLE_SPEED_1X]; + [theItem setTag:100]; + [theItem setImage:[emuControl iconSpeedNormal]]; + } + else + { + [theItem setLabel:NSSTRING_TITLE_SPEED_2X]; + [theItem setTag:200]; + [theItem setImage:[emuControl iconSpeedDouble]]; + } + } + else if (theAction == @selector(openRom:)) + { + if ([emuControl isRomLoading] || [emuControl isShowingSaveStateDialog]) + { + enable = NO; } } - touchLoc.y = GPU_DISPLAY_HEIGHT - touchLoc.y; - - // Constrain the touch point to the DS dimensions. - if (touchLoc.x < 0) - { - touchLoc.x = 0; - } - else if (touchLoc.x > (GPU_DISPLAY_WIDTH - 1)) - { - touchLoc.x = (GPU_DISPLAY_WIDTH - 1); - } - - if (touchLoc.y < 0) - { - touchLoc.y = 0; - } - else if (touchLoc.y > (GPU_DISPLAY_HEIGHT - 1)) - { - touchLoc.y = (GPU_DISPLAY_HEIGHT - 1); - } - - return touchLoc; -} - -- (void) requestScreenshot:(NSURL *)fileURL fileType:(NSBitmapImageFileType)fileType -{ - NSString *fileURLString = [fileURL absoluteString]; - NSData *fileURLStringData = [fileURLString dataUsingEncoding:NSUTF8StringEncoding]; - NSData *bitmapImageFileTypeData = [[NSData alloc] initWithBytes:&fileType length:sizeof(NSBitmapImageFileType)]; - NSArray *messageComponents = [[NSArray alloc] initWithObjects:fileURLStringData, bitmapImageFileTypeData, nil]; - - [CocoaDSUtil messageSendOneWayWithMessageComponents:self.sendPortDisplay msgID:MESSAGE_REQUEST_SCREENSHOT array:messageComponents]; - - [bitmapImageFileTypeData release]; - [messageComponents release]; -} - -- (void) copyToPasteboard -{ - [CocoaDSUtil messageSendOneWay:self.sendPortDisplay msgID:MESSAGE_COPY_TO_PASTEBOARD]; -} - -- (BOOL) handleKeyPress:(NSEvent *)theEvent keyPressed:(BOOL)keyPressed -{ - BOOL isHandled = NO; - - if (self.cdsController == nil) - { - return isHandled; - } - - NSString *elementName = [NSString stringWithFormat:@"%d", [theEvent keyCode]]; - NSString *elementCode = elementName; - NSDictionary *inputAttributes = [NSDictionary dictionaryWithObjectsAndKeys: - @"NSEventKeyboard", @"deviceCode", - @"Keyboard", @"deviceName", - elementCode, @"elementCode", - elementName, @"elementName", - [NSNumber numberWithBool:keyPressed], @"on", - nil]; - - if (keyPressed && [theEvent window] != nil && [[[theEvent window] delegate] respondsToSelector:@selector(setStatusText:)]) - { - [(EmuControllerDelegate *)[[theEvent window] delegate] setStatusText:[NSString stringWithFormat:@"Keyboard:%i", [theEvent keyCode]]]; - } - - isHandled = [self.cdsController setStateWithInput:inputAttributes]; - - return isHandled; -} - -- (BOOL) handleMouseButton:(NSEvent *)theEvent buttonPressed:(BOOL)buttonPressed -{ - BOOL isHandled = NO; - NSInteger displayModeID = [self displayMode]; - - if (self.cdsController == nil || (displayModeID != DS_DISPLAY_TYPE_TOUCH && displayModeID != DS_DISPLAY_TYPE_COMBO)) - { - return isHandled; - } - - // Convert the clicked location from window coordinates, to view coordinates, - // and finally to DS touchscreen coordinates. - NSPoint touchLoc = [self dsPointFromEvent:theEvent]; - - NSString *elementCode = [NSString stringWithFormat:@"%li", (long)[theEvent buttonNumber]]; - NSString *elementName = [NSString stringWithFormat:@"Button %li", (long)[theEvent buttonNumber]]; - - switch ([theEvent buttonNumber]) - { - case kCGMouseButtonLeft: - elementName = @"Primary Button"; - break; - - case kCGMouseButtonRight: - elementName = @"Secondary Button"; - break; - - case kCGMouseButtonCenter: - elementName = @"Center Button"; - break; - - default: - break; - } - - NSDictionary *inputAttributes = [NSDictionary dictionaryWithObjectsAndKeys: - @"NSEventMouse", @"deviceCode", - @"Mouse", @"deviceName", - elementCode, @"elementCode", - elementName, @"elementName", - [NSNumber numberWithBool:buttonPressed], @"on", - [NSNumber numberWithFloat:touchLoc.x], @"pointX", - [NSNumber numberWithFloat:touchLoc.y], @"pointY", - nil]; - - if (buttonPressed && [theEvent window] != nil && [[[theEvent window] delegate] respondsToSelector:@selector(setStatusText:)]) - { - [(EmuControllerDelegate *)[[theEvent window] delegate] setStatusText:[NSString stringWithFormat:@"Mouse:%li X:%li Y:%li", (long)[theEvent buttonNumber], (long)(touchLoc.x), (long)(touchLoc.y)]]; - } - - isHandled = [self.cdsController setStateWithInput:inputAttributes]; - - return isHandled; -} - -- (void) doInitVideoOutput:(NSDictionary *)properties -{ - [view doInitVideoOutput:properties]; -} - -- (void) doProcessVideoFrame:(const void *)videoFrameData displayMode:(const NSInteger)displayModeID width:(const NSInteger)frameWidth height:(const NSInteger)frameHeight -{ - [view doProcessVideoFrame:videoFrameData displayMode:displayModeID width:frameWidth height:frameHeight]; -} - -- (void) doResizeView:(NSRect)rect -{ - if (view == nil || ![view respondsToSelector:@selector(doResizeView:)]) - { - return; - } - - [view doResizeView:rect]; -} - -- (void) doTransformView:(const DisplayOutputTransformData *)transformData -{ - if (view == nil || ![view respondsToSelector:@selector(doTransformView:)]) - { - return; - } - - [view doTransformView:transformData]; -} - -- (void) doRedraw -{ - if (view == nil || ![view respondsToSelector:@selector(doRedraw)]) - { - return; - } - - [view doRedraw]; -} - -- (void) doDisplayModeChanged:(NSInteger)displayModeID -{ - if (view == nil || ![view respondsToSelector:@selector(doDisplayModeChanged:)]) - { - return; - } - - [view doDisplayModeChanged:displayModeID]; -} - -- (void) doDisplayOrientationChanged:(NSInteger)displayOrientationID -{ - if (view == nil || ![view respondsToSelector:@selector(doDisplayOrientationChanged:)]) - { - return; - } - - [view doDisplayOrientationChanged:displayOrientationID]; -} - -- (void) doDisplayOrderChanged:(NSInteger)displayOrderID -{ - if (view == nil || ![view respondsToSelector:@selector(doDisplayOrderChanged:)]) - { - return; - } - - [view doDisplayOrderChanged:displayOrderID]; -} - -- (void) doBilinearOutputChanged:(BOOL)useBilinear -{ - if (view == nil || ![view respondsToSelector:@selector(doBilinearOutputChanged:)]) - { - return; - } - - [view doBilinearOutputChanged:useBilinear]; -} - -- (void) doVerticalSyncChanged:(BOOL)useVerticalSync -{ - if (view == nil || ![view respondsToSelector:@selector(doVerticalSyncChanged:)]) - { - return; - } - - [view doVerticalSyncChanged:useVerticalSync]; -} - -- (void) doVideoFilterChanged:(NSInteger)videoFilterTypeID frameSize:(NSSize)videoFilterDestSize -{ - if (view == nil || ![view respondsToSelector:@selector(doVideoFilterChanged:frameSize:)]) - { - return; - } - - [view doVideoFilterChanged:videoFilterTypeID frameSize:videoFilterDestSize]; + return enable; } @end +#pragma mark - +@implementation DisplayView -@implementation ImageDisplayView +@synthesize cdsController; +@synthesize isHudEnabled; +@synthesize isHudEditingModeEnabled; -@synthesize dispViewDelegate; - -- (id) init +- (id)initWithFrame:(NSRect)frameRect { - return [self initWithFrame:NSMakeRect(0.0f, 0.0f, GPU_DISPLAY_WIDTH, GPU_DISPLAY_HEIGHT * 2.0f)]; -} - -- (id) initWithFrame:(NSRect)frame -{ - self = [super initWithFrame:frame]; + self = [super initWithFrame:frameRect]; if (self == nil) { return self; } - imageData = nil; - currentImageRep = nil; + // Initialize the OpenGL context + NSOpenGLPixelFormatAttribute attributes[] = { + NSOpenGLPFAColorSize, (NSOpenGLPixelFormatAttribute)24, + NSOpenGLPFAAlphaSize, (NSOpenGLPixelFormatAttribute)8, + NSOpenGLPFADepthSize, (NSOpenGLPixelFormatAttribute)0, + NSOpenGLPFAStencilSize, (NSOpenGLPixelFormatAttribute)0, + NSOpenGLPFADoubleBuffer, + (NSOpenGLPixelFormatAttribute)0 }; - return self; -} - -- (void) dealloc -{ - [super dealloc]; -} - -- (void)drawRect:(NSRect)dirtyRect -{ - [CocoaDSUtil messageSendOneWay:dispViewDelegate.sendPortDisplay msgID:MESSAGE_REDRAW_VIEW]; -} - -- (void) drawVideoFrame -{ - [self setImage:imageData]; - [self setNeedsDisplay]; -} - -- (void)setFrame:(NSRect)rect -{ - [super setFrame:rect]; - [CocoaDSUtil messageSendOneWayWithRect:dispViewDelegate.sendPortDisplay msgID:MESSAGE_RESIZE_VIEW rect:rect]; -} - -- (NSBitmapImageRep *) bitmapImageRep:(const void *)videoFrameData displayMode:(const NSInteger)displayModeID width:(const NSInteger)imageWidth height:(const NSInteger)imageHeight -{ - if (videoFrameData == nil) - { - return nil; - } + NSOpenGLPixelFormat *format = [[NSOpenGLPixelFormat alloc] initWithAttributes:attributes]; + context = [[NSOpenGLContext alloc] initWithFormat:format shareContext:nil]; + [format release]; + cglDisplayContext = (CGLContextObj)[context CGLContextObj]; - NSBitmapImageRep *imageRep = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL - pixelsWide:imageWidth - pixelsHigh:imageHeight - bitsPerSample:8 - samplesPerPixel:4 - hasAlpha:YES - isPlanar:NO - colorSpaceName:NSCalibratedRGBColorSpace - bytesPerRow:imageWidth * 4 - bitsPerPixel:32]; + CGLContextObj prevContext = CGLGetCurrentContext(); + CGLSetCurrentContext(cglDisplayContext); + [self startupOpenGL]; + CGLSetCurrentContext(prevContext); - if(!imageRep) - { - return nil; - } - - uint32_t *bitmapData = (uint32_t *)[imageRep bitmapData]; - RGB555ToRGBA8888Buffer((const uint16_t *)videoFrameData, bitmapData, (imageWidth * imageHeight)); - -#ifdef __BIG_ENDIAN__ - uint32_t *bitmapDataEnd = bitmapData + (imageWidth * imageHeight); - while (bitmapData < bitmapDataEnd) - { - *bitmapData++ = CFSwapInt32LittleToHost(*bitmapData); - } -#endif - - return [imageRep autorelease]; -} - -- (void)keyDown:(NSEvent *)theEvent -{ - BOOL isHandled = [dispViewDelegate handleKeyPress:theEvent keyPressed:YES]; - if (!isHandled) - { - [super keyDown:theEvent]; - } -} - -- (void)keyUp:(NSEvent *)theEvent -{ - BOOL isHandled = [dispViewDelegate handleKeyPress:theEvent keyPressed:NO]; - if (!isHandled) - { - [super keyUp:theEvent]; - } -} - -- (void)mouseDown:(NSEvent *)theEvent -{ - BOOL isHandled = [dispViewDelegate handleMouseButton:theEvent buttonPressed:YES]; - if (!isHandled) - { - [super mouseDown:theEvent]; - } -} - -- (void)mouseDragged:(NSEvent *)theEvent -{ - [self mouseDown:theEvent]; -} - -- (void)mouseUp:(NSEvent *)theEvent -{ - BOOL isHandled = [dispViewDelegate handleMouseButton:theEvent buttonPressed:NO]; - if (!isHandled) - { - [super mouseUp:theEvent]; - } -} - -- (void)rightMouseDown:(NSEvent *)theEvent -{ - BOOL isHandled = [dispViewDelegate handleMouseButton:theEvent buttonPressed:YES]; - if (!isHandled) - { - [super rightMouseDown:theEvent]; - } -} - -- (void)rightMouseDragged:(NSEvent *)theEvent -{ - [self rightMouseDown:theEvent]; -} - -- (void)rightMouseUp:(NSEvent *)theEvent -{ - BOOL isHandled = [dispViewDelegate handleMouseButton:theEvent buttonPressed:NO]; - if (!isHandled) - { - [super rightMouseUp:theEvent]; - } -} - -- (void)otherMouseDown:(NSEvent *)theEvent -{ - BOOL isHandled = [dispViewDelegate handleMouseButton:theEvent buttonPressed:YES]; - if (!isHandled) - { - [super otherMouseDown:theEvent]; - } -} - -- (void)otherMouseDragged:(NSEvent *)theEvent -{ - [self otherMouseDown:theEvent]; -} - -- (void)otherMouseUp:(NSEvent *)theEvent -{ - BOOL isHandled = [dispViewDelegate handleMouseButton:theEvent buttonPressed:NO]; - if (!isHandled) - { - [super otherMouseUp:theEvent]; - } -} - -- (BOOL)acceptsFirstResponder -{ - return YES; -} - -- (BOOL)becomeFirstResponder -{ - return YES; -} - -- (BOOL)resignFirstResponder -{ - return YES; -} - -- (void)doInitVideoOutput:(NSDictionary *)properties -{ - imageData = [[NSImage alloc] initWithSize:[dispViewDelegate normalSize]]; - currentImageRep = nil; -} - -- (void)doProcessVideoFrame:(const void *)videoFrameData displayMode:(const NSInteger)displayModeID width:(const NSInteger)frameWidth height:(const NSInteger)frameHeight -{ - // Render the frame in an NSBitmapImageRep - NSBitmapImageRep *newImageRep = [self bitmapImageRep:videoFrameData displayMode:displayModeID width:frameWidth height:frameHeight]; - if (newImageRep == nil) - { - return; - } - - // Attach the rendered frame to the NSImageRep - [imageData removeRepresentation:currentImageRep]; - [imageData addRepresentation:newImageRep]; - currentImageRep = newImageRep; - - // Draw the video frame. - [self drawVideoFrame]; -} - -- (void)doRedraw -{ - [self drawVideoFrame]; -} - -@end - -@implementation OpenGLDisplayView - -@synthesize dispViewDelegate; - -- (id)initWithCoder:(NSCoder *)aDecoder -{ - self = [super initWithCoder:aDecoder]; - if (self == nil) - { - return self; - } - - dispViewDelegate = nil; lastDisplayMode = DS_DISPLAY_TYPE_COMBO; currentDisplayOrientation = DS_DISPLAY_ORIENTATION_VERTICAL; glTexPixelFormat = GL_UNSIGNED_SHORT_1_5_5_5_REV; @@ -875,48 +882,33 @@ const char *fragmentProgram_100 = {"\ UInt32 h = GetNearestPositivePOT((UInt32)(GPU_DISPLAY_HEIGHT * 2.0)); glTexBack = (GLvoid *)calloc(w * h, sizeof(UInt16)); glTexBackSize = NSMakeSize(w, h); - cglDisplayContext = (CGLContextObj)[[self openGLContext] CGLContextObj]; - vtxBufferOffset = 0; - return self; + cdsController = nil; + + return self; } - (void)dealloc { CGLContextObj prevContext = CGLGetCurrentContext(); CGLSetCurrentContext(cglDisplayContext); - [self shutdownOpenGL]; - CGLSetCurrentContext(prevContext); free(glTexBack); glTexBack = NULL; - self.dispViewDelegate = nil; + [self setCdsController:nil]; + [context clearDrawable]; + [context release]; [super dealloc]; } -- (void)drawRect:(NSRect)dirtyRect -{ - [CocoaDSUtil messageSendOneWay:dispViewDelegate.sendPortDisplay msgID:MESSAGE_REDRAW_VIEW]; -} +#pragma mark Class Methods -- (void)setFrame:(NSRect)rect -{ - NSRect oldFrame = [self frame]; - [super setFrame:rect]; - - if (rect.size.width != oldFrame.size.width || rect.size.height != oldFrame.size.height) - { - [CocoaDSUtil messageSendOneWayWithRect:dispViewDelegate.sendPortDisplay msgID:MESSAGE_RESIZE_VIEW rect:rect]; - [self setNeedsDisplay:YES]; - } -} - -- (void)prepareOpenGL +- (void) startupOpenGL { [self updateDisplayVerticesUsingDisplayMode:lastDisplayMode orientation:currentDisplayOrientation]; [self updateTexCoordS:1.0f T:2.0f]; @@ -928,11 +920,6 @@ const char *fragmentProgram_100 = {"\ vtxIndexBuffer[6] = 4; vtxIndexBuffer[7] = 5; vtxIndexBuffer[8] = 6; vtxIndexBuffer[9] = 6; vtxIndexBuffer[10] = 7; vtxIndexBuffer[11] = 4; - [self setupOpenGL]; -} - -- (void) setupOpenGL -{ // Check the OpenGL capabilities for this renderer const GLubyte *glExtString = glGetString(GL_EXTENSIONS); @@ -1259,9 +1246,223 @@ const char *fragmentProgram_100 = {"\ texCoordBuffer[14] = 0.0f; texCoordBuffer[15] = t; } +- (NSPoint) dsPointFromEvent:(NSEvent *)theEvent +{ + // Convert the clicked location from window coordinates, to view coordinates, + // and finally to DS touchscreen coordinates. + NSPoint touchLoc = [theEvent locationInWindow]; + touchLoc = [self convertPoint:touchLoc fromView:nil]; + touchLoc = [self convertPointToDS:touchLoc]; + + return touchLoc; +} + +- (NSPoint) convertPointToDS:(NSPoint)clickLoc +{ + DisplayWindowController *windowController = (DisplayWindowController *)[[self window] delegate]; + + double viewAngle = [windowController displayRotation]; + if (viewAngle != 0.0) + { + viewAngle = CLOCKWISE_DEGREES(viewAngle); + } + + NSPoint touchLoc = GetNormalPointFromTransformedPoint(clickLoc, [windowController normalSize], [self bounds].size, [windowController displayScale], viewAngle); + + // Normalize the touch location to the DS. + if ([windowController displayMode] == DS_DISPLAY_TYPE_COMBO) + { + const NSInteger theOrientation = [windowController displayOrientation]; + const NSInteger theOrder = [windowController displayOrder]; + + if (theOrientation == DS_DISPLAY_ORIENTATION_VERTICAL && theOrder == DS_DISPLAY_ORDER_TOUCH_FIRST) + { + touchLoc.y -= GPU_DISPLAY_HEIGHT; + } + else if (theOrientation == DS_DISPLAY_ORIENTATION_HORIZONTAL && theOrder == DS_DISPLAY_ORDER_MAIN_FIRST) + { + touchLoc.x -= GPU_DISPLAY_WIDTH; + } + } + + touchLoc.y = GPU_DISPLAY_HEIGHT - touchLoc.y; + + // Constrain the touch point to the DS dimensions. + if (touchLoc.x < 0) + { + touchLoc.x = 0; + } + else if (touchLoc.x > (GPU_DISPLAY_WIDTH - 1)) + { + touchLoc.x = (GPU_DISPLAY_WIDTH - 1); + } + + if (touchLoc.y < 0) + { + touchLoc.y = 0; + } + else if (touchLoc.y > (GPU_DISPLAY_HEIGHT - 1)) + { + touchLoc.y = (GPU_DISPLAY_HEIGHT - 1); + } + + return touchLoc; +} + +- (BOOL) handleKeyPress:(NSEvent *)theEvent keyPressed:(BOOL)keyPressed +{ + BOOL isHandled = NO; + DisplayWindowController *windowController = (DisplayWindowController *)[[self window] delegate]; + + if (self.cdsController == nil) + { + return isHandled; + } + + NSString *elementName = [NSString stringWithFormat:@"%d", [theEvent keyCode]]; + NSString *elementCode = elementName; + NSDictionary *inputAttributes = [NSDictionary dictionaryWithObjectsAndKeys: + @"NSEventKeyboard", @"deviceCode", + @"Keyboard", @"deviceName", + elementCode, @"elementCode", + elementName, @"elementName", + [NSNumber numberWithBool:keyPressed], @"on", + nil]; + + if (keyPressed && [theEvent window] != nil) + { + [[windowController emuControl] setStatusText:[NSString stringWithFormat:@"Keyboard:%i", [theEvent keyCode]]]; + } + + isHandled = [self.cdsController setStateWithInput:inputAttributes]; + + return isHandled; +} + +- (BOOL) handleMouseButton:(NSEvent *)theEvent buttonPressed:(BOOL)buttonPressed +{ + BOOL isHandled = NO; + DisplayWindowController *windowController = (DisplayWindowController *)[[self window] delegate]; + const NSInteger displayModeID = [windowController displayMode]; + + if (self.cdsController == nil || (displayModeID != DS_DISPLAY_TYPE_TOUCH && displayModeID != DS_DISPLAY_TYPE_COMBO)) + { + return isHandled; + } + + // Convert the clicked location from window coordinates, to view coordinates, + // and finally to DS touchscreen coordinates. + NSPoint touchLoc = [self dsPointFromEvent:theEvent]; + + NSString *elementCode = [NSString stringWithFormat:@"%li", (long)[theEvent buttonNumber]]; + NSString *elementName = [NSString stringWithFormat:@"Button %li", (long)[theEvent buttonNumber]]; + + switch ([theEvent buttonNumber]) + { + case kCGMouseButtonLeft: + elementName = @"Primary Button"; + break; + + case kCGMouseButtonRight: + elementName = @"Secondary Button"; + break; + + case kCGMouseButtonCenter: + elementName = @"Center Button"; + break; + + default: + break; + } + + NSDictionary *inputAttributes = [NSDictionary dictionaryWithObjectsAndKeys: + @"NSEventMouse", @"deviceCode", + @"Mouse", @"deviceName", + elementCode, @"elementCode", + elementName, @"elementName", + [NSNumber numberWithBool:buttonPressed], @"on", + [NSNumber numberWithFloat:touchLoc.x], @"pointX", + [NSNumber numberWithFloat:touchLoc.y], @"pointY", + nil]; + + if (buttonPressed && [theEvent window] != nil) + { + [[windowController emuControl] setStatusText:[NSString stringWithFormat:@"Mouse:%li X:%li Y:%li", (long)[theEvent buttonNumber], (long)(touchLoc.x), (long)(touchLoc.y)]]; + } + + isHandled = [self.cdsController setStateWithInput:inputAttributes]; + + return isHandled; +} + +- (void) clearToBlack +{ + DisplayWindowController *windowController = (DisplayWindowController *)[[self window] delegate]; + [CocoaDSUtil messageSendOneWay:[[windowController cdsVideoOutput] receivePort] msgID:MESSAGE_SET_VIEW_TO_BLACK]; +} + +- (void) clearToWhite +{ + DisplayWindowController *windowController = (DisplayWindowController *)[[self window] delegate]; + [CocoaDSUtil messageSendOneWay:[[windowController cdsVideoOutput] receivePort] msgID:MESSAGE_SET_VIEW_TO_WHITE]; +} + +- (void) requestScreenshot:(NSURL *)fileURL fileType:(NSBitmapImageFileType)fileType +{ + NSString *fileURLString = [fileURL absoluteString]; + NSData *fileURLStringData = [fileURLString dataUsingEncoding:NSUTF8StringEncoding]; + NSData *bitmapImageFileTypeData = [[NSData alloc] initWithBytes:&fileType length:sizeof(NSBitmapImageFileType)]; + NSArray *messageComponents = [[NSArray alloc] initWithObjects:fileURLStringData, bitmapImageFileTypeData, nil]; + + DisplayWindowController *windowController = (DisplayWindowController *)[[self window] delegate]; + [CocoaDSUtil messageSendOneWayWithMessageComponents:[[windowController cdsVideoOutput] receivePort] msgID:MESSAGE_REQUEST_SCREENSHOT array:messageComponents]; + + [bitmapImageFileTypeData release]; + [messageComponents release]; +} + +#pragma mark NSView Methods + +- (BOOL)isOpaque +{ + return YES; +} + +- (void)lockFocus +{ + [super lockFocus]; + + if ([context view] != self) + { + [context setView:self]; + } +} + +- (void)drawRect:(NSRect)dirtyRect +{ + DisplayWindowController *windowController = (DisplayWindowController *)[[self window] delegate]; + [CocoaDSUtil messageSendOneWay:[[windowController cdsVideoOutput] receivePort] msgID:MESSAGE_REDRAW_VIEW]; +} + +- (void)setFrame:(NSRect)rect +{ + NSRect oldFrame = [self frame]; + [super setFrame:rect]; + + if (rect.size.width != oldFrame.size.width || rect.size.height != oldFrame.size.height) + { + [context update]; + DisplayWindowController *windowController = (DisplayWindowController *)[[self window] delegate]; + [CocoaDSUtil messageSendOneWayWithRect:[[windowController cdsVideoOutput] receivePort] msgID:MESSAGE_RESIZE_VIEW rect:rect]; + [self setNeedsDisplay:YES]; + } +} + +#pragma mark NSResponder Methods + - (void)keyDown:(NSEvent *)theEvent { - BOOL isHandled = [dispViewDelegate handleKeyPress:theEvent keyPressed:YES]; + BOOL isHandled = [self handleKeyPress:theEvent keyPressed:YES]; if (!isHandled) { [super keyDown:theEvent]; @@ -1270,7 +1471,7 @@ const char *fragmentProgram_100 = {"\ - (void)keyUp:(NSEvent *)theEvent { - BOOL isHandled = [dispViewDelegate handleKeyPress:theEvent keyPressed:NO]; + BOOL isHandled = [self handleKeyPress:theEvent keyPressed:NO]; if (!isHandled) { [super keyUp:theEvent]; @@ -1279,7 +1480,7 @@ const char *fragmentProgram_100 = {"\ - (void)mouseDown:(NSEvent *)theEvent { - BOOL isHandled = [dispViewDelegate handleMouseButton:theEvent buttonPressed:YES]; + BOOL isHandled = [self handleMouseButton:theEvent buttonPressed:YES]; if (!isHandled) { [super mouseDown:theEvent]; @@ -1293,7 +1494,7 @@ const char *fragmentProgram_100 = {"\ - (void)mouseUp:(NSEvent *)theEvent { - BOOL isHandled = [dispViewDelegate handleMouseButton:theEvent buttonPressed:NO]; + BOOL isHandled = [self handleMouseButton:theEvent buttonPressed:NO]; if (!isHandled) { [super mouseUp:theEvent]; @@ -1302,7 +1503,7 @@ const char *fragmentProgram_100 = {"\ - (void)rightMouseDown:(NSEvent *)theEvent { - BOOL isHandled = [dispViewDelegate handleMouseButton:theEvent buttonPressed:YES]; + BOOL isHandled = [self handleMouseButton:theEvent buttonPressed:YES]; if (!isHandled) { [super rightMouseDown:theEvent]; @@ -1316,7 +1517,7 @@ const char *fragmentProgram_100 = {"\ - (void)rightMouseUp:(NSEvent *)theEvent { - BOOL isHandled = [dispViewDelegate handleMouseButton:theEvent buttonPressed:NO]; + BOOL isHandled = [self handleMouseButton:theEvent buttonPressed:NO]; if (!isHandled) { [super rightMouseUp:theEvent]; @@ -1325,7 +1526,7 @@ const char *fragmentProgram_100 = {"\ - (void)otherMouseDown:(NSEvent *)theEvent { - BOOL isHandled = [dispViewDelegate handleMouseButton:theEvent buttonPressed:YES]; + BOOL isHandled = [self handleMouseButton:theEvent buttonPressed:YES]; if (!isHandled) { [super otherMouseDown:theEvent]; @@ -1339,7 +1540,7 @@ const char *fragmentProgram_100 = {"\ - (void)otherMouseUp:(NSEvent *)theEvent { - BOOL isHandled = [dispViewDelegate handleMouseButton:theEvent buttonPressed:NO]; + BOOL isHandled = [self handleMouseButton:theEvent buttonPressed:NO]; if (!isHandled) { [super otherMouseUp:theEvent]; @@ -1361,6 +1562,8 @@ const char *fragmentProgram_100 = {"\ return YES; } +#pragma mark CocoaDSDisplayVideoDelegate Protocol + - (void)doInitVideoOutput:(NSDictionary *)properties { // No init needed, so do nothing. @@ -1517,7 +1720,7 @@ const char *fragmentProgram_100 = {"\ glTexPixelFormat = GL_UNSIGNED_SHORT_1_5_5_5_REV; } - if ([dispViewDelegate displayMode] != DS_DISPLAY_TYPE_COMBO) + if ([(DisplayWindowController *)[[self window] delegate] displayMode] != DS_DISPLAY_TYPE_COMBO) { videoFilterDestSize.height = (uint32_t)videoFilterDestSize.height * 2; } @@ -1557,3 +1760,4 @@ const char *fragmentProgram_100 = {"\ } @end + diff --git a/desmume/src/cocoa/userinterface/EmuControllerDelegate.h b/desmume/src/cocoa/userinterface/EmuControllerDelegate.h index e4a3a24a8..62ae5646b 100644 --- a/desmume/src/cocoa/userinterface/EmuControllerDelegate.h +++ b/desmume/src/cocoa/userinterface/EmuControllerDelegate.h @@ -16,12 +16,15 @@ */ #import +#include @class CocoaDSRom; @class CocoaDSFirmware; +@class CocoaDSOutput; @class CocoaDSSpeaker; @class CocoaDSCheatManager; @class CheatWindowDelegate; +@class DisplayWindowController; @interface EmuControllerDelegate : NSObject @@ -68,7 +71,11 @@ NSImage *iconSpeedNormal; NSImage *iconSpeedDouble; + DisplayWindowController *mainWindow; NSMutableArray *windowList; + + OSSpinLock spinlockFirmware; + OSSpinLock spinlockSpeaker; } @property (assign) CocoaDSRom *currentRom; // Don't rely on autorelease since the emulator doesn't support concurrent unloading @@ -89,6 +96,15 @@ @property (readonly) IBOutlet NSWindow *saveStatePrecloseSheet; @property (readonly) IBOutlet NSView *exportRomSavePanelAccessoryView; +@property (readonly) NSImage *iconExecute; +@property (readonly) NSImage *iconPause; +@property (readonly) NSImage *iconSpeedNormal; +@property (readonly) NSImage *iconSpeedDouble; + +@property (readonly) BOOL masterExecuteFlag; +@property (readonly) NSInteger executionState; +@property (readonly) CGFloat speedScalar; + @property (assign) BOOL isWorking; @property (assign) BOOL isRomLoading; @property (assign) NSString *statusText; @@ -110,10 +126,13 @@ @property (assign) BOOL render3DLineHack; @property (assign) BOOL render3DMultisample; +@property (retain) DisplayWindowController *mainWindow; @property (readonly) NSMutableArray *windowList; // File Menu +- (IBAction) newDisplayWindow:(id)sender; - (IBAction) openRom:(id)sender; +- (IBAction) closeWindow:(id)sender; - (IBAction) closeRom:(id)sender; - (IBAction) openEmuSaveState:(id)sender; - (IBAction) saveEmuSaveState:(id)sender; @@ -125,6 +144,9 @@ - (IBAction) exportRomSave:(id)sender; - (IBAction) selectExportRomSaveFormat:(id)sender; +// Edit Menu +- (IBAction) copy:(id)sender; + // Emulation Menu - (IBAction) speedLimitDisable:(id)sender; - (IBAction) toggleAutoFrameSkip:(id)sender; @@ -133,21 +155,21 @@ - (IBAction) resetCore:(id)sender; - (IBAction) changeRomSaveType:(id)sender; +// View Menu +- (IBAction) changeScale:(id)sender; +- (IBAction) changeRotation:(id)sender; +- (IBAction) changeRotationRelative:(id)sender; +- (IBAction) changeDisplayMode:(id)sender; +- (IBAction) changeDisplayOrientation:(id)sender; +- (IBAction) changeDisplayOrder:(id)sender; +- (IBAction) toggleKeepMinDisplaySizeAtNormal:(id)sender; +- (IBAction) toggleStatusBar:(id)sender; +- (IBAction) toggleToolbarShown:(id)sender; +- (IBAction) runToolbarCustomizationPalette:(id)sender; + // Tools Menu - (IBAction) toggleGPUState:(id)sender; - -// Window Menu -- (IBAction) newDisplayWindow:(id)sender; - -- (BOOL) handleLoadRom:(NSURL *)fileURL; -- (BOOL) handleUnloadRom:(NSInteger)reasonID romToLoad:(NSURL *)romURL; -- (BOOL) loadRom:(NSURL *)romURL; -- (void) loadRomDidFinish:(NSNotification *)aNotification; -- (BOOL) unloadRom; - -- (void) executeCore; -- (void) pauseCore; -- (void) restoreCoreState; +- (IBAction) saveScreenshotAs:(id)sender; - (IBAction) changeCoreSpeed:(id)sender; - (IBAction) changeCoreEmuFlags:(id)sender; @@ -159,15 +181,35 @@ - (IBAction) changeSpuSyncMode:(id)sender; - (IBAction) changeSpuSyncMethod:(id)sender; +// Misc IBActions +- (IBAction) writeDefaultsDisplayRotation:(id)sender; +- (IBAction) writeDefaultsHUDSettings:(id)sender; +- (IBAction) writeDefaultsDisplayVideoSettings:(id)sender; +- (IBAction) writeDefaults3DRenderingSettings:(id)sender; +- (IBAction) writeDefaultsEmulationSettings:(id)sender; +- (IBAction) writeDefaultsSoundSettings:(id)sender; + - (IBAction) closeSheet:(id)sender; + +- (BOOL) handleLoadRom:(NSURL *)fileURL; +- (BOOL) handleUnloadRom:(NSInteger)reasonID romToLoad:(NSURL *)romURL; +- (BOOL) loadRom:(NSURL *)romURL; +- (void) loadRomDidFinish:(NSNotification *)aNotification; +- (BOOL) unloadRom; + +- (void) addOutputToCore:(CocoaDSOutput *)theOutput; +- (void) removeOutputFromCore:(CocoaDSOutput *)theOutput; +- (void) executeCore; +- (void) pauseCore; +- (void) restoreCoreState; + - (void) didEndFileMigrationSheet:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo; - (void) didEndSaveStateSheet:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo; - (void) didEndSaveStateSheetOpen:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo; - (void) didEndSaveStateSheetTerminate:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo; +- (void) updateAllWindowTitles; - (void) setupUserDefaults; -- (IBAction) writeDefaults3DRenderingSettings:(id)sender; -- (IBAction) writeDefaultsEmulationSettings:(id)sender; -- (IBAction) writeDefaultsSoundSettings:(id)sender; + @end diff --git a/desmume/src/cocoa/userinterface/EmuControllerDelegate.mm b/desmume/src/cocoa/userinterface/EmuControllerDelegate.mm index 7e2ff04bc..fc30f58ee 100644 --- a/desmume/src/cocoa/userinterface/EmuControllerDelegate.mm +++ b/desmume/src/cocoa/userinterface/EmuControllerDelegate.mm @@ -16,8 +16,7 @@ */ #import "EmuControllerDelegate.h" -#import "emuWindowDelegate.h" -#import "displayView.h" +#import "DisplayWindowController.h" #import "cheatWindowDelegate.h" #import "cocoa_globals.h" @@ -50,6 +49,15 @@ @synthesize saveStatePrecloseSheet; @synthesize exportRomSavePanelAccessoryView; +@synthesize iconExecute; +@synthesize iconPause; +@synthesize iconSpeedNormal; +@synthesize iconSpeedDouble; + +@dynamic masterExecuteFlag; +@dynamic executionState; +@dynamic speedScalar; + @synthesize isWorking; @synthesize isRomLoading; @synthesize statusText; @@ -73,6 +81,7 @@ @dynamic render3DLineHack; @dynamic render3DMultisample; +@synthesize mainWindow; @synthesize windowList; @@ -84,6 +93,10 @@ return nil; } + spinlockFirmware = OS_SPINLOCK_INIT; + spinlockSpeaker = OS_SPINLOCK_INIT; + + mainWindow = nil; windowList = [[NSMutableArray alloc] initWithCapacity:32]; currentRom = nil; @@ -148,56 +161,99 @@ [self setCurrentVolumeIcon:nil]; [romInfoPanelController setContent:[CocoaDSRom romNotLoadedBindings]]; + [cdsSoundController setContent:nil]; + [firmwarePanelController setContent:nil]; + [self setMainWindow:nil]; [windowList release]; [super dealloc]; } +#pragma mark Dynamic Property Methods + - (void) setCdsFirmware:(CocoaDSFirmware *)theFirmware { - if (theFirmware == nil) + OSSpinLockLock(&spinlockFirmware); + + if (theFirmware == cdsFirmware) { - if (cdsFirmware != nil) - { - [cdsFirmware release]; - cdsFirmware = nil; - } - } - else - { - cdsFirmware = [theFirmware retain]; + OSSpinLockUnlock(&spinlockFirmware); + return; } - [firmwarePanelController setContent:cdsFirmware]; + if (theFirmware != nil) + { + [theFirmware retain]; + } + + CocoaDSCore *cdsCore = (CocoaDSCore *)[cdsCoreController content]; + [cdsCore setCdsFirmware:theFirmware]; + [firmwarePanelController setContent:theFirmware]; + + [cdsFirmware release]; + cdsFirmware = theFirmware; + + OSSpinLockUnlock(&spinlockFirmware); } - (CocoaDSFirmware *) cdsFirmware { - return cdsFirmware; + OSSpinLockLock(&spinlockFirmware); + CocoaDSFirmware *theFirmware = cdsFirmware; + OSSpinLockUnlock(&spinlockFirmware); + + return theFirmware; } - (void) setCdsSpeaker:(CocoaDSSpeaker *)theSpeaker { - if (theSpeaker == nil) + OSSpinLockLock(&spinlockSpeaker); + + if (theSpeaker == cdsSpeaker) { - if (cdsSpeaker != nil) - { - [cdsSpeaker release]; - cdsSpeaker = nil; - } - } - else - { - cdsSpeaker = [theSpeaker retain]; + OSSpinLockUnlock(&spinlockSpeaker); + return; } - [cdsSoundController setContent:[cdsSpeaker property]]; + if (theSpeaker != nil) + { + [theSpeaker retain]; + } + + [cdsSoundController setContent:[theSpeaker property]]; + + [cdsSpeaker release]; + cdsSpeaker = theSpeaker; + + OSSpinLockUnlock(&spinlockSpeaker); } - (CocoaDSSpeaker *) cdsSpeaker { - return cdsSpeaker; + OSSpinLockLock(&spinlockSpeaker); + CocoaDSSpeaker *theSpeaker = cdsSpeaker; + OSSpinLockUnlock(&spinlockSpeaker); + + return theSpeaker; +} + +- (BOOL) masterExecuteFlag +{ + CocoaDSCore *cdsCore = (CocoaDSCore *)[cdsCoreController content]; + return [cdsCore masterExecute]; +} + +- (NSInteger) executionState +{ + CocoaDSCore *cdsCore = (CocoaDSCore *)[cdsCoreController content]; + return [cdsCore coreState]; +} + +- (CGFloat) speedScalar +{ + CocoaDSCore *cdsCore = (CocoaDSCore *)[cdsCoreController content]; + return [cdsCore speedScalar]; } - (void) setCurrentVolumeValue:(float)vol @@ -235,6 +291,148 @@ return currentVolumeValue; } +- (void) setRender3DRenderingEngine:(NSInteger)engineID +{ + CocoaDSCore *cdsCore = (CocoaDSCore *)[cdsCoreController content]; + [cdsCore.cdsGPU setRender3DRenderingEngine:engineID]; +} + +- (NSInteger) render3DRenderingEngine +{ + CocoaDSCore *cdsCore = (CocoaDSCore *)[cdsCoreController content]; + return [cdsCore.cdsGPU render3DRenderingEngine]; +} + +- (void) setRender3DHighPrecisionColorInterpolation:(BOOL)theState +{ + CocoaDSCore *cdsCore = (CocoaDSCore *)[cdsCoreController content]; + [cdsCore.cdsGPU setRender3DHighPrecisionColorInterpolation:theState]; +} + +- (BOOL) render3DHighPrecisionColorInterpolation +{ + CocoaDSCore *cdsCore = (CocoaDSCore *)[cdsCoreController content]; + return [cdsCore.cdsGPU render3DHighPrecisionColorInterpolation]; +} + +- (void) setRender3DEdgeMarking:(BOOL)theState +{ + CocoaDSCore *cdsCore = (CocoaDSCore *)[cdsCoreController content]; + [cdsCore.cdsGPU setRender3DEdgeMarking:theState]; +} + +- (BOOL) render3DEdgeMarking +{ + CocoaDSCore *cdsCore = (CocoaDSCore *)[cdsCoreController content]; + return [cdsCore.cdsGPU render3DEdgeMarking]; +} + +- (void) setRender3DFog:(BOOL)theState +{ + CocoaDSCore *cdsCore = (CocoaDSCore *)[cdsCoreController content]; + [cdsCore.cdsGPU setRender3DFog:theState]; +} + +- (BOOL) render3DFog +{ + CocoaDSCore *cdsCore = (CocoaDSCore *)[cdsCoreController content]; + return [cdsCore.cdsGPU render3DFog]; +} + +- (void) setRender3DTextures:(BOOL)theState +{ + CocoaDSCore *cdsCore = (CocoaDSCore *)[cdsCoreController content]; + [cdsCore.cdsGPU setRender3DTextures:theState]; +} + +- (BOOL) render3DTextures +{ + CocoaDSCore *cdsCore = (CocoaDSCore *)[cdsCoreController content]; + return [cdsCore.cdsGPU render3DTextures]; +} + +- (void) setRender3DDepthComparisonThreshold:(NSInteger)threshold +{ + if (threshold < 0) + { + return; + } + + CocoaDSCore *cdsCore = (CocoaDSCore *)[cdsCoreController content]; + [cdsCore.cdsGPU setRender3DDepthComparisonThreshold:(NSUInteger)threshold]; +} + +- (NSInteger) render3DDepthComparisonThreshold +{ + CocoaDSCore *cdsCore = (CocoaDSCore *)[cdsCoreController content]; + return [cdsCore.cdsGPU render3DDepthComparisonThreshold]; +} + +- (void) setRender3DThreads:(NSInteger)threadCount +{ + if (threadCount < 0) + { + return; + } + + CocoaDSCore *cdsCore = (CocoaDSCore *)[cdsCoreController content]; + [cdsCore.cdsGPU setRender3DThreads:(NSUInteger)threadCount]; +} + +- (NSInteger) render3DThreads +{ + CocoaDSCore *cdsCore = (CocoaDSCore *)[cdsCoreController content]; + return [cdsCore.cdsGPU render3DThreads]; +} + +- (void) setRender3DLineHack:(BOOL)theState +{ + CocoaDSCore *cdsCore = (CocoaDSCore *)[cdsCoreController content]; + [cdsCore.cdsGPU setRender3DLineHack:theState]; +} + +- (BOOL) render3DLineHack +{ + CocoaDSCore *cdsCore = (CocoaDSCore *)[cdsCoreController content]; + return [cdsCore.cdsGPU render3DLineHack]; +} + +- (void) setRender3DMultisample:(BOOL)theState +{ + CocoaDSCore *cdsCore = (CocoaDSCore *)[cdsCoreController content]; + [cdsCore.cdsGPU setRender3DMultisample:theState]; +} + +- (BOOL) render3DMultisample +{ + CocoaDSCore *cdsCore = (CocoaDSCore *)[cdsCoreController content]; + return [cdsCore.cdsGPU render3DMultisample]; +} + +#pragma mark IBActions + +- (IBAction) newDisplayWindow:(id)sender +{ + CocoaDSCore *cdsCore = (CocoaDSCore *)[cdsCoreController content]; + DisplayWindowController *newWindowController = [[DisplayWindowController alloc] initWithWindowNibName:@"DisplayWindow" emuControlDelegate:self]; + [windowList addObject:newWindowController]; + [newWindowController setCdsController:[cdsCore cdsController]]; + + [self updateAllWindowTitles]; + [newWindowController showWindow:self]; + [[newWindowController window] makeKeyAndOrderFront:self]; + [[newWindowController window] makeMainWindow]; + + if ([self currentRom] == nil) + { + [[newWindowController view] clearToBlack]; + } + else + { + [[newWindowController view] setNeedsDisplay:YES]; + } +} + - (IBAction) openRom:(id)sender { if ([self isRomLoading]) @@ -273,6 +471,11 @@ } } +- (IBAction) closeWindow:(id)sender +{ + [[mainWindow window] performClose:sender]; +} + - (IBAction) closeRom:(id)sender { [self handleUnloadRom:REASONFORCLOSE_NORMAL romToLoad:nil]; @@ -323,9 +526,9 @@ } isSaveStateEdited = YES; - for (NSWindow *theWindow in windowList) + for (DisplayWindowController *windowController in windowList) { - [theWindow setDocumentEdited:isSaveStateEdited]; + [[windowController window] setDocumentEdited:isSaveStateEdited]; } [self setStatusText:NSSTRING_STATUS_SAVESTATE_LOADED]; @@ -348,9 +551,9 @@ } isSaveStateEdited = YES; - for (NSWindow *theWindow in windowList) + for (DisplayWindowController *windowController in windowList) { - [theWindow setDocumentEdited:isSaveStateEdited]; + [[windowController window] setDocumentEdited:isSaveStateEdited]; } [self setStatusText:NSSTRING_STATUS_SAVESTATE_SAVED]; @@ -392,9 +595,9 @@ } isSaveStateEdited = YES; - for (NSWindow *theWindow in windowList) + for (DisplayWindowController *windowController in windowList) { - [theWindow setDocumentEdited:isSaveStateEdited]; + [[windowController window] setDocumentEdited:isSaveStateEdited]; } [self setStatusText:NSSTRING_STATUS_SAVESTATE_SAVED]; @@ -421,9 +624,9 @@ } isSaveStateEdited = YES; - for (NSWindow *theWindow in windowList) + for (DisplayWindowController *windowController in windowList) { - [theWindow setDocumentEdited:isSaveStateEdited]; + [[windowController window] setDocumentEdited:isSaveStateEdited]; } [self setStatusText:NSSTRING_STATUS_SAVESTATE_REVERTED]; @@ -559,6 +762,11 @@ selectedExportRomSaveID = [CocoaDSUtil getIBActionSenderTag:sender]; } +- (IBAction) copy:(id)sender +{ + [mainWindow copy:sender]; +} + - (IBAction) executeCoreToggle:(id)sender { CocoaDSCore *cdsCore = (CocoaDSCore *)[cdsCoreController content]; @@ -588,26 +796,26 @@ [self setStatusText:NSSTRING_STATUS_EMULATOR_RESETTING]; [self setIsWorking:YES]; - for (NSWindow *theWindow in windowList) + for (DisplayWindowController *windowController in windowList) { - [theWindow displayIfNeeded]; + [[windowController window] displayIfNeeded]; } [cdsCore reset]; if ([cdsCore coreState] == CORESTATE_PAUSE) { - for (NSWindow *theWindow in windowList) + for (DisplayWindowController *windowController in windowList) { - [[(EmuWindowDelegate *)[theWindow delegate] dispViewDelegate] setViewToWhite]; + [[windowController view] clearToWhite]; } } [self setStatusText:NSSTRING_STATUS_EMULATOR_RESET]; [self setIsWorking:NO]; - for (NSWindow *theWindow in windowList) + for (DisplayWindowController *windowController in windowList) { - [theWindow displayIfNeeded]; + [[windowController window] displayIfNeeded]; } } @@ -643,6 +851,40 @@ } } +- (IBAction) toggleKeepMinDisplaySizeAtNormal:(id)sender +{ + [mainWindow toggleKeepMinDisplaySizeAtNormal:sender]; +} + +- (IBAction) toggleStatusBar:(id)sender +{ + [mainWindow toggleStatusBar:sender]; +} + +- (IBAction) toggleToolbarShown:(id)sender +{ + [[mainWindow window] toggleToolbarShown:sender]; +} + +- (IBAction) runToolbarCustomizationPalette:(id)sender +{ + [[mainWindow window] runToolbarCustomizationPalette:sender]; +} + +- (IBAction) saveScreenshotAs:(id)sender +{ + [mainWindow saveScreenshotAs:sender]; +} + +- (IBAction) toggleGPUState:(id)sender +{ + CocoaDSCore *cdsCore = (CocoaDSCore *)[cdsCoreController content]; + const NSInteger bitNumber = [CocoaDSUtil getIBActionSenderTag:sender]; + const UInt32 flagBit = [cdsCore.cdsGPU gpuStateFlags] ^ (1 << bitNumber); + + [cdsCore.cdsGPU setGpuStateFlags:flagBit]; +} + - (IBAction) changeRomSaveType:(id)sender { const NSInteger saveTypeID = [CocoaDSUtil getIBActionSenderTag:sender]; @@ -740,138 +982,142 @@ [CocoaDSUtil messageSendOneWayWithInteger:[cdsSpeaker receivePort] msgID:MESSAGE_SET_SPU_SYNC_METHOD integerValue:[CocoaDSUtil getIBActionSenderTag:sender]]; } -- (void) setRender3DRenderingEngine:(NSInteger)engineID +- (IBAction) changeScale:(id)sender { - CocoaDSCore *cdsCore = (CocoaDSCore *)[cdsCoreController content]; - [cdsCore.cdsGPU setRender3DRenderingEngine:engineID]; + [mainWindow setDisplayScale:(double)[CocoaDSUtil getIBActionSenderTag:sender] / 100.0]; } -- (NSInteger) render3DRenderingEngine +- (IBAction) changeRotation:(id)sender { - CocoaDSCore *cdsCore = (CocoaDSCore *)[cdsCoreController content]; - return [cdsCore.cdsGPU render3DRenderingEngine]; + // Get the rotation value from the sender. + if ([sender isMemberOfClass:[NSSlider class]]) + { + [mainWindow setDisplayRotation:[(NSSlider *)sender doubleValue]]; + } + else + { + [mainWindow setDisplayRotation:(double)[CocoaDSUtil getIBActionSenderTag:sender]]; + } } -- (void) setRender3DHighPrecisionColorInterpolation:(BOOL)theState +- (IBAction) changeRotationRelative:(id)sender { - CocoaDSCore *cdsCore = (CocoaDSCore *)[cdsCoreController content]; - [cdsCore.cdsGPU setRender3DHighPrecisionColorInterpolation:theState]; + const double angleDegrees = [mainWindow displayRotation] + (double)[CocoaDSUtil getIBActionSenderTag:sender]; + [mainWindow setDisplayRotation:angleDegrees]; } -- (BOOL) render3DHighPrecisionColorInterpolation +- (IBAction) changeDisplayMode:(id)sender { - CocoaDSCore *cdsCore = (CocoaDSCore *)[cdsCoreController content]; - return [cdsCore.cdsGPU render3DHighPrecisionColorInterpolation]; -} - -- (void) setRender3DEdgeMarking:(BOOL)theState -{ - CocoaDSCore *cdsCore = (CocoaDSCore *)[cdsCoreController content]; - [cdsCore.cdsGPU setRender3DEdgeMarking:theState]; -} - -- (BOOL) render3DEdgeMarking -{ - CocoaDSCore *cdsCore = (CocoaDSCore *)[cdsCoreController content]; - return [cdsCore.cdsGPU render3DEdgeMarking]; -} - -- (void) setRender3DFog:(BOOL)theState -{ - CocoaDSCore *cdsCore = (CocoaDSCore *)[cdsCoreController content]; - [cdsCore.cdsGPU setRender3DFog:theState]; -} - -- (BOOL) render3DFog -{ - CocoaDSCore *cdsCore = (CocoaDSCore *)[cdsCoreController content]; - return [cdsCore.cdsGPU render3DFog]; -} - -- (void) setRender3DTextures:(BOOL)theState -{ - CocoaDSCore *cdsCore = (CocoaDSCore *)[cdsCoreController content]; - [cdsCore.cdsGPU setRender3DTextures:theState]; -} - -- (BOOL) render3DTextures -{ - CocoaDSCore *cdsCore = (CocoaDSCore *)[cdsCoreController content]; - return [cdsCore.cdsGPU render3DTextures]; -} - -- (void) setRender3DDepthComparisonThreshold:(NSInteger)threshold -{ - if (threshold < 0) + const NSInteger newDisplayModeID = [CocoaDSUtil getIBActionSenderTag:sender]; + + if (newDisplayModeID == [mainWindow displayMode]) { return; } - CocoaDSCore *cdsCore = (CocoaDSCore *)[cdsCoreController content]; - [cdsCore.cdsGPU setRender3DDepthComparisonThreshold:(NSUInteger)threshold]; + [mainWindow setDisplayMode:newDisplayModeID]; } -- (NSInteger) render3DDepthComparisonThreshold +- (IBAction) changeDisplayOrientation:(id)sender { - CocoaDSCore *cdsCore = (CocoaDSCore *)[cdsCoreController content]; - return [cdsCore.cdsGPU render3DDepthComparisonThreshold]; -} - -- (void) setRender3DThreads:(NSInteger)threadCount -{ - if (threadCount < 0) + const NSInteger newDisplayOrientation = [CocoaDSUtil getIBActionSenderTag:sender]; + + if (newDisplayOrientation == [mainWindow displayOrientation]) { return; } - CocoaDSCore *cdsCore = (CocoaDSCore *)[cdsCoreController content]; - [cdsCore.cdsGPU setRender3DThreads:(NSUInteger)threadCount]; + [mainWindow setDisplayOrientation:newDisplayOrientation]; } -- (NSInteger) render3DThreads +- (IBAction) changeDisplayOrder:(id)sender { - CocoaDSCore *cdsCore = (CocoaDSCore *)[cdsCoreController content]; - return [cdsCore.cdsGPU render3DThreads]; + [mainWindow setDisplayOrder:[CocoaDSUtil getIBActionSenderTag:sender]]; } -- (void) setRender3DLineHack:(BOOL)theState +- (IBAction) writeDefaultsDisplayRotation:(id)sender { - CocoaDSCore *cdsCore = (CocoaDSCore *)[cdsCoreController content]; - [cdsCore.cdsGPU setRender3DLineHack:theState]; + [[NSUserDefaults standardUserDefaults] setDouble:[mainWindow displayRotation] forKey:@"DisplayView_Rotation"]; } -- (BOOL) render3DLineHack +- (IBAction) writeDefaultsHUDSettings:(id)sender { - CocoaDSCore *cdsCore = (CocoaDSCore *)[cdsCoreController content]; - return [cdsCore.cdsGPU render3DLineHack]; + // TODO: Not implemented. } -- (void) setRender3DMultisample:(BOOL)theState +- (IBAction) writeDefaultsDisplayVideoSettings:(id)sender { - CocoaDSCore *cdsCore = (CocoaDSCore *)[cdsCoreController content]; - [cdsCore.cdsGPU setRender3DMultisample:theState]; + [[NSUserDefaults standardUserDefaults] setInteger:[mainWindow videoFilterType] forKey:@"DisplayView_VideoFilter"]; + [[NSUserDefaults standardUserDefaults] setBool:[mainWindow useBilinearOutput] forKey:@"DisplayView_UseBilinearOutput"]; + [[NSUserDefaults standardUserDefaults] setBool:[mainWindow useVerticalSync] forKey:@"DisplayView_UseVerticalSync"]; } -- (BOOL) render3DMultisample +- (IBAction) writeDefaults3DRenderingSettings:(id)sender { CocoaDSCore *cdsCore = (CocoaDSCore *)[cdsCoreController content]; - return [cdsCore.cdsGPU render3DMultisample]; -} - -- (IBAction) toggleGPUState:(id)sender -{ - CocoaDSCore *cdsCore = (CocoaDSCore *)[cdsCoreController content]; - const NSInteger bitNumber = [CocoaDSUtil getIBActionSenderTag:sender]; - const UInt32 flagBit = [cdsCore.cdsGPU gpuStateFlags] ^ (1 << bitNumber); - [cdsCore.cdsGPU setGpuStateFlags:flagBit]; + // Force end of editing of any text fields. + [[(NSControl *)sender window] makeFirstResponder:nil]; + + [[NSUserDefaults standardUserDefaults] setInteger:[cdsCore.cdsGPU render3DRenderingEngine] forKey:@"Render3D_RenderingEngine"]; + [[NSUserDefaults standardUserDefaults] setBool:[cdsCore.cdsGPU render3DHighPrecisionColorInterpolation] forKey:@"Render3D_HighPrecisionColorInterpolation"]; + [[NSUserDefaults standardUserDefaults] setBool:[cdsCore.cdsGPU render3DEdgeMarking] forKey:@"Render3D_EdgeMarking"]; + [[NSUserDefaults standardUserDefaults] setBool:[cdsCore.cdsGPU render3DFog] forKey:@"Render3D_Fog"]; + [[NSUserDefaults standardUserDefaults] setBool:[cdsCore.cdsGPU render3DTextures] forKey:@"Render3D_Textures"]; + [[NSUserDefaults standardUserDefaults] setInteger:[cdsCore.cdsGPU render3DDepthComparisonThreshold] forKey:@"Render3D_DepthComparisonThreshold"]; + [[NSUserDefaults standardUserDefaults] setInteger:[cdsCore.cdsGPU render3DThreads] forKey:@"Render3D_Threads"]; + [[NSUserDefaults standardUserDefaults] setBool:[cdsCore.cdsGPU render3DLineHack] forKey:@"Render3D_LineHack"]; + [[NSUserDefaults standardUserDefaults] setBool:[cdsCore.cdsGPU render3DMultisample] forKey:@"Render3D_Multisample"]; } -- (IBAction) newDisplayWindow:(id)sender +- (IBAction) writeDefaultsEmulationSettings:(id)sender { + CocoaDSCore *cdsCore = (CocoaDSCore *)[cdsCoreController content]; + NSDictionary *firmwareDict = [(CocoaDSFirmware *)[firmwarePanelController content] dataDictionary]; + // Force end of editing of any text fields. + [[(NSControl *)sender window] makeFirstResponder:nil]; + + [[NSUserDefaults standardUserDefaults] setBool:[cdsCore emuFlagAdvancedBusLevelTiming] forKey:@"Emulation_AdvancedBusLevelTiming"]; + [[NSUserDefaults standardUserDefaults] setBool:[cdsCore emuFlagRigorousTiming] forKey:@"Emulation_RigorousTiming"]; + [[NSUserDefaults standardUserDefaults] setInteger:[cdsCore cpuEmulationEngine] forKey:@"Emulation_CPUEmulationEngine"]; + [[NSUserDefaults standardUserDefaults] setBool:[cdsCore emuFlagUseExternalBios] forKey:@"Emulation_UseExternalBIOSImages"]; + [[NSUserDefaults standardUserDefaults] setBool:[cdsCore emuFlagEmulateBiosInterrupts] forKey:@"Emulation_BIOSEmulateSWI"]; + [[NSUserDefaults standardUserDefaults] setBool:[cdsCore emuFlagPatchDelayLoop] forKey:@"Emulation_BIOSPatchDelayLoopSWI"]; + [[NSUserDefaults standardUserDefaults] setBool:[cdsCore emuFlagUseExternalFirmware] forKey:@"Emulation_UseExternalFirmwareImage"]; + [[NSUserDefaults standardUserDefaults] setBool:[cdsCore emuFlagFirmwareBoot] forKey:@"Emulation_FirmwareBoot"]; + [[NSUserDefaults standardUserDefaults] setBool:[cdsCore emuFlagEmulateEnsata] forKey:@"Emulation_EmulateEnsata"]; + [[NSUserDefaults standardUserDefaults] setBool:[cdsCore emuFlagDebugConsole] forKey:@"Emulation_UseDebugConsole"]; + + [[NSUserDefaults standardUserDefaults] setObject:[firmwareDict valueForKey:@"Nickname"] forKey:@"FirmwareConfig_Nickname"]; + [[NSUserDefaults standardUserDefaults] setObject:[firmwareDict valueForKey:@"Message"] forKey:@"FirmwareConfig_Message"]; + [[NSUserDefaults standardUserDefaults] setObject:[firmwareDict valueForKey:@"FavoriteColor"] forKey:@"FirmwareConfig_FavoriteColor"]; + [[NSUserDefaults standardUserDefaults] setObject:[firmwareDict valueForKey:@"Birthday"] forKey:@"FirmwareConfig_Birthday"]; + [[NSUserDefaults standardUserDefaults] setObject:[firmwareDict valueForKey:@"Language"] forKey:@"FirmwareConfig_Language"]; } +- (IBAction) writeDefaultsSoundSettings:(id)sender +{ + NSMutableDictionary *speakerBindings = (NSMutableDictionary *)[cdsSoundController content]; + + [[NSUserDefaults standardUserDefaults] setFloat:[[speakerBindings valueForKey:@"volume"] floatValue] forKey:@"Sound_Volume"]; + [[NSUserDefaults standardUserDefaults] setInteger:[[speakerBindings valueForKey:@"audioOutputEngine"] integerValue] forKey:@"Sound_AudioOutputEngine"]; + [[NSUserDefaults standardUserDefaults] setBool:[[speakerBindings valueForKey:@"spuAdvancedLogic"] boolValue] forKey:@"SPU_AdvancedLogic"]; + [[NSUserDefaults standardUserDefaults] setInteger:[[speakerBindings valueForKey:@"spuInterpolationMode"] integerValue] forKey:@"SPU_InterpolationMode"]; + [[NSUserDefaults standardUserDefaults] setInteger:[[speakerBindings valueForKey:@"spuSyncMode"] integerValue] forKey:@"SPU_SyncMode"]; + [[NSUserDefaults standardUserDefaults] setInteger:[[speakerBindings valueForKey:@"spuSyncMethod"] integerValue] forKey:@"SPU_SyncMethod"]; +} + +- (IBAction) closeSheet:(id)sender +{ + NSWindow *sheet = [(NSControl *)sender window]; + const NSInteger code = [(NSControl *)sender tag]; + + [NSApp endSheet:sheet returnCode:code]; +} + +#pragma mark Class Methods + - (BOOL) handleLoadRom:(NSURL *)fileURL { BOOL result = NO; @@ -903,7 +1149,7 @@ [self setIsShowingFileMigrationDialog:YES]; [NSApp beginSheet:saveFileMigrationSheet - modalForWindow:(NSWindow *)[windowList objectAtIndex:0] + modalForWindow:[[windowList objectAtIndex:0] window] modalDelegate:self didEndSelector:@selector(didEndFileMigrationSheet:returnCode:contextInfo:) contextInfo:fileURL]; @@ -950,7 +1196,7 @@ [self setIsShowingSaveStateDialog:YES]; [NSApp beginSheet:saveStatePrecloseSheet - modalForWindow:(NSWindow *)[windowList objectAtIndex:0] + modalForWindow:(NSWindow *)[[windowList objectAtIndex:0] window] modalDelegate:self didEndSelector:endSheetSelector contextInfo:romURL]; @@ -975,9 +1221,9 @@ [self setStatusText:NSSTRING_STATUS_ROM_LOADING]; [self setIsWorking:YES]; - for (NSWindow *theWindow in windowList) + for (DisplayWindowController *windowController in windowList) { - [theWindow displayIfNeeded]; + [[windowController window] displayIfNeeded]; } // Need to pause the core before loading the ROM. @@ -1101,23 +1347,20 @@ [[NSDocumentController sharedDocumentController] noteNewRecentDocumentURL:[theRom fileURL]]; // Update the UI to indicate that a ROM has indeed been loaded. - for (NSWindow *theWindow in windowList) + [self updateAllWindowTitles]; + + for (DisplayWindowController *windowController in windowList) { - [theWindow setRepresentedURL:[theRom fileURL]]; - [[theWindow standardWindowButton:NSWindowDocumentIconButton] setImage:[theRom icon]]; - - NSString *newWindowTitle = [theRom internalName]; - [theWindow setTitle:newWindowTitle]; - [[(EmuWindowDelegate *)[theWindow delegate] dispViewDelegate] setViewToWhite]; + [[windowController view] clearToWhite]; } [self setStatusText:NSSTRING_STATUS_ROM_LOADED]; [self setIsWorking:NO]; [self setIsRomLoading:NO]; - for (NSWindow *theWindow in windowList) + for (DisplayWindowController *windowController in windowList) { - [theWindow displayIfNeeded]; + [[windowController window] displayIfNeeded]; } // After the ROM loading is complete, send an execute message to the Cocoa DS per @@ -1135,9 +1378,9 @@ [self setCurrentSaveStateURL:nil]; isSaveStateEdited = NO; - for (NSWindow *theWindow in windowList) + for (DisplayWindowController *windowController in windowList) { - [theWindow setDocumentEdited:isSaveStateEdited]; + [[windowController window] setDocumentEdited:isSaveStateEdited]; } // Save the ROM's cheat list before unloading. @@ -1159,9 +1402,9 @@ [self setIsWorking:YES]; - for (NSWindow *theWindow in windowList) + for (DisplayWindowController *windowController in windowList) { - [theWindow displayIfNeeded]; + [[windowController window] displayIfNeeded]; } // Unload the ROM. @@ -1177,20 +1420,19 @@ [CocoaDSCheatManager setMasterCheatList:dummyCheatList]; // Update the UI to indicate that the ROM has finished unloading. - for (NSWindow *theWindow in windowList) + [self updateAllWindowTitles]; + + for (DisplayWindowController *windowController in windowList) { - [theWindow setRepresentedURL:nil]; - NSString *newWindowTitle = (NSString *)[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleName"]; - [theWindow setTitle:newWindowTitle]; - [[(EmuWindowDelegate *)[theWindow delegate] dispViewDelegate] setViewToBlack]; + [[windowController view] clearToBlack]; } [self setStatusText:NSSTRING_STATUS_ROM_UNLOADED]; [self setIsWorking:NO]; - for (NSWindow *theWindow in windowList) + for (DisplayWindowController *windowController in windowList) { - [theWindow displayIfNeeded]; + [[windowController window] displayIfNeeded]; } result = YES; @@ -1198,6 +1440,18 @@ return result; } +- (void) addOutputToCore:(CocoaDSOutput *)theOutput +{ + CocoaDSCore *cdsCore = (CocoaDSCore *)[cdsCoreController content]; + [cdsCore addOutput:theOutput]; +} + +- (void) removeOutputFromCore:(CocoaDSOutput *)theOutput +{ + CocoaDSCore *cdsCore = (CocoaDSCore *)[cdsCoreController content]; + [cdsCore removeOutput:theOutput]; +} + - (void) executeCore { CocoaDSCore *cdsCore = (CocoaDSCore *)[cdsCoreController content]; @@ -1216,93 +1470,6 @@ [cdsCore restoreCoreState]; } -- (void) setupUserDefaults -{ - // Set the SPU settings per user preferences. - [self setCurrentVolumeValue:[[NSUserDefaults standardUserDefaults] floatForKey:@"Sound_Volume"]]; - [[self cdsSpeaker] setVolume:[[NSUserDefaults standardUserDefaults] floatForKey:@"Sound_Volume"]]; - [[self cdsSpeaker] setAudioOutputEngine:[[NSUserDefaults standardUserDefaults] integerForKey:@"Sound_AudioOutputEngine"]]; - [[self cdsSpeaker] setSpuAdvancedLogic:[[NSUserDefaults standardUserDefaults] boolForKey:@"SPU_AdvancedLogic"]]; - [[self cdsSpeaker] setSpuInterpolationMode:[[NSUserDefaults standardUserDefaults] integerForKey:@"SPU_InterpolationMode"]]; - [[self cdsSpeaker] setSpuSyncMode:[[NSUserDefaults standardUserDefaults] integerForKey:@"SPU_SyncMode"]]; - [[self cdsSpeaker] setSpuSyncMethod:[[NSUserDefaults standardUserDefaults] integerForKey:@"SPU_SyncMethod"]]; - - // Set the 3D rendering options per user preferences. - [self setRender3DThreads:(NSUInteger)[[NSUserDefaults standardUserDefaults] integerForKey:@"Render3D_Threads"]]; - [self setRender3DRenderingEngine:[[NSUserDefaults standardUserDefaults] integerForKey:@"Render3D_RenderingEngine"]]; - [self setRender3DHighPrecisionColorInterpolation:[[NSUserDefaults standardUserDefaults] boolForKey:@"Render3D_HighPrecisionColorInterpolation"]]; - [self setRender3DEdgeMarking:[[NSUserDefaults standardUserDefaults] boolForKey:@"Render3D_EdgeMarking"]]; - [self setRender3DFog:[[NSUserDefaults standardUserDefaults] boolForKey:@"Render3D_Fog"]]; - [self setRender3DTextures:[[NSUserDefaults standardUserDefaults] boolForKey:@"Render3D_Textures"]]; - [self setRender3DDepthComparisonThreshold:(NSUInteger)[[NSUserDefaults standardUserDefaults] integerForKey:@"Render3D_DepthComparisonThreshold"]]; - [self setRender3DLineHack:[[NSUserDefaults standardUserDefaults] boolForKey:@"Render3D_LineHack"]]; - [self setRender3DMultisample:[[NSUserDefaults standardUserDefaults] boolForKey:@"Render3D_Multisample"]]; -} - -- (IBAction) writeDefaults3DRenderingSettings:(id)sender -{ - CocoaDSCore *cdsCore = (CocoaDSCore *)[cdsCoreController content]; - - // Force end of editing of any text fields. - [[(NSControl *)sender window] makeFirstResponder:nil]; - - [[NSUserDefaults standardUserDefaults] setInteger:[cdsCore.cdsGPU render3DRenderingEngine] forKey:@"Render3D_RenderingEngine"]; - [[NSUserDefaults standardUserDefaults] setBool:[cdsCore.cdsGPU render3DHighPrecisionColorInterpolation] forKey:@"Render3D_HighPrecisionColorInterpolation"]; - [[NSUserDefaults standardUserDefaults] setBool:[cdsCore.cdsGPU render3DEdgeMarking] forKey:@"Render3D_EdgeMarking"]; - [[NSUserDefaults standardUserDefaults] setBool:[cdsCore.cdsGPU render3DFog] forKey:@"Render3D_Fog"]; - [[NSUserDefaults standardUserDefaults] setBool:[cdsCore.cdsGPU render3DTextures] forKey:@"Render3D_Textures"]; - [[NSUserDefaults standardUserDefaults] setInteger:[cdsCore.cdsGPU render3DDepthComparisonThreshold] forKey:@"Render3D_DepthComparisonThreshold"]; - [[NSUserDefaults standardUserDefaults] setInteger:[cdsCore.cdsGPU render3DThreads] forKey:@"Render3D_Threads"]; - [[NSUserDefaults standardUserDefaults] setBool:[cdsCore.cdsGPU render3DLineHack] forKey:@"Render3D_LineHack"]; - [[NSUserDefaults standardUserDefaults] setBool:[cdsCore.cdsGPU render3DMultisample] forKey:@"Render3D_Multisample"]; -} - -- (IBAction) writeDefaultsEmulationSettings:(id)sender -{ - CocoaDSCore *cdsCore = (CocoaDSCore *)[cdsCoreController content]; - NSDictionary *firmwareDict = [(CocoaDSFirmware *)[firmwarePanelController content] dataDictionary]; - - // Force end of editing of any text fields. - [[(NSControl *)sender window] makeFirstResponder:nil]; - - [[NSUserDefaults standardUserDefaults] setBool:[cdsCore emuFlagAdvancedBusLevelTiming] forKey:@"Emulation_AdvancedBusLevelTiming"]; - [[NSUserDefaults standardUserDefaults] setBool:[cdsCore emuFlagRigorousTiming] forKey:@"Emulation_RigorousTiming"]; - [[NSUserDefaults standardUserDefaults] setInteger:[cdsCore cpuEmulationEngine] forKey:@"Emulation_CPUEmulationEngine"]; - [[NSUserDefaults standardUserDefaults] setBool:[cdsCore emuFlagUseExternalBios] forKey:@"Emulation_UseExternalBIOSImages"]; - [[NSUserDefaults standardUserDefaults] setBool:[cdsCore emuFlagEmulateBiosInterrupts] forKey:@"Emulation_BIOSEmulateSWI"]; - [[NSUserDefaults standardUserDefaults] setBool:[cdsCore emuFlagPatchDelayLoop] forKey:@"Emulation_BIOSPatchDelayLoopSWI"]; - [[NSUserDefaults standardUserDefaults] setBool:[cdsCore emuFlagUseExternalFirmware] forKey:@"Emulation_UseExternalFirmwareImage"]; - [[NSUserDefaults standardUserDefaults] setBool:[cdsCore emuFlagFirmwareBoot] forKey:@"Emulation_FirmwareBoot"]; - [[NSUserDefaults standardUserDefaults] setBool:[cdsCore emuFlagEmulateEnsata] forKey:@"Emulation_EmulateEnsata"]; - [[NSUserDefaults standardUserDefaults] setBool:[cdsCore emuFlagDebugConsole] forKey:@"Emulation_UseDebugConsole"]; - - [[NSUserDefaults standardUserDefaults] setObject:[firmwareDict valueForKey:@"Nickname"] forKey:@"FirmwareConfig_Nickname"]; - [[NSUserDefaults standardUserDefaults] setObject:[firmwareDict valueForKey:@"Message"] forKey:@"FirmwareConfig_Message"]; - [[NSUserDefaults standardUserDefaults] setObject:[firmwareDict valueForKey:@"FavoriteColor"] forKey:@"FirmwareConfig_FavoriteColor"]; - [[NSUserDefaults standardUserDefaults] setObject:[firmwareDict valueForKey:@"Birthday"] forKey:@"FirmwareConfig_Birthday"]; - [[NSUserDefaults standardUserDefaults] setObject:[firmwareDict valueForKey:@"Language"] forKey:@"FirmwareConfig_Language"]; -} - -- (IBAction) writeDefaultsSoundSettings:(id)sender -{ - NSMutableDictionary *speakerBindings = (NSMutableDictionary *)[cdsSoundController content]; - - [[NSUserDefaults standardUserDefaults] setFloat:[[speakerBindings valueForKey:@"volume"] floatValue] forKey:@"Sound_Volume"]; - [[NSUserDefaults standardUserDefaults] setInteger:[[speakerBindings valueForKey:@"audioOutputEngine"] integerValue] forKey:@"Sound_AudioOutputEngine"]; - [[NSUserDefaults standardUserDefaults] setBool:[[speakerBindings valueForKey:@"spuAdvancedLogic"] boolValue] forKey:@"SPU_AdvancedLogic"]; - [[NSUserDefaults standardUserDefaults] setInteger:[[speakerBindings valueForKey:@"spuInterpolationMode"] integerValue] forKey:@"SPU_InterpolationMode"]; - [[NSUserDefaults standardUserDefaults] setInteger:[[speakerBindings valueForKey:@"spuSyncMode"] integerValue] forKey:@"SPU_SyncMode"]; - [[NSUserDefaults standardUserDefaults] setInteger:[[speakerBindings valueForKey:@"spuSyncMethod"] integerValue] forKey:@"SPU_SyncMethod"]; -} - -- (IBAction) closeSheet:(id)sender -{ - NSWindow *sheet = [(NSControl *)sender window]; - const NSInteger code = [(NSControl *)sender tag]; - - [NSApp endSheet:sheet returnCode:code]; -} - - (void) didEndFileMigrationSheet:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo { NSURL *romURL = (NSURL *)contextInfo; @@ -1391,6 +1558,73 @@ } } +- (void) updateAllWindowTitles +{ + if ([windowList count] < 1) + { + return; + } + + NSString *romName = nil; + NSURL *repURL = nil; + NSImage *titleIcon = nil; + + if ([self currentRom] == nil) + { + romName = (NSString *)[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleName"]; + } + else + { + romName = [currentRom internalName]; + repURL = [currentRom fileURL]; + titleIcon = [currentRom icon]; + } + + if ([windowList count] > 1) + { + for (DisplayWindowController *windowController in windowList) + { + NSString *newWindowTitle = [romName stringByAppendingFormat:@":%ld", (unsigned long)([windowList indexOfObject:windowController] + 1)]; + + [[windowController window] setTitle:newWindowTitle]; + [[windowController window] setRepresentedURL:repURL]; + [[[windowController window] standardWindowButton:NSWindowDocumentIconButton] setImage:titleIcon]; + } + } + else + { + NSWindow *theWindow = [[windowList objectAtIndex:0] window]; + [theWindow setTitle:romName]; + [theWindow setRepresentedURL:repURL]; + [[theWindow standardWindowButton:NSWindowDocumentIconButton] setImage:titleIcon]; + } +} + +- (void) setupUserDefaults +{ + // Set the SPU settings per user preferences. + [self setCurrentVolumeValue:[[NSUserDefaults standardUserDefaults] floatForKey:@"Sound_Volume"]]; + [[self cdsSpeaker] setVolume:[[NSUserDefaults standardUserDefaults] floatForKey:@"Sound_Volume"]]; + [[self cdsSpeaker] setAudioOutputEngine:[[NSUserDefaults standardUserDefaults] integerForKey:@"Sound_AudioOutputEngine"]]; + [[self cdsSpeaker] setSpuAdvancedLogic:[[NSUserDefaults standardUserDefaults] boolForKey:@"SPU_AdvancedLogic"]]; + [[self cdsSpeaker] setSpuInterpolationMode:[[NSUserDefaults standardUserDefaults] integerForKey:@"SPU_InterpolationMode"]]; + [[self cdsSpeaker] setSpuSyncMode:[[NSUserDefaults standardUserDefaults] integerForKey:@"SPU_SyncMode"]]; + [[self cdsSpeaker] setSpuSyncMethod:[[NSUserDefaults standardUserDefaults] integerForKey:@"SPU_SyncMethod"]]; + + // Set the 3D rendering options per user preferences. + [self setRender3DThreads:(NSUInteger)[[NSUserDefaults standardUserDefaults] integerForKey:@"Render3D_Threads"]]; + [self setRender3DRenderingEngine:[[NSUserDefaults standardUserDefaults] integerForKey:@"Render3D_RenderingEngine"]]; + [self setRender3DHighPrecisionColorInterpolation:[[NSUserDefaults standardUserDefaults] boolForKey:@"Render3D_HighPrecisionColorInterpolation"]]; + [self setRender3DEdgeMarking:[[NSUserDefaults standardUserDefaults] boolForKey:@"Render3D_EdgeMarking"]]; + [self setRender3DFog:[[NSUserDefaults standardUserDefaults] boolForKey:@"Render3D_Fog"]]; + [self setRender3DTextures:[[NSUserDefaults standardUserDefaults] boolForKey:@"Render3D_Textures"]]; + [self setRender3DDepthComparisonThreshold:(NSUInteger)[[NSUserDefaults standardUserDefaults] integerForKey:@"Render3D_DepthComparisonThreshold"]]; + [self setRender3DLineHack:[[NSUserDefaults standardUserDefaults] boolForKey:@"Render3D_LineHack"]]; + [self setRender3DMultisample:[[NSUserDefaults standardUserDefaults] boolForKey:@"Render3D_Multisample"]]; +} + +#pragma mark NSUserInterfaceValidations Protocol + - (BOOL)validateUserInterfaceItem:(id )theItem { BOOL enable = YES; @@ -1635,10 +1869,100 @@ } } } + else if (theAction == @selector(changeScale:)) + { + const NSInteger viewScale = (NSInteger)([mainWindow displayScale] * 100.0); + + if ([(id)theItem isMemberOfClass:[NSMenuItem class]]) + { + [(NSMenuItem*)theItem setState:(viewScale == [theItem tag]) ? NSOnState : NSOffState]; + } + } + else if (theAction == @selector(changeRotation:)) + { + NSInteger viewRotation = (NSInteger)([mainWindow displayRotation]); + + if ([(id)theItem isMemberOfClass:[NSMenuItem class]]) + { + if ([theItem tag] == -1) + { + if (viewRotation == 0 || + viewRotation == 90 || + viewRotation == 180 || + viewRotation == 270) + { + [(NSMenuItem*)theItem setState:NSOffState]; + } + else + { + [(NSMenuItem*)theItem setState:NSOnState]; + } + } + else if (viewRotation == [theItem tag]) + { + [(NSMenuItem*)theItem setState:NSOnState]; + } + else + { + [(NSMenuItem*)theItem setState:NSOffState]; + } + } + } + else if (theAction == @selector(changeDisplayMode:)) + { + if ([(id)theItem isMemberOfClass:[NSMenuItem class]]) + { + [(NSMenuItem*)theItem setState:([mainWindow displayMode] == [theItem tag]) ? NSOnState : NSOffState]; + } + } + else if (theAction == @selector(changeDisplayOrientation:)) + { + if ([(id)theItem isMemberOfClass:[NSMenuItem class]]) + { + [(NSMenuItem*)theItem setState:([mainWindow displayOrientation] == [theItem tag]) ? NSOnState : NSOffState]; + } + } + else if (theAction == @selector(changeDisplayOrder:)) + { + if ([(id)theItem isMemberOfClass:[NSMenuItem class]]) + { + [(NSMenuItem*)theItem setState:([mainWindow displayOrder] == [theItem tag]) ? NSOnState : NSOffState]; + } + } + else if (theAction == @selector(hudDisable:)) + { + if ([(id)theItem isMemberOfClass:[NSMenuItem class]]) + { + [(NSMenuItem*)theItem setTitle:([[mainWindow view] isHudEnabled]) ? NSSTRING_TITLE_DISABLE_HUD : NSSTRING_TITLE_ENABLE_HUD]; + } + } + else if (theAction == @selector(toggleStatusBar:)) + { + if ([(id)theItem isMemberOfClass:[NSMenuItem class]]) + { + [(NSMenuItem*)theItem setTitle:([mainWindow isShowingStatusBar]) ? NSSTRING_TITLE_HIDE_STATUS_BAR : NSSTRING_TITLE_SHOW_STATUS_BAR]; + } + } + else if (theAction == @selector(toggleKeepMinDisplaySizeAtNormal:)) + { + if ([(id)theItem isMemberOfClass:[NSMenuItem class]]) + { + [(NSMenuItem*)theItem setState:([mainWindow isMinSizeNormal]) ? NSOnState : NSOffState]; + } + } + else if (theAction == @selector(toggleToolbarShown:)) + { + if ([(id)theItem isMemberOfClass:[NSMenuItem class]]) + { + [(NSMenuItem*)theItem setTitle:([[[mainWindow window] toolbar] isVisible]) ? NSSTRING_TITLE_HIDE_TOOLBAR : NSSTRING_TITLE_SHOW_TOOLBAR]; + } + } return enable; } +#pragma mark NSControl Delegate Methods + - (void)controlTextDidEndEditing:(NSNotification *)aNotification { [self setRender3DDepthComparisonThreshold:[(NSNumber *)[aNotification object] integerValue]]; diff --git a/desmume/src/cocoa/userinterface/appDelegate.h b/desmume/src/cocoa/userinterface/appDelegate.h index 670fe2309..5c5e756f7 100644 --- a/desmume/src/cocoa/userinterface/appDelegate.h +++ b/desmume/src/cocoa/userinterface/appDelegate.h @@ -36,12 +36,10 @@ NSObjectController *emuControlController; NSObjectController *cdsSoundController; NSObjectController *romInfoPanelController; - NSObjectController *emuWindowController; NSObjectController *prefWindowController; NSObjectController *cheatWindowController; NSObjectController *cdsCoreController; - NSWindow *mainWindow; NSWindow *prefWindow; NSWindow *troubleshootingWindow; NSWindow *cheatListWindow; @@ -70,11 +68,9 @@ @property (readonly) IBOutlet NSObjectController *emuControlController; @property (readonly) IBOutlet NSObjectController *cdsSoundController; @property (readonly) IBOutlet NSObjectController *romInfoPanelController; -@property (readonly) IBOutlet NSObjectController *emuWindowController; @property (readonly) IBOutlet NSObjectController *prefWindowController; @property (readonly) IBOutlet NSObjectController *cheatWindowController; @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; diff --git a/desmume/src/cocoa/userinterface/appDelegate.mm b/desmume/src/cocoa/userinterface/appDelegate.mm index a1fee76ab..0a183a48d 100644 --- a/desmume/src/cocoa/userinterface/appDelegate.mm +++ b/desmume/src/cocoa/userinterface/appDelegate.mm @@ -17,12 +17,11 @@ */ #import "appDelegate.h" +#import "DisplayWindowController.h" #import "EmuControllerDelegate.h" -#import "emuWindowDelegate.h" #import "preferencesWindowDelegate.h" #import "troubleshootingWindowDelegate.h" #import "cheatWindowDelegate.h" -#import "displayView.h" #import "inputPrefsView.h" #import "cocoa_core.h" @@ -39,7 +38,6 @@ @implementation AppDelegate @dynamic dummyObject; -@synthesize mainWindow; @synthesize prefWindow; @synthesize troubleshootingWindow; @synthesize cheatListWindow; @@ -53,7 +51,6 @@ @synthesize emuControlController; @synthesize cdsSoundController; @synthesize romInfoPanelController; -@synthesize emuWindowController; @synthesize prefWindowController; @synthesize cdsCoreController; @synthesize cheatWindowController; @@ -100,8 +97,7 @@ - (void)applicationWillFinishLaunching:(NSNotification *)notification { EmuControllerDelegate *emuControl = (EmuControllerDelegate *)[emuControlController content]; - EmuWindowDelegate *mainWindowDelegate = [mainWindow delegate]; - PreferencesWindowDelegate *prefWindowDelegate = [prefWindow delegate]; + PreferencesWindowDelegate *prefWindowDelegate = (PreferencesWindowDelegate *)[prefWindow delegate]; CheatWindowDelegate *cheatWindowDelegate = (CheatWindowDelegate *)[cheatListWindow delegate]; // Determine if we're running on Intel or PPC. @@ -119,7 +115,6 @@ return; } - [[emuControl windowList] addObject:mainWindow]; [CocoaDSFile setupAllFilePaths]; // Setup the About window. @@ -151,7 +146,7 @@ if (prefsDict == nil) { [[NSAlert alertWithMessageText:NSSTRING_ALERT_CRITICAL_FILE_MISSING_PRI defaultButton:nil alternateButton:nil otherButton:nil informativeTextWithFormat:NSSTRING_ALERT_CRITICAL_FILE_MISSING_SEC] runModal]; - [NSApp terminate: nil]; + [NSApp terminate:nil]; return; } @@ -162,9 +157,7 @@ [self setRomInfoPanelBoxTitleColors]; // Set up all the object controllers according to our default windows. - [cdsSoundController setContent:nil]; [romInfoPanelController setContent:[CocoaDSRom romNotLoadedBindings]]; - [emuWindowController setContent:[mainWindowDelegate bindings]]; [prefWindowController setContent:[prefWindowDelegate bindings]]; [cheatWindowController setContent:[cheatWindowDelegate bindings]]; @@ -178,12 +171,6 @@ // Setup the HID Input manager. [self setHidManager:[[[CocoaHIDManager alloc] init] autorelease]]; - // Set the display view delegate. - DisplayViewDelegate *newDispViewDelegate = [[[DisplayViewDelegate alloc] init] autorelease]; - [newDispViewDelegate setView:[mainWindowDelegate displayView]]; - [mainWindowDelegate setDispViewDelegate:newDispViewDelegate]; - [[mainWindowDelegate displayView] setDispViewDelegate:newDispViewDelegate]; - // Init the DS emulation core. CocoaDSCore *newCore = [[[CocoaDSCore alloc] init] autorelease]; [cdsCoreController setContent:newCore]; @@ -193,14 +180,6 @@ CocoaDSController *newController = [[[CocoaDSController alloc] initWithMic:newMic] autorelease]; [newCore setCdsController:newController]; [inputPrefsView setCdsController:newController]; - [newDispViewDelegate setCdsController:newController]; - - // Init the DS displays. - CocoaDSDisplayVideo *newVideoDisplay = [[[CocoaDSDisplayVideo alloc] init] autorelease]; - [newVideoDisplay setDelegate:newDispViewDelegate]; - [newCore addOutput:newVideoDisplay]; - NSPort *guiPort = [NSPort port]; - [[NSRunLoop currentRunLoop] addPort:guiPort forMode:NSDefaultRunLoopMode]; // Init the DS speakers. CocoaDSSpeaker *newSpeaker = [[[CocoaDSSpeaker alloc] init] autorelease]; @@ -217,32 +196,27 @@ } // Start up the threads for our outputs. - [NSThread detachNewThreadSelector:@selector(runThread:) toTarget:newVideoDisplay withObject:nil]; [NSThread detachNewThreadSelector:@selector(runThread:) toTarget:newSpeaker withObject:nil]; - // Wait until the GPU and SPU are finished starting up. - while ([newVideoDisplay thread] == nil || [newSpeaker thread] == nil) + // Wait until the SPU is finished starting up. + while ([newSpeaker thread] == nil) { [NSThread sleepUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.01]]; } // Setup the applications settings from the user defaults file. [self setupUserDefaults]; - - // Setup the window display view. - [[mainWindowDelegate displayView] setNextResponder:mainWindow]; } - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { EmuControllerDelegate *emuControl = (EmuControllerDelegate *)[emuControlController content]; - EmuWindowDelegate *mainWindowDelegate = [mainWindow delegate]; // Load a new ROM on launch per user preferences. - BOOL loadROMOnLaunch = [[NSUserDefaults standardUserDefaults] boolForKey:@"General_AutoloadROMOnLaunch"]; + const BOOL loadROMOnLaunch = [[NSUserDefaults standardUserDefaults] boolForKey:@"General_AutoloadROMOnLaunch"]; if (loadROMOnLaunch && [emuControl currentRom] == nil) { - NSInteger autoloadRomOption = [[NSUserDefaults standardUserDefaults] integerForKey:@"General_AutoloadROMOption"]; + const NSInteger autoloadRomOption = [[NSUserDefaults standardUserDefaults] integerForKey:@"General_AutoloadROMOption"]; NSURL *autoloadRomURL = nil; if (autoloadRomOption == ROMAUTOLOADOPTION_LOAD_LAST) @@ -264,14 +238,9 @@ } } - // Make the display view black. - [[mainWindowDelegate dispViewDelegate] setViewToBlack]; - //Bring the application to the front [NSApp activateIgnoringOtherApps:TRUE]; - [mainWindow setTitle:(NSString *)[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleName"]]; - [mainWindow makeKeyAndOrderFront:nil]; - [mainWindow makeMainWindow]; + [emuControl newDisplayWindow:nil]; // Present the file migration window to the user (if they haven't disabled it). [self setMigrationFilesPresent:NO]; @@ -287,7 +256,7 @@ // If a file needs to be saved, give the user a chance to save it // before quitting. - BOOL didRomClose = [emuControl handleUnloadRom:REASONFORCLOSE_TERMINATE romToLoad:nil]; + const BOOL didRomClose = [emuControl handleUnloadRom:REASONFORCLOSE_TERMINATE romToLoad:nil]; if (!didRomClose) { if ([emuControl isShowingSaveStateDialog]) @@ -343,11 +312,10 @@ - (void) setupSlotMenuItems { - NSInteger i; NSMenuItem *loadItem = nil; NSMenuItem *saveItem = nil; - for(i = 0; i < MAX_SAVESTATE_SLOTS; i++) + for(NSInteger i = 0; i < MAX_SAVESTATE_SLOTS; i++) { loadItem = [self addSlotMenuItem:mLoadStateSlot slotNumber:(NSUInteger)(i + 1)]; [loadItem setKeyEquivalentModifierMask:0]; @@ -383,7 +351,6 @@ - (void) setupUserDefaults { EmuControllerDelegate *emuControl = (EmuControllerDelegate *)[emuControlController content]; - EmuWindowDelegate *mainWindowDelegate = [mainWindow delegate]; PreferencesWindowDelegate *prefWindowDelegate = [prefWindow delegate]; NSMutableDictionary *prefBindings = [prefWindowDelegate bindings]; CocoaDSCore *cdsCore = (CocoaDSCore *)[cdsCoreController content]; @@ -457,7 +424,6 @@ nil]; CocoaDSFirmware *newFirmware = [[[CocoaDSFirmware alloc] initWithDictionary:newFWDict] autorelease]; - [cdsCore setCdsFirmware:newFirmware]; [newFirmware update]; [emuControl setCdsFirmware:newFirmware]; @@ -538,13 +504,12 @@ [self updateInputDisplayFields]; // Set the menu for the display rotation. - double displayRotation = (double)[[NSUserDefaults standardUserDefaults] floatForKey:@"DisplayView_Rotation"]; + const double displayRotation = (double)[[NSUserDefaults standardUserDefaults] floatForKey:@"DisplayView_Rotation"]; [prefWindowDelegate updateDisplayRotationMenu:displayRotation]; // Set the default sound volume per user preferences. [prefWindowDelegate updateVolumeIcon:nil]; - [mainWindowDelegate setupUserDefaults]; [emuControl setupUserDefaults]; } @@ -586,15 +551,7 @@ NSMutableArray *fileList = [CocoaDSFile completeFileList]; if (fileList != nil) { - if ([fileList count] == 0) - { - [self setMigrationFilesPresent:NO]; - } - else - { - [self setMigrationFilesPresent:YES]; - } - + [self setMigrationFilesPresent:([fileList count] == 0) ? NO : YES]; if (sender == nil && ![self migrationFilesPresent]) { return; @@ -608,7 +565,7 @@ - (IBAction) handleMigrationWindow:(id)sender { - NSInteger option = [(NSControl *)sender tag]; + const NSInteger option = [(NSControl *)sender tag]; NSMutableArray *fileList = [fileMigrationList content]; switch (option) diff --git a/desmume/src/cocoa/userinterface/emuWindowDelegate.h b/desmume/src/cocoa/userinterface/emuWindowDelegate.h deleted file mode 100644 index 601295a7f..000000000 --- a/desmume/src/cocoa/userinterface/emuWindowDelegate.h +++ /dev/null @@ -1,101 +0,0 @@ -/* - Copyright (C) 2011 Roger Manuel - Copyright (C) 2011-2013 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 . -*/ - -#import - -@protocol DisplayViewDelegate; -@class DisplayViewDelegate; - - -#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_5 -@interface EmuWindowDelegate : NSObject -#else -@interface EmuWindowDelegate : NSObject -#endif -{ - NSObject *dummyObject; - NSWindow *window; - NSWindow *saveFileMigrationSheet; - NSWindow *saveStatePrecloseSheet; - NSView *displayView; - NSView *saveScreenshotPanelAccessoryView; - - DisplayViewDelegate *dispViewDelegate; - NSObjectController *cdsDisplayController; - NSObjectController *emuControlController; - NSObjectController *emuWindowController; - - BOOL isShowingStatusBar; - NSUInteger statusBarHeight; - NSSize minDisplayViewSize; - BOOL isMinSizeNormal; - NSBitmapImageFileType screenshotFileFormat; - - NSMutableDictionary *bindings; -} - -@property (readonly) IBOutlet NSObject *dummyObject; -@property (readonly) IBOutlet NSWindow *window; -@property (readonly) IBOutlet NSView *displayView; -@property (readonly) IBOutlet NSView *saveScreenshotPanelAccessoryView; - -@property (retain) DisplayViewDelegate *dispViewDelegate; -@property (readonly) IBOutlet NSObjectController *cdsDisplayController; -@property (readonly) IBOutlet NSObjectController *emuControlController; -@property (readonly) IBOutlet NSObjectController *emuWindowController; - -@property (assign) BOOL isMinSizeNormal; - -@property (readonly) NSMutableDictionary *bindings; - -- (void) setContentScalar:(double)s; -- (void) setContentRotation:(double)angleDegrees; -- (double) resizeWithTransform:(NSSize)normalBounds scalar:(double)scalar rotation:(double)angleDegrees; -- (double) maxContentScalar:(NSSize)contentBounds; - -// Edit Menu -- (IBAction) copy:(id)sender; - -// View Menu -- (IBAction) hudDisable:(id)sender; -- (IBAction) toggleKeepMinDisplaySizeAtNormal:(id)sender; -- (IBAction) toggleStatusBar:(id)sender; - -// Tools Menu -- (IBAction) selectScreenshotFileFormat:(id)sender; -- (IBAction) saveScreenshotAs:(id)sender; -- (void) saveScreenshotAsFinish:(NSNotification *)aNotification; - -- (IBAction) changeScale:(id)sender; -- (IBAction) changeRotation:(id)sender; -- (IBAction) changeRotationRelative:(id)sender; -- (IBAction) changeBilinearOutput:(id)sender; -- (IBAction) changeVerticalSync:(id)sender; -- (IBAction) changeDisplayMode:(id)sender; -- (IBAction) changeDisplayOrientation:(id)sender; -- (IBAction) changeDisplayOrder:(id)sender; -- (IBAction) changeVideoFilter:(id)sender; - -- (void) setShowStatusBar:(BOOL)showStatusBar; - -- (void) setupUserDefaults; -- (IBAction) writeDefaultsDisplayRotation:(id)sender; -- (IBAction) writeDefaultsHUDSettings:(id)sender; -- (IBAction) writeDefaultsVideoOutputSettings:(id)sender; - -@end diff --git a/desmume/src/cocoa/userinterface/emuWindowDelegate.mm b/desmume/src/cocoa/userinterface/emuWindowDelegate.mm deleted file mode 100644 index 538713cb1..000000000 --- a/desmume/src/cocoa/userinterface/emuWindowDelegate.mm +++ /dev/null @@ -1,626 +0,0 @@ -/* - Copyright (C) 2011 Roger Manuel - Copyright (C) 2011-2013 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 . -*/ - -#import "emuWindowDelegate.h" -#import "EmuControllerDelegate.h" -#import "displayView.h" - -#import "cocoa_globals.h" -#import "cocoa_file.h" -#import "cocoa_util.h" - -#undef BOOL - - -@implementation EmuWindowDelegate - -@dynamic dummyObject; -@synthesize window; -@synthesize displayView; -@synthesize saveScreenshotPanelAccessoryView; - -@synthesize dispViewDelegate; - -@synthesize cdsDisplayController; -@synthesize emuControlController; -@synthesize emuWindowController; - -@dynamic isMinSizeNormal; - -@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; - } - - dispViewDelegate = nil; - isShowingStatusBar = YES; - statusBarHeight = WINDOW_STATUS_BAR_HEIGHT; - minDisplayViewSize = NSMakeSize(GPU_DISPLAY_WIDTH, GPU_DISPLAY_HEIGHT * 2); - isMinSizeNormal = YES; - screenshotFileFormat = NSTIFFFileType; - - [bindings setValue:[NSNumber numberWithBool:YES] forKey:@"isShowingStatusBar"]; - - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(saveScreenshotAsFinish:) - name:@"org.desmume.DeSmuME.requestScreenshotDidFinish" - object:nil]; - - return self; -} - -- (void)dealloc -{ - [[NSNotificationCenter defaultCenter] removeObserver:self]; - - [self setDispViewDelegate:nil]; - [bindings release]; - - [super dealloc]; -} - -- (void) setContentScalar:(double)s -{ - // Resize the window when contentScalar changes. - // No need to set the view's scale here since window resizing will implicitly change it. - [self resizeWithTransform:[dispViewDelegate normalSize] scalar:s rotation:[dispViewDelegate rotation]]; -} - -- (void) setContentRotation:(double)angleDegrees -{ - double newAngleDegrees = fmod(angleDegrees, 360.0); - if (newAngleDegrees < 0.0) - { - newAngleDegrees = 360.0 + newAngleDegrees; - } - - if (newAngleDegrees == 360.0) - { - newAngleDegrees = 0.0; - } - - [dispViewDelegate setRotation:newAngleDegrees]; - - // Set the minimum content size for the window, since this will change based on rotation. - NSSize minContentSize = GetTransformedBounds(minDisplayViewSize, 1.0, CLOCKWISE_DEGREES(newAngleDegrees)); - minContentSize.height += statusBarHeight; - [window setContentMinSize:minContentSize]; - - // Resize the window. - const NSSize oldBounds = [window frame].size; - [self resizeWithTransform:[dispViewDelegate normalSize] scalar:[dispViewDelegate scale] rotation:newAngleDegrees]; - const NSSize newBounds = [window frame].size; - - // If the window size didn't change, it is possible that the old and new rotation angles - // are 180 degrees offset from each other. In this case, we'll need to force the - // display view to update itself. - if (oldBounds.width == newBounds.width && oldBounds.height == newBounds.height) - { - [displayView setNeedsDisplay:YES]; - } -} - -- (double) resizeWithTransform:(NSSize)normalBounds scalar:(double)scalar rotation:(double)angleDegrees -{ - // Convert angle to clockwise-direction degrees. - angleDegrees = CLOCKWISE_DEGREES(angleDegrees); - - // Get the maximum scalar size within drawBounds. Constrain scalar to maxScalar if necessary. - const NSSize checkSize = GetTransformedBounds(normalBounds, 1.0, angleDegrees); - const double maxScalar = [self maxContentScalar:checkSize]; - if (scalar > maxScalar) - { - scalar = maxScalar; - } - - // Get the new bounds for the window's content view based on the transformed draw bounds. - const NSSize transformedBounds = GetTransformedBounds(normalBounds, scalar, angleDegrees); - - // Get the center of the content view in screen coordinates. - const NSRect windowContentRect = [[window contentView] bounds]; - const double translationX = (windowContentRect.size.width - transformedBounds.width) / 2.0; - const double translationY = ((windowContentRect.size.height - statusBarHeight) - transformedBounds.height) / 2.0; - - // Resize the window. - const NSRect windowFrame = [window frame]; - const NSRect newFrame = [window frameRectForContentRect:NSMakeRect(windowFrame.origin.x + translationX, windowFrame.origin.y + translationY, transformedBounds.width, transformedBounds.height + statusBarHeight)]; - [window setFrame:newFrame display:YES animate:NO]; - - // Return the actual scale used for the view (may be constrained). - return scalar; -} - -- (double) maxContentScalar:(NSSize)contentBounds -{ - // Determine the maximum scale based on the visible screen size (which - // doesn't include the menu bar or dock). - const NSRect screenFrame = [[NSScreen mainScreen] visibleFrame]; - const NSRect windowFrame = [window frameRectForContentRect:NSMakeRect(0.0, 0.0, contentBounds.width, contentBounds.height + statusBarHeight)]; - const NSSize visibleScreenBounds = { (screenFrame.size.width - (windowFrame.size.width - contentBounds.width)), (screenFrame.size.height - (windowFrame.size.height - contentBounds.height)) }; - - return GetMaxScalarInBounds(contentBounds.width, contentBounds.height, visibleScreenBounds.width, visibleScreenBounds.height); -} - -- (void) setIsMinSizeNormal:(BOOL)theState -{ - isMinSizeNormal = theState; - - if ([dispViewDelegate displayMode] == DS_DISPLAY_TYPE_COMBO) - { - if ([dispViewDelegate displayOrientation] == DS_DISPLAY_ORIENTATION_HORIZONTAL) - { - minDisplayViewSize.width = GPU_DISPLAY_WIDTH * 2; - minDisplayViewSize.height = GPU_DISPLAY_HEIGHT; - } - else - { - minDisplayViewSize.width = GPU_DISPLAY_WIDTH; - minDisplayViewSize.height = GPU_DISPLAY_HEIGHT * 2; - } - } - else - { - minDisplayViewSize.width = GPU_DISPLAY_WIDTH; - minDisplayViewSize.height = GPU_DISPLAY_HEIGHT; - } - - if (!isMinSizeNormal) - { - minDisplayViewSize.width /= 4; - minDisplayViewSize.height /= 4; - } - - // Set the minimum content size, keeping the display rotation in mind. - NSSize transformedMinSize = GetTransformedBounds(minDisplayViewSize, 1.0, CLOCKWISE_DEGREES([dispViewDelegate rotation])); - transformedMinSize.height += statusBarHeight; - [window setContentMinSize:transformedMinSize]; -} - -- (BOOL) isMinSizeNormal -{ - return isMinSizeNormal; -} - -- (IBAction)copy:(id)sender -{ - [dispViewDelegate copyToPasteboard]; -} - -- (IBAction) changeScale:(id)sender -{ - [self setContentScalar:(double)[CocoaDSUtil getIBActionSenderTag:sender] / 100.0]; -} - -- (IBAction) changeRotation:(id)sender -{ - // Get the rotation value from the sender. - if ([sender isMemberOfClass:[NSSlider class]]) - { - [self setContentRotation:[(NSSlider *)sender doubleValue]]; - } - else - { - [self setContentRotation:(double)[CocoaDSUtil getIBActionSenderTag:sender]]; - } -} - -- (IBAction) changeRotationRelative:(id)sender -{ - const double angleDegrees = [dispViewDelegate rotation] + (double)[CocoaDSUtil getIBActionSenderTag:sender]; - [self setContentRotation:angleDegrees]; -} - -- (IBAction) changeBilinearOutput:(id)sender -{ - [dispViewDelegate setUseBilinearOutput:[CocoaDSUtil getIBActionSenderButtonStateBool:sender]]; -} - -- (IBAction) changeVerticalSync:(id)sender -{ - [dispViewDelegate setUseVerticalSync:[CocoaDSUtil getIBActionSenderButtonStateBool:sender]]; -} - -- (IBAction) changeDisplayMode:(id)sender -{ - const NSInteger newDisplayModeID = [CocoaDSUtil getIBActionSenderTag:sender]; - - if (newDisplayModeID == [dispViewDelegate displayMode]) - { - return; - } - - [dispViewDelegate setDisplayMode:newDisplayModeID]; - [self resizeWithTransform:[dispViewDelegate normalSize] scalar:[dispViewDelegate scale] rotation:[dispViewDelegate rotation]]; -} - -- (IBAction) changeDisplayOrientation:(id)sender -{ - const NSInteger newDisplayOrientation = [CocoaDSUtil getIBActionSenderTag:sender]; - - if (newDisplayOrientation == [dispViewDelegate displayOrientation]) - { - return; - } - - [dispViewDelegate setDisplayOrientation:newDisplayOrientation]; - [self setIsMinSizeNormal:[self isMinSizeNormal]]; - [self resizeWithTransform:[dispViewDelegate normalSize] scalar:[dispViewDelegate scale] rotation:[dispViewDelegate rotation]]; -} - -- (IBAction) changeDisplayOrder:(id)sender -{ - [dispViewDelegate setDisplayOrder:[CocoaDSUtil getIBActionSenderTag:sender]]; -} - -- (IBAction) changeVideoFilter:(id)sender -{ - [dispViewDelegate setVideoFilterType:[CocoaDSUtil getIBActionSenderTag:sender]]; -} - -- (IBAction) hudDisable:(id)sender -{ - EmuControllerDelegate *emuControl = (EmuControllerDelegate *)[emuControlController content]; - - if ([dispViewDelegate isHudEnabled]) - { - [dispViewDelegate setIsHudEnabled:NO]; - [emuControl setStatusText:NSSTRING_STATUS_HUD_DISABLED]; - } - else - { - [dispViewDelegate setIsHudEnabled:YES]; - [emuControl setStatusText:NSSTRING_STATUS_HUD_ENABLED]; - } -} - -- (IBAction) toggleKeepMinDisplaySizeAtNormal:(id)sender -{ - if ([self isMinSizeNormal]) - { - [self setIsMinSizeNormal:NO]; - } - else - { - [self setIsMinSizeNormal:YES]; - - // Set the minimum content size, keeping the display rotation in mind. - NSSize transformedMinSize = GetTransformedBounds(minDisplayViewSize, 1.0, CLOCKWISE_DEGREES([dispViewDelegate rotation])); - transformedMinSize.height += statusBarHeight; - - // Resize the window if it's smaller than the minimum content size. - NSRect windowContentRect = [window contentRectForFrameRect:[window frame]]; - if (windowContentRect.size.width < transformedMinSize.width || windowContentRect.size.height < transformedMinSize.height) - { - // Prepare to resize. - NSRect oldFrameRect = [window frame]; - windowContentRect.size = transformedMinSize; - NSRect newFrameRect = [window frameRectForContentRect:windowContentRect]; - - // Keep the window centered when expanding the size. - newFrameRect.origin.x = oldFrameRect.origin.x - ((newFrameRect.size.width - oldFrameRect.size.width) / 2); - newFrameRect.origin.y = oldFrameRect.origin.y - ((newFrameRect.size.height - oldFrameRect.size.height) / 2); - - // Set the window size. - [window setFrame:newFrameRect display:YES animate:NO]; - } - } -} - -- (IBAction) toggleStatusBar:(id)sender -{ - [self setShowStatusBar:(isShowingStatusBar) ? NO : YES]; -} - -- (void) setShowStatusBar:(BOOL)showStatusBar -{ - NSRect frameRect = [window frame]; - - if (showStatusBar) - { - statusBarHeight = WINDOW_STATUS_BAR_HEIGHT; - frameRect.size.height += WINDOW_STATUS_BAR_HEIGHT; - - NSRect screenFrame = [[NSScreen mainScreen] visibleFrame]; - if (frameRect.size.height > screenFrame.size.height) - { - NSRect windowContentRect = [[window contentView] bounds]; - double widthToHeightRatio = windowContentRect.size.width / windowContentRect.size.height; - windowContentRect.size.height -= frameRect.size.height - screenFrame.size.height; - windowContentRect.size.width = windowContentRect.size.height * widthToHeightRatio; - - frameRect.size.height = screenFrame.size.height; - frameRect.size.width = windowContentRect.size.width; - } - else - { - frameRect.origin.y -= WINDOW_STATUS_BAR_HEIGHT; - } - } - else - { - statusBarHeight = 0; - frameRect.origin.y += WINDOW_STATUS_BAR_HEIGHT; - frameRect.size.height -= WINDOW_STATUS_BAR_HEIGHT; - } - - isShowingStatusBar = showStatusBar; - [[self bindings] setValue:[NSNumber numberWithBool:showStatusBar] forKey:@"isShowingStatusBar"]; - [[NSUserDefaults standardUserDefaults] setBool:showStatusBar forKey:@"DisplayView_ShowStatusBar"]; - [window setFrame:frameRect display:YES animate:NO]; -} - -- (IBAction) selectScreenshotFileFormat:(id)sender -{ - screenshotFileFormat = (NSBitmapImageFileType)[CocoaDSUtil getIBActionSenderTag:sender]; -} - -- (IBAction) saveScreenshotAs:(id)sender -{ - EmuControllerDelegate *emuControl = (EmuControllerDelegate *)[emuControlController content]; - - [emuControl pauseCore]; - - NSSavePanel *panel = [NSSavePanel savePanel]; - [panel setCanCreateDirectories:YES]; - [panel setTitle:NSSTRING_TITLE_SAVE_SCREENSHOT_PANEL]; - [panel setAccessoryView:saveScreenshotPanelAccessoryView]; - - const NSInteger buttonClicked = [panel runModal]; - if(buttonClicked == NSOKButton) - { - [dispViewDelegate requestScreenshot:[panel URL] fileType:screenshotFileFormat]; - } - else - { - [emuControl restoreCoreState]; - } -} - -- (void) saveScreenshotAsFinish:(NSNotification *)aNotification -{ - EmuControllerDelegate *emuControl = (EmuControllerDelegate *)[emuControlController content]; - NSURL *fileURL = (NSURL *)[[aNotification userInfo] valueForKey:@"fileURL"]; - NSBitmapImageFileType fileType = (NSBitmapImageFileType)[(NSNumber *)[[aNotification userInfo] valueForKey:@"fileType"] integerValue]; - NSImage *screenshotImage = (NSImage *)[[aNotification userInfo] valueForKey:@"screenshotImage"]; - - const BOOL fileSaved = [CocoaDSFile saveScreenshot:fileURL bitmapData:[[screenshotImage representations] objectAtIndex:0] fileType:fileType]; - if (!fileSaved) - { - [CocoaDSUtil quickDialogUsingTitle:NSSTRING_ERROR_TITLE_LEGACY message:NSSTRING_ERROR_SCREENSHOT_FAILED_LEGACY]; - } - - [emuControl restoreCoreState]; -} - -- (BOOL)validateUserInterfaceItem:(id )theItem -{ - BOOL enable = YES; - const SEL theAction = [theItem action]; - - if (theAction == @selector(changeScale:)) - { - const NSInteger viewScale = (NSInteger)([dispViewDelegate scale] * 100.0); - - if ([(id)theItem isMemberOfClass:[NSMenuItem class]]) - { - [(NSMenuItem*)theItem setState:(viewScale == [theItem tag]) ? NSOnState : NSOffState]; - } - } - else if (theAction == @selector(changeRotation:)) - { - NSInteger viewRotation = (NSInteger)([dispViewDelegate rotation]); - - if ([(id)theItem isMemberOfClass:[NSMenuItem class]]) - { - if ([theItem tag] == -1) - { - if (viewRotation == 0 || - viewRotation == 90 || - viewRotation == 180 || - viewRotation == 270) - { - [(NSMenuItem*)theItem setState:NSOffState]; - } - else - { - [(NSMenuItem*)theItem setState:NSOnState]; - } - } - else if (viewRotation == [theItem tag]) - { - [(NSMenuItem*)theItem setState:NSOnState]; - } - else - { - [(NSMenuItem*)theItem setState:NSOffState]; - } - } - } - else if (theAction == @selector(changeDisplayMode:)) - { - if ([(id)theItem isMemberOfClass:[NSMenuItem class]]) - { - [(NSMenuItem*)theItem setState:([dispViewDelegate displayMode] == [theItem tag]) ? NSOnState : NSOffState]; - } - } - else if (theAction == @selector(changeDisplayOrientation:)) - { - if ([(id)theItem isMemberOfClass:[NSMenuItem class]]) - { - [(NSMenuItem*)theItem setState:([dispViewDelegate displayOrientation] == [theItem tag]) ? NSOnState : NSOffState]; - } - } - else if (theAction == @selector(changeDisplayOrder:)) - { - if ([(id)theItem isMemberOfClass:[NSMenuItem class]]) - { - [(NSMenuItem*)theItem setState:([dispViewDelegate displayOrder] == [theItem tag]) ? NSOnState : NSOffState]; - } - } - else if (theAction == @selector(hudDisable:)) - { - if ([(id)theItem isMemberOfClass:[NSMenuItem class]]) - { - [(NSMenuItem*)theItem setTitle:([dispViewDelegate isHudEnabled]) ? NSSTRING_TITLE_DISABLE_HUD : NSSTRING_TITLE_ENABLE_HUD]; - } - } - else if (theAction == @selector(toggleStatusBar:)) - { - if ([(id)theItem isMemberOfClass:[NSMenuItem class]]) - { - [(NSMenuItem*)theItem setTitle:(isShowingStatusBar) ? NSSTRING_TITLE_HIDE_STATUS_BAR : NSSTRING_TITLE_SHOW_STATUS_BAR]; - } - } - else if (theAction == @selector(toggleKeepMinDisplaySizeAtNormal:)) - { - if ([(id)theItem isMemberOfClass:[NSMenuItem class]]) - { - [(NSMenuItem*)theItem setState:(isMinSizeNormal) ? NSOnState : NSOffState]; - } - } - - return enable; -} - -- (void)windowDidBecomeMain:(NSNotification *)notification -{ - [emuWindowController setContent:[self bindings]]; - [cdsDisplayController setContent:[dispViewDelegate bindings]]; -} - -- (NSSize)windowWillResize:(NSWindow *)sender toSize:(NSSize)frameSize -{ - // Get a content Rect so that we can make our comparison. - // This will be based on the proposed frameSize. - const NSRect frameRect = NSMakeRect(0.0f, 0.0f, frameSize.width, frameSize.height); - const NSRect contentRect = [sender contentRectForFrameRect:frameRect]; - - // Find the maximum scalar we can use for the display view, bounded by the - // content Rect. - const NSSize checkSize = GetTransformedBounds([dispViewDelegate normalSize], 1.0, [dispViewDelegate rotation]); - const NSSize contentBounds = NSMakeSize(contentRect.size.width, contentRect.size.height - statusBarHeight); - const double maxS = GetMaxScalarInBounds(checkSize.width, checkSize.height, contentBounds.width, contentBounds.height); - - // Make a new content Rect with our max scalar, and convert it back to a frame Rect. - const NSRect finalContentRect = NSMakeRect(0.0f, 0.0f, checkSize.width * maxS, (checkSize.height * maxS) + statusBarHeight); - const NSRect finalFrameRect = [sender frameRectForContentRect:finalContentRect]; - - // Set the final size based on our new frame Rect. - const NSSize finalSize = {finalFrameRect.size.width, finalFrameRect.size.height}; - - return finalSize; -} - -- (void)windowDidResize:(NSNotification *)notification -{ - if (dispViewDelegate == nil) - { - return; - } - - // Get the max scalar within the window's current content bounds. - const NSSize checkSize = GetTransformedBounds([dispViewDelegate normalSize], 1.0, [dispViewDelegate rotation]); - NSSize contentBounds = [[window contentView] bounds].size; - contentBounds.height -= statusBarHeight; - const double maxS = GetMaxScalarInBounds(checkSize.width, checkSize.height, contentBounds.width, contentBounds.height); - - // Set the display view's properties. - [dispViewDelegate setScale:maxS]; - - // Resize the view. - NSRect newContentFrame = [[window contentView] bounds]; - newContentFrame.origin.y = statusBarHeight; - newContentFrame.size.height -= statusBarHeight; - [displayView setFrame:newContentFrame]; -} - -- (BOOL)windowShouldClose:(id)sender -{ - BOOL shouldClose = YES; - EmuControllerDelegate *emuControl = (EmuControllerDelegate *)[emuControlController content]; - - // If no ROM is loaded, terminate the application. - if ([emuControl currentRom] == nil) - { - [NSApp terminate:sender]; - } - // If a ROM is loaded, just close the ROM, but don't terminate. - else - { - shouldClose = NO; - [emuControl closeRom:nil]; - } - - return shouldClose; -} - -- (void) setupUserDefaults -{ - // Set the display window per user preferences. - [self setShowStatusBar:[[NSUserDefaults standardUserDefaults] boolForKey:@"DisplayView_ShowStatusBar"]]; - - // Set the display settings per user preferences. - const double displayScalar = (double)([[NSUserDefaults standardUserDefaults] floatForKey:@"DisplayView_Size"] / 100.0); - const double displayRotation = (double)[[NSUserDefaults standardUserDefaults] floatForKey:@"DisplayView_Rotation"]; - [dispViewDelegate setDisplayMode:[[NSUserDefaults standardUserDefaults] integerForKey:@"DisplayView_Mode"]]; - [dispViewDelegate setDisplayOrientation:[[NSUserDefaults standardUserDefaults] integerForKey:@"DisplayViewCombo_Orientation"]]; - [dispViewDelegate setDisplayOrder:[[NSUserDefaults standardUserDefaults] integerForKey:@"DisplayViewCombo_Order"]]; - [self setContentScalar:displayScalar]; - [self setContentRotation:displayRotation]; - - // Setup the window display view per user preferences. - [[self dispViewDelegate] setVideoFilterType:[[NSUserDefaults standardUserDefaults] integerForKey:@"DisplayView_VideoFilter"]]; - [[self dispViewDelegate] setUseBilinearOutput:[[NSUserDefaults standardUserDefaults] boolForKey:@"DisplayView_UseBilinearOutput"]]; - [[self dispViewDelegate] setUseVerticalSync:[[NSUserDefaults standardUserDefaults] boolForKey:@"DisplayView_UseVerticalSync"]]; -} - -- (IBAction) writeDefaultsDisplayRotation:(id)sender -{ - NSMutableDictionary *dispViewBindings = (NSMutableDictionary *)[cdsDisplayController content]; - - [[NSUserDefaults standardUserDefaults] setDouble:[[dispViewBindings valueForKey:@"rotation"] doubleValue] forKey:@"DisplayView_Rotation"]; -} - -- (IBAction) writeDefaultsHUDSettings:(id)sender -{ - // TODO: Not implemented. -} - -- (IBAction) writeDefaultsVideoOutputSettings:(id)sender -{ - NSMutableDictionary *dispViewBindings = (NSMutableDictionary *)[cdsDisplayController content]; - - [[NSUserDefaults standardUserDefaults] setInteger:[[dispViewBindings valueForKey:@"videoFilterType"] integerValue] forKey:@"DisplayView_VideoFilter"]; - [[NSUserDefaults standardUserDefaults] setBool:[[dispViewBindings valueForKey:@"useBilinearOutput"] boolValue] forKey:@"DisplayView_UseBilinearOutput"]; - [[NSUserDefaults standardUserDefaults] setBool:[[dispViewBindings valueForKey:@"useVerticalSync"] boolValue] forKey:@"DisplayView_UseVerticalSync"]; -} - -@end diff --git a/desmume/src/cocoa/userinterface/preferencesWindowDelegate.h b/desmume/src/cocoa/userinterface/preferencesWindowDelegate.h index 662905cfa..efe514ab0 100644 --- a/desmume/src/cocoa/userinterface/preferencesWindowDelegate.h +++ b/desmume/src/cocoa/userinterface/preferencesWindowDelegate.h @@ -1,6 +1,6 @@ /* Copyright (C) 2011 Roger Manuel - Copyright (C) 2012 DeSmuME team + Copyright (C) 2012-2013 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 @@ -32,7 +32,7 @@ NSWindow *window; NSWindow *firmwareConfigSheet; NSObjectController *cdsCoreController; - NSObjectController *emuWindowController; + NSObjectController *emuController; NSObjectController *prefWindowController; NSObjectController *cheatWindowController; NSArrayController *cheatDatabaseController; @@ -64,7 +64,7 @@ @property (readonly) IBOutlet NSWindow *window; @property (readonly) IBOutlet NSWindow *firmwareConfigSheet; @property (readonly) IBOutlet NSObjectController *cdsCoreController; -@property (readonly) IBOutlet NSObjectController *emuWindowController; +@property (readonly) IBOutlet NSObjectController *emuController; @property (readonly) IBOutlet NSObjectController *prefWindowController; @property (readonly) IBOutlet NSObjectController *cheatWindowController; @property (readonly) IBOutlet NSArrayController *cheatDatabaseController; diff --git a/desmume/src/cocoa/userinterface/preferencesWindowDelegate.mm b/desmume/src/cocoa/userinterface/preferencesWindowDelegate.mm index 19a1ef2c0..a0ad3e13f 100644 --- a/desmume/src/cocoa/userinterface/preferencesWindowDelegate.mm +++ b/desmume/src/cocoa/userinterface/preferencesWindowDelegate.mm @@ -1,6 +1,6 @@ /* Copyright (C) 2011 Roger Manuel - Copyright (C) 2012 DeSmuME team + Copyright (C) 2012-2013 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 @@ -17,7 +17,7 @@ */ #import "preferencesWindowDelegate.h" -#import "displayView.h" +#import "EmuControllerDelegate.h" #import "cocoa_core.h" #import "cocoa_cheat.h" @@ -35,7 +35,7 @@ @synthesize window; @synthesize firmwareConfigSheet; @synthesize cdsCoreController; -@synthesize emuWindowController; +@synthesize emuController; @synthesize prefWindowController; @synthesize cheatWindowController; @synthesize cheatDatabaseController; @@ -320,7 +320,7 @@ [[NSUserDefaults standardUserDefaults] setObject:selectedFile forKey:@"R4Cheat_DatabasePath"]; [bindings setValue:[selectedFile lastPathComponent] forKey:@"R4CheatDatabaseName"]; - const BOOL isRomLoaded = [(NSNumber *)[(NSMutableDictionary *)[emuWindowController content] valueForKey:@"isRomLoaded"] boolValue]; + const BOOL isRomLoaded = [(EmuControllerDelegate *)[emuController content] currentRom] != nil; NSMutableDictionary *cheatWindowBindings = (NSMutableDictionary *)[cheatWindowController content]; CocoaDSCheatManager *cdsCheats = (CocoaDSCheatManager *)[cheatWindowBindings valueForKey:@"cheatList"];