From 3cff5390f83f75e9712b56d01cb1f0de22305a88 Mon Sep 17 00:00:00 2001 From: rogerman Date: Sat, 7 Sep 2013 23:03:42 +0000 Subject: [PATCH] Cocoa Port: - New feature: If the user quits DeSmuME while display windows remain, the user has the option to restore the display windows on app launch. --- desmume/src/cocoa/DefaultUserPrefs.plist | Bin 5306 -> 5400 bytes .../English.lproj/MainMenu.strings | Bin 294806 -> 295116 bytes .../translations/English.lproj/MainMenu.xib | 200 ++++++++++++++---- .../userinterface/DisplayWindowController.h | 2 +- .../userinterface/DisplayWindowController.mm | 53 +++-- .../userinterface/EmuControllerDelegate.mm | 5 +- desmume/src/cocoa/userinterface/appDelegate.h | 2 + .../src/cocoa/userinterface/appDelegate.mm | 159 +++++++++++++- 8 files changed, 353 insertions(+), 68 deletions(-) diff --git a/desmume/src/cocoa/DefaultUserPrefs.plist b/desmume/src/cocoa/DefaultUserPrefs.plist index 2146924dbc1a472662cf63323f0b4839c71b6884..0142877f66f3da0667ee569e37448d4462f1b28b 100644 GIT binary patch delta 1851 zcmY+B4_H>!9mjva`~Eri-?`_U3jz6Wz`!Y)(6m{y6cEAcEreI%QRWEoV)VQUgV&jJ zLgk+VolY;NRt7jrr?fw!<g-{<@N zKIfeK+UQLg+MK#jO+z><>lDvfr!8yBgDLLFhpCVYh3<&VgR4Bqb5}($9g1U}(wHJQ zrkV}kcQrjx-A&dLWszOPU+Ve?b8e>RVwKB^T#}2`6}-!b*-~msp|!xOuMAa`)r3MN zRztY9-pa3Os0&ptE~{BEw{}rO*CbCbj!eI)`#(5nsGJkBg5k=r)zHO!S&}`8B--WV zuE|T_$FLNd!G`DIMfe503J2XIN5&E8gOA+$Pxu#lQHLH(i1aZ9Gu-(*I2orwk9~w> z+hgQZZAxw3;^bgey=5)1XUapT&z}02Rkbi|WlpbL*kBb09tv6^t14XnK%`f?V7^<5 zXU+^-;pAYQWz8+loe{9A!xfwbYAfd^M^Bm@4Aq8<^GfrrISc36N91qZ9t_mXt>Ez` zwULV?$8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WZY!%zYcCkb36uZQ3@x15| ed&CQ(Q|uL8V!t@x{7jtYat%hR7>qxR!u}t`0P?p0 diff --git a/desmume/src/cocoa/translations/English.lproj/MainMenu.strings b/desmume/src/cocoa/translations/English.lproj/MainMenu.strings index 676a414c017ef2903c6747c269f188bbbe10f380..e42ab569703723fdfafb15ab2421fe7fc723a2ba 100644 GIT binary patch delta 261 zcmbRCU+_$$(1wZ}?o@^fhE#@RhEj%->G`aTlHBDC89;$N1_g$k$+5Yz)A`I1%$aOhDLVa;Hlxwx2NeMbuEgXF zF^A>_mF){E8G)Dyh?%!9sAT!ZI(ny!x=JwLU{}d3_g=%b7d#btCE@g zAjgk@(#^5C-dxi!JY(XR9+Ji^F!@Az&}4__P>xka4x`Ux`$|#%P=*4Ae2C!;i43LF z_ct=BPF_&WHu+117et95ni7V*$&PC^Ctp||1X9=hq_X` 1050 - 12D78 + 12E55 851 - 1187.37 + 1187.39 626.00 com.apple.InterfaceBuilder.CocoaPlugin @@ -2688,7 +2688,7 @@ YES - + 268 YES @@ -2707,6 +2707,7 @@ 268 {{175, 50}, {199, 21}} + YES 613417024 @@ -2725,6 +2726,7 @@ 268 {{376, 43}, {96, 32}} + YES 67108864 @@ -2746,6 +2748,7 @@ 268 {{15, 53}, {155, 17}} + YES 68157504 @@ -2763,6 +2766,7 @@ 268 {{15, 14}, {454, 28}} + YES 69206017 @@ -2779,10 +2783,12 @@ L3d3dy5hZHZhbnNjZW5lLmNvbS9vZmZsaW5lL2RhdGFzL0FEVkFOc0NFbmVfUlRvb2xEUy56aXA {{1, 1}, {484, 81}} + {{17, 16}, {486, 97}} + {0, 0} 67108864 @@ -2821,6 +2827,7 @@ L3d3dy5hZHZhbnNjZW5lLmNvbS9vZmZsaW5lL2RhdGFzL0FEVkFOc0NFbmVfUlRvb2xEUy56aXA268 {{148, 14}, {226, 21}} + YES 613417024 @@ -2839,6 +2846,7 @@ L3d3dy5hZHZhbnNjZW5lLmNvbS9vZmZsaW5lL2RhdGFzL0FEVkFOc0NFbmVfUlRvb2xEUy56aXA268 {{376, 7}, {96, 32}} + YES 67108864 @@ -2860,6 +2868,7 @@ L3d3dy5hZHZhbnNjZW5lLmNvbS9vZmZsaW5lL2RhdGFzL0FEVkFOc0NFbmVfUlRvb2xEUy56aXA268 {{15, 17}, {128, 17}} + YES 68157504 @@ -2875,10 +2884,12 @@ L3d3dy5hZHZhbnNjZW5lLmNvbS9vZmZsaW5lL2RhdGFzL0FEVkFOc0NFbmVfUlRvb2xEUy56aXA {{1, 1}, {484, 45}} + {{17, 117}, {486, 61}} + {0, 0} 67108864 @@ -2912,6 +2923,7 @@ L3d3dy5hZHZhbnNjZW5lLmNvbS9vZmZsaW5lL2RhdGFzL0FEVkFOc0NFbmVfUlRvb2xEUy56aXA268 {{92, 12}, {314, 18}} + YES 67108864 @@ -2940,6 +2952,7 @@ L3d3dy5hZHZhbnNjZW5lLmNvbS9vZmZsaW5lL2RhdGFzL0FEVkFOc0NFbmVfUlRvb2xEUy56aXA268 {{141, 33}, {217, 32}} + YES 67108864 @@ -2959,10 +2972,12 @@ L3d3dy5hZHZhbnNjZW5lLmNvbS9vZmZsaW5lL2RhdGFzL0FEVkFOc0NFbmVfUlRvb2xEUy56aXA {{1, 1}, {484, 75}} + {{17, 182}, {486, 91}} + {0, 0} 67108864 @@ -2996,11 +3011,12 @@ L3d3dy5hZHZhbnNjZW5lLmNvbS9vZmZsaW5lL2RhdGFzL0FEVkFOc0NFbmVfUlRvb2xEUy56aXA268 {{16, 111}, {366, 18}} + YES -2080374784 0 - Automatically Execute Emulation When Loading a ROM + Automatically execute emulation when loading a ROM 1211912448 @@ -3014,16 +3030,41 @@ L3d3dy5hZHZhbnNjZW5lLmNvbS9vZmZsaW5lL2RhdGFzL0FEVkFOc0NFbmVfUlRvb2xEUy56aXA NO + + + 268 + {{16, 133}, {247, 18}} + + + YES + + -2080374784 + 0 + Restore display windows on startup + + + 1211912448 + 2 + + + + + 200 + 25 + + NO + 268 - {{16, 71}, {274, 18}} + {{16, 71}, {254, 18}} + YES 67108864 0 - Automatically Load a ROM Upon Launch + Automatically load a ROM on startup 1211912448 @@ -3042,6 +3083,7 @@ L3d3dy5hZHZhbnNjZW5lLmNvbS9vZmZsaW5lL2RhdGFzL0FEVkFOc0NFbmVfUlRvb2xEUy56aXA268 {{34, 41}, {227, 26}} + YES -2076180416 @@ -3099,6 +3141,7 @@ L3d3dy5hZHZhbnNjZW5lLmNvbS9vZmZsaW5lL2RhdGFzL0FEVkFOc0NFbmVfUlRvb2xEUy56aXA268 {{114, 14}, {260, 21}} + YES 613417024 @@ -3117,6 +3160,7 @@ L3d3dy5hZHZhbnNjZW5lLmNvbS9vZmZsaW5lL2RhdGFzL0FEVkFOc0NFbmVfUlRvb2xEUy56aXA268 {{376, 7}, {96, 32}} + YES 67108864 @@ -3138,6 +3182,7 @@ L3d3dy5hZHZhbnNjZW5lLmNvbS9vZmZsaW5lL2RhdGFzL0FEVkFOc0NFbmVfUlRvb2xEUy56aXA268 {{15, 17}, {94, 17}} + YES 68157504 @@ -3151,17 +3196,19 @@ L3d3dy5hZHZhbnNjZW5lLmNvbS9vZmZsaW5lL2RhdGFzL0FEVkFOc0NFbmVfUlRvb2xEUy56aXANO - {{1, 1}, {484, 137}} + {{1, 1}, {484, 159}} + - {{17, 277}, {486, 153}} + {{17, 277}, {486, 175}} + {0, 0} 67108864 0 - ROM Behavior + General Behavior @@ -3176,7 +3223,9 @@ L3d3dy5hZHZhbnNjZW5lLmNvbS9vZmZsaW5lL2RhdGFzL0FEVkFOc0NFbmVfUlRvb2xEUy56aXANO - {520, 450} + {520, 472} + + NSView @@ -14002,7 +14051,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA {1.7976931348623157e+308, 1.7976931348623157e+308} - + 256 YES @@ -14011,7 +14060,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 268 {{14, 12}, {168, 32}} - YES 67108864 @@ -14033,7 +14081,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 268 {{181, 22}, {105, 17}} - YES 68157504 @@ -14051,7 +14098,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 12 {{12, 51}, {616, 5}} - {0, 0} 67108864 @@ -14074,7 +14120,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 268 {{288, 22}, {330, 17}} - YES 70254657 @@ -14103,7 +14148,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 268 {{18, 14}, {260, 128}} - YES NO 5 @@ -14336,7 +14380,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 268 {{85, 15}, {409, 21}} - YES 78643265 @@ -14356,7 +14399,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 268 {{496, 8}, {96, 32}} - YES 67108864 @@ -14378,7 +14420,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 268 {{15, 150}, {482, 28}} - YES 67108864 @@ -14399,7 +14440,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 268 {{496, 146}, {96, 32}} - YES 67108864 @@ -14419,12 +14459,10 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA {{1, 1}, {604, 188}} - {{17, 140}, {606, 204}} - {0, 0} 67108864 @@ -14470,7 +14508,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA {{18, 16}, {30, 30}} - YES 134217728 @@ -14489,7 +14526,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 265 {{50, 18}, {168, 28}} - YES 69206017 @@ -14507,7 +14543,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 1292 {{18, 14}, {32, 32}} - 28682 100 @@ -14516,7 +14551,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 268 {{220, 17}, {201, 26}} - YES -2076180416 @@ -14623,12 +14657,10 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA {{1, 1}, {604, 56}} - {{17, 64}, {606, 72}} - {0, 0} 67108864 @@ -14649,8 +14681,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA {640, 355} - - {{0, 0}, {1920, 1178}} {1.7976931348623157e+308, 1.7976931348623157e+308} @@ -23151,6 +23181,11 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA YES + + YES + General_WillRestoreWindows + General_WillRestoreDisplayWindows + YES @@ -32951,6 +32986,22 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 8299 + + + value: values.General_WillRestoreDisplayWindows + + + + + + value: values.General_WillRestoreDisplayWindows + value + values.General_WillRestoreDisplayWindows + 2 + + + 8306 + @@ -34617,12 +34668,13 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA YES + - + @@ -44847,6 +44899,20 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA + + 8302 + + + YES + + + + + + 8303 + + + @@ -44899,6 +44965,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 1298.IBPluginDependency 1299.IBAttributePlaceholdersKey 1299.IBPluginDependency + 1299.IBViewBoundsToFrameTransform 130.IBPluginDependency 1300.IBPluginDependency 131.IBPluginDependency @@ -44926,14 +44993,19 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 1531.IBPluginDependency 1532.IBPluginDependency 1538.IBPluginDependency + 1538.IBViewBoundsToFrameTransform 1539.IBPluginDependency + 1539.IBViewBoundsToFrameTransform 1540.IBPluginDependency 1541.IBPluginDependency + 1541.IBViewBoundsToFrameTransform 1542.IBPluginDependency + 1543.IBEditorWindowLastContentRect 1543.IBPluginDependency 1544.IBPluginDependency 1545.IBPluginDependency 1547.IBPluginDependency + 1547.IBViewBoundsToFrameTransform 1548.IBPluginDependency 1577.IBAttributePlaceholdersKey 1577.IBPluginDependency @@ -45046,6 +45118,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 2299.IBPluginDependency 23.IBPluginDependency 2320.IBPluginDependency + 2320.IBViewBoundsToFrameTransform 2321.IBPluginDependency 2327.IBPluginDependency 2328.IBPluginDependency @@ -45235,6 +45308,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 3061.IBPluginDependency 3062.IBPluginDependency 3063.IBPluginDependency + 3063.IBViewBoundsToFrameTransform 3146.IBPluginDependency 3148.IBPluginDependency 3204.IBPluginDependency @@ -45248,6 +45322,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 3213.IBPluginDependency 3214.IBPluginDependency 3285.IBPluginDependency + 3285.IBViewBoundsToFrameTransform 3286.IBPluginDependency 3456.IBPluginDependency 3456.IBWindowTemplateEditedContentRect @@ -45771,6 +45846,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 4947.IBPluginDependency 5.IBPluginDependency 5003.IBPluginDependency + 5003.IBViewBoundsToFrameTransform 5004.IBPluginDependency 5005.IBPluginDependency 5006.IBPluginDependency @@ -45821,6 +45897,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 5168.IBPluginDependency 5169.IBPluginDependency 5171.IBPluginDependency + 5171.IBViewBoundsToFrameTransform 5172.IBPluginDependency 5173.IBPluginDependency 5174.IBPluginDependency @@ -46600,6 +46677,10 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 8295.IBPluginDependency 83.IBPluginDependency 830.IBPluginDependency + 8302.IBAttributePlaceholdersKey + 8302.IBPluginDependency + 8302.IBViewBoundsToFrameTransform + 8303.IBPluginDependency 831.IBPluginDependency 832.IBPluginDependency 833.IBPluginDependency @@ -46760,7 +46841,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - {{343, 372}, {520, 450}} + {{296, 505}, {520, 472}} com.apple.InterfaceBuilder.CocoaPlugin YES @@ -46770,6 +46851,9 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA com.apple.InterfaceBuilder.CocoaPlugin + + P4AAAL+AAABBgAAAwv4AAA + com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -46811,14 +46895,27 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin + + AUGIAABDqAAAA + + com.apple.InterfaceBuilder.CocoaPlugin + + P4AAAL+AAABBgAAAwq4AAA + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + P4AAAL+AAABCCAAAwoIAAA + + com.apple.InterfaceBuilder.CocoaPlugin + {{537, 693}, {227, 43}} 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 + + P4AAAL+AAABC5AAAwgQAAA + com.apple.InterfaceBuilder.CocoaPlugin ToolTip @@ -46973,6 +47070,9 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin + + P4AAAL+AAABDvAAAwhQAAA + com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -47288,6 +47388,9 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin + + AUGIAABDNgAAA + com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -47301,6 +47404,9 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin + + P4AAAL+AAABBcAAAwgAAAA + com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin {{1241, 208}, {335, 163}} @@ -48264,6 +48370,9 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin + + AUGIAABC6gAAA + com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -48321,6 +48430,9 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin + + AUGIAABBgAAAA + com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -49388,6 +49500,18 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin + + YES + + + YES + + + com.apple.InterfaceBuilder.CocoaPlugin + + P4AAAL+AAABBqAAAwygAAA + + com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -49521,7 +49645,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA - 8301 + 8306 @@ -52363,7 +52487,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA {20, 20} {15, 15} {8, 8} - {128, 128} + {512, 512} {11, 11} {10, 3} {32, 32} diff --git a/desmume/src/cocoa/userinterface/DisplayWindowController.h b/desmume/src/cocoa/userinterface/DisplayWindowController.h index ba2c2960c..b8b1061df 100644 --- a/desmume/src/cocoa/userinterface/DisplayWindowController.h +++ b/desmume/src/cocoa/userinterface/DisplayWindowController.h @@ -70,7 +70,7 @@ GLubyte vtxIndexBuffer[12]; BOOL isShaderSupported; - unsigned int vtxBufferOffset; + size_t vtxBufferOffset; } @property (retain) InputManager *inputManager; diff --git a/desmume/src/cocoa/userinterface/DisplayWindowController.mm b/desmume/src/cocoa/userinterface/DisplayWindowController.mm index f6ba4d7f4..696848784 100644 --- a/desmume/src/cocoa/userinterface/DisplayWindowController.mm +++ b/desmume/src/cocoa/userinterface/DisplayWindowController.mm @@ -1119,7 +1119,7 @@ static std::tr1::unordered_map _screenMap [view setInputManager:[emuControl inputManager]]; [[emuControl windowList] addObject:self]; [emuControl updateAllWindowTitles]; - + // Set up the video output thread. cdsVideoOutput = [[CocoaDSDisplayVideo alloc] init]; [cdsVideoOutput setDelegate:view]; @@ -1220,10 +1220,6 @@ static std::tr1::unordered_map _screenMap [emuControl closeRom:nil]; shouldClose = NO; } - else // If no ROM is loaded, close the window and terminate the application. - { - [NSApp terminate:sender]; - } return shouldClose; } @@ -1236,6 +1232,18 @@ static std::tr1::unordered_map _screenMap [self setCdsVideoOutput:nil]; [[emuControl windowList] removeObject:self]; + + if ([[emuControl windowList] count] < 1) + { + if ([emuControl currentRom] != nil) + { + [emuControl closeRom:nil]; + } + + [NSApp terminate:[notification object]]; + return; + } + [emuControl updateAllWindowTitles]; } @@ -1316,6 +1324,8 @@ static std::tr1::unordered_map _screenMap return self; } + inputManager = nil; + // Initialize the OpenGL context NSOpenGLPixelFormatAttribute attributes[] = { NSOpenGLPFAColorSize, (NSOpenGLPixelFormatAttribute)24, @@ -1330,11 +1340,6 @@ static std::tr1::unordered_map _screenMap [format release]; cglDisplayContext = (CGLContextObj)[context CGLContextObj]; - CGLContextObj prevContext = CGLGetCurrentContext(); - CGLSetCurrentContext(cglDisplayContext); - [self startupOpenGL]; - CGLSetCurrentContext(prevContext); - _currentDisplayMode = DS_DISPLAY_TYPE_COMBO; _currentDisplayOrientation = DS_DISPLAY_ORIENTATION_VERTICAL; _currentGapScalar = 0.0f; @@ -1347,7 +1352,20 @@ static std::tr1::unordered_map _screenMap glTexBackSize = NSMakeSize(w, h); vtxBufferOffset = 0; - inputManager = nil; + [self updateDisplayVerticesUsingDisplayMode:_currentDisplayMode orientation:_currentDisplayOrientation gap:_currentGapScalar]; + [self updateTexCoordS:1.0f T:2.0f]; + + // Set up initial vertex elements + vtxIndexBuffer[0] = 0; vtxIndexBuffer[1] = 1; vtxIndexBuffer[2] = 2; + vtxIndexBuffer[3] = 2; vtxIndexBuffer[4] = 3; vtxIndexBuffer[5] = 0; + + vtxIndexBuffer[6] = 4; vtxIndexBuffer[7] = 5; vtxIndexBuffer[8] = 6; + vtxIndexBuffer[9] = 6; vtxIndexBuffer[10] = 7; vtxIndexBuffer[11] = 4; + + CGLContextObj prevContext = CGLGetCurrentContext(); + CGLSetCurrentContext(cglDisplayContext); + [self startupOpenGL]; + CGLSetCurrentContext(prevContext); return self; } @@ -1373,16 +1391,6 @@ static std::tr1::unordered_map _screenMap - (void) startupOpenGL { - [self updateDisplayVerticesUsingDisplayMode:_currentDisplayMode orientation:_currentDisplayOrientation gap:_currentGapScalar]; - [self updateTexCoordS:1.0f T:2.0f]; - - // Set up initial vertex elements - vtxIndexBuffer[0] = 0; vtxIndexBuffer[1] = 1; vtxIndexBuffer[2] = 2; - vtxIndexBuffer[3] = 2; vtxIndexBuffer[4] = 3; vtxIndexBuffer[5] = 0; - - vtxIndexBuffer[6] = 4; vtxIndexBuffer[7] = 5; vtxIndexBuffer[8] = 6; - vtxIndexBuffer[9] = 6; vtxIndexBuffer[10] = 7; vtxIndexBuffer[11] = 4; - // Check the OpenGL capabilities for this renderer const GLubyte *glExtString = glGetString(GL_EXTENSIONS); @@ -1795,7 +1803,7 @@ static std::tr1::unordered_map _screenMap const size_t inputCount = inputList.size(); - for (unsigned int i = 0; i < inputCount; i++) + for (size_t i = 0; i < inputCount; i++) { const InputAttributes &inputAttr = inputList[i]; @@ -1943,7 +1951,6 @@ static std::tr1::unordered_map _screenMap [context update]; DisplayWindowController *windowController = (DisplayWindowController *)[[self window] delegate]; [CocoaDSUtil messageSendOneWayWithRect:[[windowController cdsVideoOutput] receivePort] msgID:MESSAGE_RESIZE_VIEW rect:rect]; - [self setNeedsDisplay:YES]; } } diff --git a/desmume/src/cocoa/userinterface/EmuControllerDelegate.mm b/desmume/src/cocoa/userinterface/EmuControllerDelegate.mm index c8b0e2881..2039798fe 100644 --- a/desmume/src/cocoa/userinterface/EmuControllerDelegate.mm +++ b/desmume/src/cocoa/userinterface/EmuControllerDelegate.mm @@ -430,8 +430,6 @@ - (IBAction) newDisplayWindow:(id)sender { DisplayWindowController *newWindowController = [[DisplayWindowController alloc] initWithWindowNibName:@"DisplayWindow" emuControlDelegate:self]; - [[newWindowController window] makeKeyAndOrderFront:self]; - [[newWindowController window] makeMainWindow]; if ([self currentRom] == nil) { @@ -441,6 +439,9 @@ { [[newWindowController view] setNeedsDisplay:YES]; } + + [[newWindowController window] makeKeyAndOrderFront:self]; + [[newWindowController window] makeMainWindow]; } - (IBAction) openRom:(id)sender diff --git a/desmume/src/cocoa/userinterface/appDelegate.h b/desmume/src/cocoa/userinterface/appDelegate.h index 03c4dd07c..fb789684d 100644 --- a/desmume/src/cocoa/userinterface/appDelegate.h +++ b/desmume/src/cocoa/userinterface/appDelegate.h @@ -95,5 +95,7 @@ - (NSMenuItem *) addSlotMenuItem:(NSMenu *)menu slotNumber:(NSUInteger)slotNumber; - (void) setupUserDefaults; - (void) setRomInfoPanelBoxTitleColors; +- (void) restoreDisplayWindowStates; +- (void) saveDisplayWindowStates; @end diff --git a/desmume/src/cocoa/userinterface/appDelegate.mm b/desmume/src/cocoa/userinterface/appDelegate.mm index 15dda2c8e..9d0eb8a3b 100644 --- a/desmume/src/cocoa/userinterface/appDelegate.mm +++ b/desmume/src/cocoa/userinterface/appDelegate.mm @@ -81,6 +81,7 @@ return self; } +#pragma mark NSApplicationDelegate Protocol - (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename { BOOL result = NO; @@ -237,6 +238,10 @@ appFirstTimeRunDict = [[NSMutableDictionary alloc] initWithObjectsAndKeys:isFirstTimeRunNumber, bundleVersionString, nil]; } + //Bring the application to the front + [NSApp activateIgnoringOtherApps:TRUE]; + [self restoreDisplayWindowStates]; + // Load a new ROM on launch per user preferences. const BOOL loadROMOnLaunch = [[NSUserDefaults standardUserDefaults] boolForKey:@"General_AutoloadROMOnLaunch"]; if (loadROMOnLaunch && [emuControl currentRom] == nil) @@ -263,10 +268,6 @@ } } - //Bring the application to the front - [NSApp activateIgnoringOtherApps:TRUE]; - [emuControl newDisplayWindow:nil]; - // Present the file migration window to the user (if they haven't disabled it). if (![[NSUserDefaults standardUserDefaults] boolForKey:@"General_DoNotAskMigrate"] || !isFirstTimeRun) { @@ -310,6 +311,7 @@ CocoaDSCore *cdsCore = (CocoaDSCore *)[cdsCoreController content]; // Save some settings to user defaults before app termination + [self saveDisplayWindowStates]; [[NSUserDefaults standardUserDefaults] setBool:[cdsCore isSpeedLimitEnabled] forKey:@"CoreControl_EnableSpeedLimit"]; [[NSUserDefaults standardUserDefaults] setBool:[cdsCore isFrameSkipEnabled] forKey:@"CoreControl_EnableAutoFrameSkip"]; [[NSUserDefaults standardUserDefaults] setBool:[cdsCore isCheatingEnabled] forKey:@"CoreControl_EnableCheats"]; @@ -317,6 +319,7 @@ [cdsCoreController setContent:nil]; } +#pragma mark IBActions - (IBAction) launchWebsite:(id)sender { [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@STRING_DESMUME_WEBSITE]]; @@ -345,6 +348,7 @@ [troubleshootingWindow makeKeyAndOrderFront:sender]; } +#pragma mark Class Methods - (void) setupSlotMenuItems { NSMenuItem *loadItem = nil; @@ -582,4 +586,151 @@ [boxMisc setNeedsDisplay:YES]; } +- (void) restoreDisplayWindowStates +{ + EmuControllerDelegate *emuControl = (EmuControllerDelegate *)[emuControlController content]; + NSArray *windowPropertiesList = [[NSUserDefaults standardUserDefaults] arrayForKey:@"General_DisplayWindowRestorableStates"]; + const BOOL willRestoreWindows = [[NSUserDefaults standardUserDefaults] boolForKey:@"General_WillRestoreDisplayWindows"]; + + if (!willRestoreWindows || windowPropertiesList == nil || [windowPropertiesList count] < 1) + { + // If no windows were saved for restoring (the user probably closed all windows before + // app termination), then simply create a new display window per user defaults. + [emuControl newDisplayWindow:self]; + } + else + { + for (NSDictionary *windowProperties in windowPropertiesList) + { + DisplayWindowController *windowController = [[DisplayWindowController alloc] initWithWindowNibName:@"DisplayWindow" emuControlDelegate:emuControl]; + + if (windowController == nil) + { + continue; + } + + const NSInteger displayMode = [(NSNumber *)[windowProperties valueForKey:@"displayMode"] integerValue]; + const double displayScale = [(NSNumber *)[windowProperties valueForKey:@"displayScale"] doubleValue]; + const double displayRotation = [(NSNumber *)[windowProperties valueForKey:@"displayRotation"] doubleValue]; + const NSInteger displayOrientation = [(NSNumber *)[windowProperties valueForKey:@"displayOrientation"] integerValue]; + const NSInteger displayOrder = [(NSNumber *)[windowProperties valueForKey:@"displayOrder"] integerValue]; + const double displayGap = [(NSNumber *)[windowProperties valueForKey:@"displayGap"] doubleValue]; + const NSInteger videoFilterType = [(NSNumber *)[windowProperties valueForKey:@"videoFilterType"] integerValue]; + const NSInteger screenshotFileFormat = [(NSNumber *)[windowProperties valueForKey:@"screenshotFileFormat"] integerValue]; + const BOOL useBilinearOutput = [(NSNumber *)[windowProperties valueForKey:@"useBilinearOutput"] boolValue]; + const BOOL useVerticalSync = [(NSNumber *)[windowProperties valueForKey:@"useVerticalSync"] boolValue]; + const BOOL isMinSizeNormal = [(NSNumber *)[windowProperties valueForKey:@"isMinSizeNormal"] boolValue]; + const BOOL isShowingStatusBar = [(NSNumber *)[windowProperties valueForKey:@"isShowingStatusBar"] boolValue]; + const BOOL isInFullScreenMode = [(NSNumber *)[windowProperties valueForKey:@"isInFullScreenMode"] boolValue]; + const NSUInteger screenIndex = [(NSNumber *)[windowProperties valueForKey:@"screenIndex"] unsignedIntegerValue]; + NSString *windowFrameStr = (NSString *)[windowProperties valueForKey:@"windowFrame"]; + + int frameX = 0; + int frameY = 0; + int frameWidth = GPU_DISPLAY_WIDTH; + int frameHeight = GPU_DISPLAY_HEIGHT; + const char *frameCStr = [windowFrameStr cStringUsingEncoding:NSUTF8StringEncoding]; + sscanf(frameCStr, "%i %i %i %i", &frameX, &frameY, &frameWidth, &frameHeight); + + [windowController setIsMinSizeNormal:isMinSizeNormal]; + [windowController setIsShowingStatusBar:isShowingStatusBar]; + [windowController setVideoFilterType:videoFilterType]; + [windowController setDisplayMode:displayMode]; + [windowController setDisplayRotation:displayRotation]; + [windowController setDisplayOrientation:displayOrientation]; + [windowController setDisplayOrder:displayOrder]; + [windowController setDisplayGap:displayGap]; + [windowController setScreenshotFileFormat:screenshotFileFormat]; + [windowController setUseBilinearOutput:useBilinearOutput]; + [windowController setUseVerticalSync:useVerticalSync]; + [windowController setDisplayScale:displayScale]; + + [[windowController masterWindow] setFrameOrigin:NSMakePoint(frameX, frameY)]; + + // If this is the last window in the list, make this window key and main. + // Otherwise, just order the window to the front so that the windows will + // stack in a deterministic order. + if (windowProperties == [windowPropertiesList lastObject]) + { + [[windowController window] makeKeyAndOrderFront:self]; + [[windowController window] makeMainWindow]; + } + else + { + [[windowController window] orderFront:self]; + } + + // Draw the display view now so that we guarantee that its drawn at least once. + if ([emuControl currentRom] == nil) + { + [[windowController view] clearToBlack]; + } + else + { + [[windowController view] setNeedsDisplay:YES]; + } + + // If this window is set to full screen mode, its associated screen index must + // exist. If not, this window will not enter full screen mode. This is necessary, + // since the user's screen configuration could change in between app launches, + // and since we don't want a window to go full screen on the wrong screen. + if (isInFullScreenMode && + ([[NSScreen screens] indexOfObject:[[windowController window] screen]] == screenIndex)) + { + [windowController enterFullScreen]; + [[windowController window] makeKeyAndOrderFront:self]; + [[windowController window] makeMainWindow]; + } + } + } +} + +- (void) saveDisplayWindowStates +{ + EmuControllerDelegate *emuControl = (EmuControllerDelegate *)[emuControlController content]; + NSArray *windowList = [emuControl windowList]; + const BOOL willRestoreWindows = [[NSUserDefaults standardUserDefaults] boolForKey:@"General_WillRestoreDisplayWindows"]; + + if (willRestoreWindows && [windowList count] > 0) + { + NSMutableArray *windowPropertiesList = [NSMutableArray arrayWithCapacity:[windowList count]]; + + for (DisplayWindowController *windowController in windowList) + { + const BOOL isInFullScreenMode = ([windowController assignedScreen] != nil); + const NSUInteger screenIndex = [[NSScreen screens] indexOfObject:[[windowController masterWindow] screen]]; + + const NSRect windowFrame = [[windowController masterWindow] frame]; + NSString *windowFrameStr = [NSString stringWithFormat:@"%i %i %i %i", + (int)windowFrame.origin.x, (int)windowFrame.origin.y, (int)windowFrame.size.width, (int)windowFrame.size.height]; + + NSDictionary *windowProperties = [NSDictionary dictionaryWithObjectsAndKeys: + [NSNumber numberWithInteger:[windowController displayMode]], @"displayMode", + [NSNumber numberWithDouble:[windowController displayScale]], @"displayScale", + [NSNumber numberWithDouble:[windowController displayRotation]], @"displayRotation", + [NSNumber numberWithInteger:[windowController displayOrientation]], @"displayOrientation", + [NSNumber numberWithInteger:[windowController displayOrder]], @"displayOrder", + [NSNumber numberWithDouble:[windowController displayGap]], @"displayGap", + [NSNumber numberWithInteger:[windowController videoFilterType]], @"videoFilterType", + [NSNumber numberWithInteger:[windowController screenshotFileFormat]], @"screenshotFileFormat", + [NSNumber numberWithBool:[windowController useBilinearOutput]], @"useBilinearOutput", + [NSNumber numberWithBool:[windowController useVerticalSync]], @"useVerticalSync", + [NSNumber numberWithBool:[windowController isMinSizeNormal]], @"isMinSizeNormal", + [NSNumber numberWithBool:[windowController isShowingStatusBar]], @"isShowingStatusBar", + [NSNumber numberWithBool:isInFullScreenMode], @"isInFullScreenMode", + [NSNumber numberWithUnsignedInteger:screenIndex], @"screenIndex", + windowFrameStr, @"windowFrame", + nil]; + + [windowPropertiesList addObject:windowProperties]; + } + + [[NSUserDefaults standardUserDefaults] setObject:windowPropertiesList forKey:@"General_DisplayWindowRestorableStates"]; + } + else + { + [[NSUserDefaults standardUserDefaults] removeObjectForKey:@"General_DisplayWindowRestorableStates"]; + } +} + @end