Cocoa Port: Vastly improve the ability to take screenshots of the NDS displays.
- The old Tools > Save Screenshot As has been replaced with the new Screenshot Capture Tool. - The new Screenshot Capture Tool allows screenshots to be configured to render with the same layout features as a display view. - Screenshot captures now both render and save to file on their own independent threads. - Screenshots are now captured using the Take Screenshot button, and files are now automatically named based on ROM name and timestamp. - All of these features means that users can now rapidly take screenshots with their own custom layouts, all with little to no slowdown to the emulation. - Also do a bunch of code cleanup and refactoring as a side-effect of adding these new features.
This commit is contained in:
parent
2c1360dec5
commit
059ea519bc
File diff suppressed because it is too large
Load Diff
|
@ -110,7 +110,7 @@ struct ClientFrameInfo
|
|||
};
|
||||
typedef struct ClientFrameInfo ClientFrameInfo;
|
||||
|
||||
struct ClientDisplayViewProperties
|
||||
struct ClientDisplayPresenterProperties
|
||||
{
|
||||
ClientDisplayMode mode;
|
||||
ClientDisplayLayout layout;
|
||||
|
@ -125,7 +125,7 @@ struct ClientDisplayViewProperties
|
|||
double viewScale;
|
||||
double gapDistance;
|
||||
};
|
||||
typedef struct ClientDisplayViewProperties ClientDisplayViewProperties;
|
||||
typedef struct ClientDisplayPresenterProperties ClientDisplayPresenterProperties;
|
||||
|
||||
extern LUTValues *_LQ2xLUT;
|
||||
extern LUTValues *_HQ2xLUT;
|
||||
|
@ -133,15 +133,14 @@ extern LUTValues *_HQ3xLUT;
|
|||
extern LUTValues *_HQ4xLUT;
|
||||
void InitHQnxLUTs();
|
||||
|
||||
class ClientDisplayView
|
||||
class ClientDisplayPresenter
|
||||
{
|
||||
private:
|
||||
void __InstanceInit(const ClientDisplayViewProperties &props);
|
||||
void __InstanceInit(const ClientDisplayPresenterProperties &props);
|
||||
|
||||
protected:
|
||||
ClientDisplayViewProperties _renderProperty;
|
||||
ClientDisplayViewProperties _stagedProperty;
|
||||
InitialTouchPressMap *_initialTouchInMajorDisplay;
|
||||
ClientDisplayPresenterProperties _renderProperty;
|
||||
ClientDisplayPresenterProperties _stagedProperty;
|
||||
GPUClientFetchObject *_fetchObject;
|
||||
|
||||
bool _useDeposterize;
|
||||
|
@ -152,8 +151,6 @@ protected:
|
|||
bool _isSelectedDisplayEnabled[2];
|
||||
NDSDisplayID _selectedSourceForDisplay[2];
|
||||
|
||||
int64_t _displayViewID;
|
||||
bool _useVerticalSync;
|
||||
double _scaleFactor;
|
||||
|
||||
double _hudObjectScale;
|
||||
|
@ -184,9 +181,6 @@ protected:
|
|||
std::string _hudInputString;
|
||||
std::string _outHudString;
|
||||
bool _hudNeedsUpdate;
|
||||
bool _viewNeedsFlush;
|
||||
bool _allowViewUpdates;
|
||||
bool _allowViewFlushes;
|
||||
|
||||
FT_Library _ftLibrary;
|
||||
const char *_lastFontFilePath;
|
||||
|
@ -215,26 +209,19 @@ protected:
|
|||
virtual void _ResizeCPUPixelScaler(const VideoFilterTypeID filterID);
|
||||
|
||||
public:
|
||||
ClientDisplayView();
|
||||
ClientDisplayView(const ClientDisplayViewProperties &props);
|
||||
virtual ~ClientDisplayView();
|
||||
ClientDisplayPresenter();
|
||||
ClientDisplayPresenter(const ClientDisplayPresenterProperties &props);
|
||||
virtual ~ClientDisplayPresenter();
|
||||
|
||||
virtual void Init();
|
||||
|
||||
int64_t GetDisplayViewID();
|
||||
virtual void SetDisplayViewID(int64_t displayViewID);
|
||||
|
||||
virtual bool GetViewNeedsFlush();
|
||||
|
||||
bool GetUseVerticalSync() const;
|
||||
virtual void SetUseVerticalSync(const bool useVerticalSync);
|
||||
double GetScaleFactor() const;
|
||||
virtual void SetScaleFactor(const double scaleFactor);
|
||||
|
||||
// NDS screen layout
|
||||
const ClientDisplayViewProperties& GetViewProperties() const;
|
||||
void CommitViewProperties(const ClientDisplayViewProperties &props);
|
||||
virtual void SetupViewProperties();
|
||||
const ClientDisplayPresenterProperties& GetPresenterProperties() const;
|
||||
void CommitPresenterProperties(const ClientDisplayPresenterProperties &props);
|
||||
virtual void SetupPresenterProperties();
|
||||
|
||||
double GetRotation() const;
|
||||
double GetViewScale() const;
|
||||
|
@ -311,15 +298,9 @@ public:
|
|||
const GPUClientFetchObject& GetFetchObject() const;
|
||||
void SetFetchObject(GPUClientFetchObject *fetchObject);
|
||||
|
||||
bool GetAllowViewUpdates() const;
|
||||
virtual void SetAllowViewUpdates(bool allowUpdates);
|
||||
bool GetAllowViewFlushes() const;
|
||||
virtual void SetAllowViewFlushes(bool allowFlushes);
|
||||
|
||||
virtual void LoadDisplays();
|
||||
virtual void ProcessDisplays();
|
||||
virtual void UpdateView();
|
||||
virtual void FlushView();
|
||||
virtual void UpdateLayout();
|
||||
virtual void FinishFrameAtIndex(const uint8_t bufferIndex);
|
||||
|
||||
virtual void CopyFrameToBuffer(uint32_t *dstBuffer);
|
||||
|
@ -327,12 +308,6 @@ public:
|
|||
// Emulator interface
|
||||
const NDSDisplayInfo& GetEmuDisplayInfo() const;
|
||||
void SetEmuDisplayInfo(const NDSDisplayInfo &ndsDisplayInfo);
|
||||
virtual void HandleEmulatorFrameEndEvent();
|
||||
|
||||
// Touch screen input handling
|
||||
void GetNDSPoint(const int inputID, const bool isInitialTouchPress,
|
||||
const double clientX, const double clientY,
|
||||
u8 &outX, u8 &outY) const;
|
||||
|
||||
// Utility methods
|
||||
static void ConvertNormalToTransformedBounds(const double scalar,
|
||||
|
@ -342,25 +317,69 @@ public:
|
|||
static double GetMaxScalarWithinBounds(const double normalBoundsWidth, const double normalBoundsHeight,
|
||||
const double keepInBoundsWidth, const double keepInBoundsHeight);
|
||||
|
||||
static void CalculateNormalSize(const ClientDisplayMode mode, const ClientDisplayLayout layout, const double gapScale,
|
||||
double &outWidth, double &outHeight);
|
||||
};
|
||||
|
||||
class ClientDisplayViewInterface
|
||||
{
|
||||
protected:
|
||||
InitialTouchPressMap *_initialTouchInMajorDisplay;
|
||||
int64_t _displayViewID;
|
||||
bool _useVerticalSync;
|
||||
bool _viewNeedsFlush;
|
||||
bool _allowViewUpdates;
|
||||
bool _allowViewFlushes;
|
||||
|
||||
public:
|
||||
ClientDisplayViewInterface();
|
||||
virtual ~ClientDisplayViewInterface();
|
||||
|
||||
int64_t GetDisplayViewID();
|
||||
virtual void SetDisplayViewID(int64_t displayViewID);
|
||||
|
||||
virtual bool GetViewNeedsFlush();
|
||||
virtual void SetViewNeedsFlush();
|
||||
|
||||
bool GetUseVerticalSync() const;
|
||||
virtual void SetUseVerticalSync(const bool useVerticalSync);
|
||||
|
||||
// Client view interface
|
||||
bool GetAllowViewUpdates() const;
|
||||
virtual void SetAllowViewUpdates(bool allowUpdates);
|
||||
bool GetAllowViewFlushes() const;
|
||||
virtual void SetAllowViewFlushes(bool allowFlushes);
|
||||
|
||||
virtual void FlushView();
|
||||
|
||||
// Touch screen input handling
|
||||
void GetNDSPoint(const ClientDisplayPresenterProperties &props,
|
||||
const double logicalClientWidth, const double logicalClientHeight,
|
||||
const int inputID, const bool isInitialTouchPress,
|
||||
const double clientX, const double clientY,
|
||||
uint8_t &outX, uint8_t &outY) const;
|
||||
|
||||
// Utility methods
|
||||
static void ConvertClientToNormalPoint(const double normalBoundsWidth, const double normalBoundsHeight,
|
||||
const double transformBoundsWidth, const double transformBoundsHeight,
|
||||
const double scalar,
|
||||
const double angleDegrees,
|
||||
double &inoutX, double &inoutY);
|
||||
|
||||
static void CalculateNormalSize(const ClientDisplayMode mode, const ClientDisplayLayout layout, const double gapScale,
|
||||
double &outWidth, double &outHeight);
|
||||
};
|
||||
|
||||
class ClientDisplay3DView : public ClientDisplayView
|
||||
class ClientDisplay3DPresenter : public ClientDisplayPresenter
|
||||
{
|
||||
private:
|
||||
void __InstanceInit();
|
||||
|
||||
protected:
|
||||
bool _canFilterOnGPU;
|
||||
bool _willFilterOnGPU;
|
||||
bool _filtersPreferGPU;
|
||||
|
||||
public:
|
||||
ClientDisplay3DView();
|
||||
ClientDisplay3DPresenter();
|
||||
ClientDisplay3DPresenter(const ClientDisplayPresenterProperties &props);
|
||||
|
||||
bool CanFilterOnGPU() const;
|
||||
bool GetFiltersPreferGPU() const;
|
||||
|
@ -377,4 +396,34 @@ public:
|
|||
void SetScreenTextureCoordinates(float w0, float h0, float w1, float h1, float *texCoordBufferPtr);
|
||||
};
|
||||
|
||||
class ClientDisplayView : public ClientDisplayViewInterface
|
||||
{
|
||||
protected:
|
||||
ClientDisplayPresenter *_presenter;
|
||||
|
||||
public:
|
||||
ClientDisplayView();
|
||||
ClientDisplayView(ClientDisplayPresenter *thePresenter);
|
||||
|
||||
virtual void Init();
|
||||
|
||||
ClientDisplayPresenter* GetPresenter();
|
||||
void SetPresenter(ClientDisplayPresenter *thePresenter);
|
||||
};
|
||||
|
||||
class ClientDisplay3DView : public ClientDisplayViewInterface
|
||||
{
|
||||
protected:
|
||||
ClientDisplay3DPresenter *_presenter;
|
||||
|
||||
public:
|
||||
ClientDisplay3DView();
|
||||
ClientDisplay3DView(ClientDisplay3DPresenter *thePresenter);
|
||||
|
||||
virtual void Init();
|
||||
|
||||
ClientDisplay3DPresenter* Get3DPresenter();
|
||||
void Set3DPresenter(ClientDisplay3DPresenter *thePresenter);
|
||||
};
|
||||
|
||||
#endif // _CLIENT_DISPLAY_VIEW_H_
|
||||
|
|
|
@ -1048,6 +1048,9 @@
|
|||
ABD10AEC1715FCDD00B5729D /* mic_ext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = ABD10AE61715FCDD00B5729D /* mic_ext.cpp */; };
|
||||
ABD10AED17160C9300B5729D /* ringbuffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB1B9E601501A78000464647 /* ringbuffer.cpp */; };
|
||||
ABD10AEE17160CDD00B5729D /* cocoa_input.mm in Sources */ = {isa = PBXBuildFile; fileRef = ABD104111346652500AF11D1 /* cocoa_input.mm */; };
|
||||
ABD1FBF11F7B7E7E00B4F648 /* MacScreenshotCaptureTool.mm in Sources */ = {isa = PBXBuildFile; fileRef = ABD1FBF01F7B7E7E00B4F648 /* MacScreenshotCaptureTool.mm */; };
|
||||
ABD1FBF21F7B7E7E00B4F648 /* MacScreenshotCaptureTool.mm in Sources */ = {isa = PBXBuildFile; fileRef = ABD1FBF01F7B7E7E00B4F648 /* MacScreenshotCaptureTool.mm */; };
|
||||
ABD1FBF31F7B7E7E00B4F648 /* MacScreenshotCaptureTool.mm in Sources */ = {isa = PBXBuildFile; fileRef = ABD1FBF01F7B7E7E00B4F648 /* MacScreenshotCaptureTool.mm */; };
|
||||
ABD1FED21345AC8400AF11D1 /* arm_instructions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = ABD1FEA31345AC8400AF11D1 /* arm_instructions.cpp */; };
|
||||
ABD1FED31345AC8400AF11D1 /* armcpu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = ABD1FEA41345AC8400AF11D1 /* armcpu.cpp */; };
|
||||
ABD1FED41345AC8400AF11D1 /* bios.cpp in Sources */ = {isa = PBXBuildFile; fileRef = ABD1FEA51345AC8400AF11D1 /* bios.cpp */; };
|
||||
|
@ -1628,6 +1631,8 @@
|
|||
ABD10AE41715FCDD00B5729D /* mic_ext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mic_ext.h; sourceTree = SOURCE_ROOT; };
|
||||
ABD10AE51715FCDD00B5729D /* audiosamplegenerator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = audiosamplegenerator.cpp; sourceTree = SOURCE_ROOT; };
|
||||
ABD10AE61715FCDD00B5729D /* mic_ext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = mic_ext.cpp; sourceTree = SOURCE_ROOT; };
|
||||
ABD1FBF01F7B7E7E00B4F648 /* MacScreenshotCaptureTool.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MacScreenshotCaptureTool.mm; sourceTree = "<group>"; };
|
||||
ABD1FBF41F7B7EA600B4F648 /* MacScreenshotCaptureTool.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MacScreenshotCaptureTool.h; sourceTree = "<group>"; };
|
||||
ABD1FE6F1345AC8400AF11D1 /* armcpu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = armcpu.h; sourceTree = "<group>"; };
|
||||
ABD1FE701345AC8400AF11D1 /* bios.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = bios.h; sourceTree = "<group>"; };
|
||||
ABD1FE711345AC8400AF11D1 /* bits.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = bits.h; sourceTree = "<group>"; };
|
||||
|
@ -2433,6 +2438,7 @@
|
|||
AB01005C170D07AF00D70FBE /* InputProfileController.h */,
|
||||
AB3BF43F1E2628B6003E2B24 /* MacMetalDisplayView.h */,
|
||||
AB3BF4051E22FEA8003E2B24 /* MacOGLDisplayView.h */,
|
||||
ABD1FBF41F7B7EA600B4F648 /* MacScreenshotCaptureTool.h */,
|
||||
AB3ACB7014C2361100D7D192 /* preferencesWindowDelegate.h */,
|
||||
ABAF0A3F1A96E67200B95B75 /* RomInfoPanel.h */,
|
||||
AB564902186E6EBC002740F4 /* Slot2WindowDelegate.h */,
|
||||
|
@ -2449,6 +2455,7 @@
|
|||
AB01005D170D07B000D70FBE /* InputProfileController.mm */,
|
||||
AB3BF43B1E26289E003E2B24 /* MacMetalDisplayView.mm */,
|
||||
AB3BF4011E22FE01003E2B24 /* MacOGLDisplayView.mm */,
|
||||
ABD1FBF01F7B7E7E00B4F648 /* MacScreenshotCaptureTool.mm */,
|
||||
AB3ACB7114C2361100D7D192 /* preferencesWindowDelegate.mm */,
|
||||
ABAF0A401A96E67200B95B75 /* RomInfoPanel.mm */,
|
||||
AB564903186E6EBC002740F4 /* Slot2WindowDelegate.mm */,
|
||||
|
@ -3814,6 +3821,7 @@
|
|||
ABA7316F1BB51FDC00B26147 /* type1.c in Sources */,
|
||||
ABD1FF5F1345ACBF00AF11D1 /* fatfile.cpp in Sources */,
|
||||
ABD1FEDF1345AC8400AF11D1 /* FIFO.cpp in Sources */,
|
||||
ABD1FBF31F7B7E7E00B4F648 /* MacScreenshotCaptureTool.mm in Sources */,
|
||||
ABAD3E7413AF1D6D00502E1E /* FIFOSampleBuffer.cpp in Sources */,
|
||||
ABD1FF601345ACBF00AF11D1 /* file_allocation_table.cpp in Sources */,
|
||||
AB2EE12D17D57ED500F68622 /* slot1_retail_mcrom_debug.cpp in Sources */,
|
||||
|
@ -4035,6 +4043,7 @@
|
|||
AB796D0115CDCBA200C59155 /* dlditool.cpp in Sources */,
|
||||
AB796D0215CDCBA200C59155 /* driver.cpp in Sources */,
|
||||
AB796D0315CDCBA200C59155 /* emufat.cpp in Sources */,
|
||||
ABD1FBF11F7B7E7E00B4F648 /* MacScreenshotCaptureTool.mm in Sources */,
|
||||
AB3BF4381E25D9AE003E2B24 /* DisplayViewCALayer.mm in Sources */,
|
||||
AB564904186E6EBC002740F4 /* Slot2WindowDelegate.mm in Sources */,
|
||||
AB9038B217C5ED2200F410BD /* slot1_retail_mcrom.cpp in Sources */,
|
||||
|
@ -4385,6 +4394,7 @@
|
|||
AB8F3CE81A53AC2600A80BF6 /* epx.cpp in Sources */,
|
||||
AB8F3CE91A53AC2600A80BF6 /* hq2x.cpp in Sources */,
|
||||
AB8F3CEA1A53AC2600A80BF6 /* hq4x.cpp in Sources */,
|
||||
ABD1FBF21F7B7E7E00B4F648 /* MacScreenshotCaptureTool.mm in Sources */,
|
||||
AB8F3CEB1A53AC2600A80BF6 /* advanscene.cpp in Sources */,
|
||||
AB8F3CEC1A53AC2600A80BF6 /* lq2x.cpp in Sources */,
|
||||
AB8F3CED1A53AC2600A80BF6 /* xbrz.cpp in Sources */,
|
||||
|
|
|
@ -1227,6 +1227,11 @@
|
|||
ABAAFBEB172122B6005DDDBE /* FileMigrationDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = ABAAFBE9172122B6005DDDBE /* FileMigrationDelegate.mm */; };
|
||||
ABAAFBEC172122B6005DDDBE /* FileMigrationDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = ABAAFBE9172122B6005DDDBE /* FileMigrationDelegate.mm */; };
|
||||
ABAAFBED172122B6005DDDBE /* FileMigrationDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = ABAAFBE9172122B6005DDDBE /* FileMigrationDelegate.mm */; };
|
||||
ABAB0AFF1F7C1BB70079EFD3 /* MacScreenshotCaptureTool.mm in Sources */ = {isa = PBXBuildFile; fileRef = ABAB0AFE1F7C1BB70079EFD3 /* MacScreenshotCaptureTool.mm */; };
|
||||
ABAB0B001F7C1BB70079EFD3 /* MacScreenshotCaptureTool.mm in Sources */ = {isa = PBXBuildFile; fileRef = ABAB0AFE1F7C1BB70079EFD3 /* MacScreenshotCaptureTool.mm */; };
|
||||
ABAB0B011F7C1BB70079EFD3 /* MacScreenshotCaptureTool.mm in Sources */ = {isa = PBXBuildFile; fileRef = ABAB0AFE1F7C1BB70079EFD3 /* MacScreenshotCaptureTool.mm */; };
|
||||
ABAB0B021F7C1BB70079EFD3 /* MacScreenshotCaptureTool.mm in Sources */ = {isa = PBXBuildFile; fileRef = ABAB0AFE1F7C1BB70079EFD3 /* MacScreenshotCaptureTool.mm */; };
|
||||
ABAB0B031F7C1BB70079EFD3 /* MacScreenshotCaptureTool.mm in Sources */ = {isa = PBXBuildFile; fileRef = ABAB0AFE1F7C1BB70079EFD3 /* MacScreenshotCaptureTool.mm */; };
|
||||
ABACB73A1AAC46B20066F429 /* Icon_MicrophoneDarkGreen_256x256.png in Resources */ = {isa = PBXBuildFile; fileRef = ABACB7391AAC46B20066F429 /* Icon_MicrophoneDarkGreen_256x256.png */; };
|
||||
ABACB73B1AAC46B20066F429 /* Icon_MicrophoneDarkGreen_256x256.png in Resources */ = {isa = PBXBuildFile; fileRef = ABACB7391AAC46B20066F429 /* Icon_MicrophoneDarkGreen_256x256.png */; };
|
||||
ABACB73C1AAC46B20066F429 /* Icon_MicrophoneDarkGreen_256x256.png in Resources */ = {isa = PBXBuildFile; fileRef = ABACB7391AAC46B20066F429 /* Icon_MicrophoneDarkGreen_256x256.png */; };
|
||||
|
@ -1994,6 +1999,8 @@
|
|||
ABAAEFFE1B22361800E1269D /* hq3x.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = hq3x.cpp; sourceTree = "<group>"; };
|
||||
ABAAFBE8172122B6005DDDBE /* FileMigrationDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileMigrationDelegate.h; sourceTree = "<group>"; };
|
||||
ABAAFBE9172122B6005DDDBE /* FileMigrationDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = FileMigrationDelegate.mm; sourceTree = "<group>"; };
|
||||
ABAB0AFD1F7C1BB70079EFD3 /* MacScreenshotCaptureTool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MacScreenshotCaptureTool.h; sourceTree = "<group>"; };
|
||||
ABAB0AFE1F7C1BB70079EFD3 /* MacScreenshotCaptureTool.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MacScreenshotCaptureTool.mm; sourceTree = "<group>"; };
|
||||
ABACB7391AAC46B20066F429 /* Icon_MicrophoneDarkGreen_256x256.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Icon_MicrophoneDarkGreen_256x256.png; path = images/Icon_MicrophoneDarkGreen_256x256.png; sourceTree = "<group>"; };
|
||||
ABAD104915ACE7A00000EC47 /* DeSmuME (PPC).app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "DeSmuME (PPC).app"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
ABAE2F7918682B6C00C92F4F /* Slot2WindowDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Slot2WindowDelegate.h; sourceTree = "<group>"; };
|
||||
|
@ -3017,6 +3024,7 @@
|
|||
AB3ACB6E14C2361100D7D192 /* inputPrefsView.h */,
|
||||
AB213D43170CB141006DDB0F /* InputProfileController.h */,
|
||||
AB3E690E1E231E9900D4CC75 /* MacOGLDisplayView.h */,
|
||||
ABAB0AFD1F7C1BB70079EFD3 /* MacScreenshotCaptureTool.h */,
|
||||
AB3ACB7014C2361100D7D192 /* preferencesWindowDelegate.h */,
|
||||
ABC3DEBB1A96EA96009EC345 /* RomInfoPanel.h */,
|
||||
ABAE2F7918682B6C00C92F4F /* Slot2WindowDelegate.h */,
|
||||
|
@ -3031,6 +3039,7 @@
|
|||
AB3ACB6F14C2361100D7D192 /* inputPrefsView.mm */,
|
||||
AB213D44170CB141006DDB0F /* InputProfileController.mm */,
|
||||
AB3E690F1E231E9900D4CC75 /* MacOGLDisplayView.mm */,
|
||||
ABAB0AFE1F7C1BB70079EFD3 /* MacScreenshotCaptureTool.mm */,
|
||||
AB3ACB7114C2361100D7D192 /* preferencesWindowDelegate.mm */,
|
||||
ABC3DEBC1A96EA96009EC345 /* RomInfoPanel.mm */,
|
||||
ABAE2F7A18682B6C00C92F4F /* Slot2WindowDelegate.mm */,
|
||||
|
@ -4617,6 +4626,7 @@
|
|||
ABC04DA41F67A20500EA6ED7 /* ClientInputHandler.cpp in Sources */,
|
||||
ABC04DCB1F67A2AC00EA6ED7 /* macosx_10_5_compat.cpp in Sources */,
|
||||
ABAFD2791F7110E6007705BD /* gdbstub.cpp in Sources */,
|
||||
ABAB0B001F7C1BB70079EFD3 /* MacScreenshotCaptureTool.mm in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
@ -4805,6 +4815,7 @@
|
|||
ABC04DA51F67A20500EA6ED7 /* ClientInputHandler.cpp in Sources */,
|
||||
ABC04DCC1F67A2AC00EA6ED7 /* macosx_10_5_compat.cpp in Sources */,
|
||||
ABAFD2781F7110E5007705BD /* gdbstub.cpp in Sources */,
|
||||
ABAB0B011F7C1BB70079EFD3 /* MacScreenshotCaptureTool.mm in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
@ -5023,6 +5034,7 @@
|
|||
ABC04DA31F67A20500EA6ED7 /* ClientInputHandler.cpp in Sources */,
|
||||
ABC04DCA1F67A2AC00EA6ED7 /* macosx_10_5_compat.cpp in Sources */,
|
||||
ABAFD2751F7110E4007705BD /* gdbstub.cpp in Sources */,
|
||||
ABAB0AFF1F7C1BB70079EFD3 /* MacScreenshotCaptureTool.mm in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
@ -5241,6 +5253,7 @@
|
|||
ABC04DA71F67A20500EA6ED7 /* ClientInputHandler.cpp in Sources */,
|
||||
ABC04DCE1F67A2AC00EA6ED7 /* macosx_10_5_compat.cpp in Sources */,
|
||||
ABAFD2761F7110E4007705BD /* gdbstub.cpp in Sources */,
|
||||
ABAB0B031F7C1BB70079EFD3 /* MacScreenshotCaptureTool.mm in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
@ -5429,6 +5442,7 @@
|
|||
ABC04DA61F67A20500EA6ED7 /* ClientInputHandler.cpp in Sources */,
|
||||
ABC04DCD1F67A2AC00EA6ED7 /* macosx_10_5_compat.cpp in Sources */,
|
||||
ABAFD2771F7110E5007705BD /* gdbstub.cpp in Sources */,
|
||||
ABAB0B021F7C1BB70079EFD3 /* MacScreenshotCaptureTool.mm in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
|
|
@ -752,6 +752,26 @@
|
|||
<integer>0</integer>
|
||||
<key>RomInfoPanel_SectionViewState</key>
|
||||
<dict/>
|
||||
<key>ScreenshotCaptureTool_DirectoryPath</key>
|
||||
<string>~/Pictures</string>
|
||||
<key>ScreenshotCaptureTool_FileFormat</key>
|
||||
<integer>0</integer>
|
||||
<key>ScreenshotCaptureTool_DisplayMode</key>
|
||||
<integer>2</integer>
|
||||
<key>ScreenshotCaptureTool_DisplayRotation</key>
|
||||
<integer>0</integer>
|
||||
<key>ScreenshotCaptureTool_DisplaySeparation</key>
|
||||
<integer>0</integer>
|
||||
<key>ScreenshotCaptureTool_DisplayLayout</key>
|
||||
<integer>0</integer>
|
||||
<key>ScreenshotCaptureTool_DisplayOrder</key>
|
||||
<integer>0</integer>
|
||||
<key>ScreenshotCaptureTool_Deposterize</key>
|
||||
<false/>
|
||||
<key>ScreenshotCaptureTool_OutputFilter</key>
|
||||
<integer>1</integer>
|
||||
<key>ScreenshotCaptureTool_PixelScaler</key>
|
||||
<integer>0</integer>
|
||||
<key>Slot2_GBA_CartridgePath</key>
|
||||
<string></string>
|
||||
<key>Slot2_GBA_SRAMPath</key>
|
||||
|
|
|
@ -5019,15 +5019,17 @@ void OGLClientFetchObject::_FetchCustomDisplayByID(const NDSDisplayID displayID,
|
|||
OGLVideoOutput::OGLVideoOutput()
|
||||
{
|
||||
_contextInfo = NULL;
|
||||
_viewportWidth = GPU_FRAMEBUFFER_NATIVE_WIDTH;
|
||||
_viewportHeight = GPU_FRAMEBUFFER_NATIVE_HEIGHT * 2;
|
||||
_needUpdateViewport = true;
|
||||
_hasOGLPixelScaler = false;
|
||||
_layerList = new std::vector<OGLVideoLayer *>;
|
||||
_layerList->reserve(8);
|
||||
|
||||
_texCPUFilterDstID[NDSDisplayID_Main] = 0;
|
||||
_texCPUFilterDstID[NDSDisplayID_Touch] = 0;
|
||||
|
||||
_fboFrameCopyID = 0;
|
||||
|
||||
_layerList = new std::vector<OGLVideoLayer *>;
|
||||
_layerList->reserve(8);
|
||||
}
|
||||
|
||||
OGLVideoOutput::~OGLVideoOutput()
|
||||
|
@ -5073,12 +5075,12 @@ void OGLVideoOutput::_UpdateClientSize()
|
|||
this->_needUpdateViewport = true;
|
||||
|
||||
this->GetHUDLayer()->SetNeedsUpdateVertices();
|
||||
this->ClientDisplay3DView::_UpdateClientSize();
|
||||
this->ClientDisplay3DPresenter::_UpdateClientSize();
|
||||
}
|
||||
|
||||
void OGLVideoOutput::_UpdateViewScale()
|
||||
{
|
||||
this->ClientDisplayView::_UpdateViewScale();
|
||||
this->ClientDisplay3DPresenter::_UpdateViewScale();
|
||||
|
||||
for (size_t i = 0; i < _layerList->size(); i++)
|
||||
{
|
||||
|
@ -5109,7 +5111,7 @@ void OGLVideoOutput::_ResizeCPUPixelScaler(const VideoFilterTypeID filterID)
|
|||
|
||||
glFinish();
|
||||
|
||||
this->ClientDisplay3DView::_ResizeCPUPixelScaler(filterID);
|
||||
this->ClientDisplay3DPresenter::_ResizeCPUPixelScaler(filterID);
|
||||
|
||||
glTextureRangeAPPLE(GL_TEXTURE_RECTANGLE_ARB, this->_vfMasterDstBufferSize, this->_vfMasterDstBuffer);
|
||||
glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE);
|
||||
|
@ -5199,7 +5201,7 @@ void OGLVideoOutput::SetOutputFilter(const OutputFilterTypeID filterID)
|
|||
|
||||
void OGLVideoOutput::SetPixelScaler(const VideoFilterTypeID filterID)
|
||||
{
|
||||
this->ClientDisplay3DView::SetPixelScaler(filterID);
|
||||
this->ClientDisplay3DPresenter::SetPixelScaler(filterID);
|
||||
|
||||
this->_hasOGLPixelScaler = this->GetDisplayLayer()->SetGPUPixelScalerOGL(this->_pixelScaler);
|
||||
this->_willFilterOnGPU = (this->GetFiltersPreferGPU()) ? this->_hasOGLPixelScaler : false;
|
||||
|
@ -5213,7 +5215,7 @@ void OGLVideoOutput::CopyHUDFont(const FT_Face &fontFace, const size_t glyphSize
|
|||
void OGLVideoOutput::SetHUDVisibility(const bool visibleState)
|
||||
{
|
||||
this->GetHUDLayer()->SetVisibility(visibleState);
|
||||
this->ClientDisplay3DView::SetHUDVisibility(visibleState);
|
||||
this->ClientDisplay3DPresenter::SetHUDVisibility(visibleState);
|
||||
}
|
||||
|
||||
void OGLVideoOutput::SetFiltersPreferGPU(const bool preferGPU)
|
||||
|
@ -5271,12 +5273,6 @@ void OGLVideoOutput::FinishFrameAtIndex(const uint8_t bufferIndex)
|
|||
|
||||
void OGLVideoOutput::CopyFrameToBuffer(uint32_t *dstBuffer)
|
||||
{
|
||||
for (size_t i = 0; i < _layerList->size(); i++)
|
||||
{
|
||||
OGLVideoLayer *theLayer = (*_layerList)[i];
|
||||
theLayer->SetNeedsUpdateViewport();
|
||||
}
|
||||
|
||||
GLuint texFrameCopyID = 0;
|
||||
|
||||
glGenTextures(1, &texFrameCopyID);
|
||||
|
@ -5290,6 +5286,7 @@ void OGLVideoOutput::CopyFrameToBuffer(uint32_t *dstBuffer)
|
|||
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, this->_fboFrameCopyID);
|
||||
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_RECTANGLE_ARB, texFrameCopyID, 0);
|
||||
|
||||
this->_needUpdateViewport = true;
|
||||
this->RenderFrameOGL(true);
|
||||
glReadPixels(0, 0, this->_renderProperty.clientWidth, this->_renderProperty.clientHeight, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, dstBuffer);
|
||||
|
||||
|
@ -5297,11 +5294,7 @@ void OGLVideoOutput::CopyFrameToBuffer(uint32_t *dstBuffer)
|
|||
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, 0);
|
||||
glDeleteTextures(1, &texFrameCopyID);
|
||||
|
||||
for (size_t i = 0; i < _layerList->size(); i++)
|
||||
{
|
||||
OGLVideoLayer *theLayer = (*_layerList)[i];
|
||||
theLayer->SetNeedsUpdateViewport();
|
||||
}
|
||||
this->_needUpdateViewport = true;
|
||||
}
|
||||
|
||||
void OGLVideoOutput::RenderFrameOGL(bool isRenderingFlipped)
|
||||
|
@ -5834,7 +5827,7 @@ void OGLImage::UploadTransformationOGL()
|
|||
{
|
||||
const double w = this->_viewportWidth;
|
||||
const double h = this->_viewportHeight;
|
||||
const GLdouble s = ClientDisplayView::GetMaxScalarWithinBounds(this->_normalWidth, this->_normalHeight, w, h);
|
||||
const GLdouble s = ClientDisplayPresenter::GetMaxScalarWithinBounds(this->_normalWidth, this->_normalHeight, w, h);
|
||||
|
||||
if (this->_canUseShaderOutput)
|
||||
{
|
||||
|
@ -6560,7 +6553,7 @@ void OGLHUDLayer::RenderOGL(bool isRenderingFlipped)
|
|||
|
||||
if (this->_needUpdateViewport)
|
||||
{
|
||||
glUniform2f(this->_uniformViewSize, this->_output->GetViewProperties().clientWidth, this->_output->GetViewProperties().clientHeight);
|
||||
glUniform2f(this->_uniformViewSize, this->_output->GetPresenterProperties().clientWidth, this->_output->GetPresenterProperties().clientHeight);
|
||||
glUniform1i(this->_uniformRenderFlipped, (isRenderingFlipped) ? GL_TRUE : GL_FALSE);
|
||||
this->_needUpdateViewport = false;
|
||||
}
|
||||
|
@ -6577,7 +6570,7 @@ void OGLHUDLayer::RenderOGL(bool isRenderingFlipped)
|
|||
// First, draw the inputs.
|
||||
if (this->_output->GetHUDShowInput())
|
||||
{
|
||||
const ClientDisplayViewProperties &cdv = this->_output->GetViewProperties();
|
||||
const ClientDisplayPresenterProperties &cdv = this->_output->GetPresenterProperties();
|
||||
|
||||
if (this->_output->GetContextInfo()->IsShaderSupported())
|
||||
{
|
||||
|
@ -6776,7 +6769,7 @@ OGLDisplayLayer::~OGLDisplayLayer()
|
|||
|
||||
void OGLDisplayLayer::_UpdateRotationScaleOGL()
|
||||
{
|
||||
const ClientDisplayViewProperties &cdv = this->_output->GetViewProperties();
|
||||
const ClientDisplayPresenterProperties &cdv = this->_output->GetPresenterProperties();
|
||||
const double r = cdv.rotation;
|
||||
const double s = cdv.viewScale;
|
||||
|
||||
|
@ -7140,7 +7133,7 @@ void OGLDisplayLayer::ProcessOGL()
|
|||
{
|
||||
const OGLClientFetchObject &fetchObj = (const OGLClientFetchObject &)this->_output->GetFetchObject();
|
||||
const NDSDisplayInfo &emuDisplayInfo = this->_output->GetEmuDisplayInfo();
|
||||
const ClientDisplayMode mode = this->_output->GetViewProperties().mode;
|
||||
const ClientDisplayMode mode = this->_output->GetPresenterProperties().mode;
|
||||
const NDSDisplayID selectedDisplaySource[2] = { this->_output->GetSelectedDisplaySourceForDisplay(NDSDisplayID_Main), this->_output->GetSelectedDisplaySourceForDisplay(NDSDisplayID_Touch) };
|
||||
|
||||
const bool didRenderNative[2] = { !emuDisplayInfo.didPerformCustomRender[selectedDisplaySource[NDSDisplayID_Main]], !emuDisplayInfo.didPerformCustomRender[selectedDisplaySource[NDSDisplayID_Touch]] };
|
||||
|
@ -7259,7 +7252,7 @@ void OGLDisplayLayer::RenderOGL(bool isRenderingFlipped)
|
|||
this->_output->LockDisplayTextures();
|
||||
glBindVertexArrayDESMUME(this->_vaoMainStatesID);
|
||||
|
||||
switch (this->_output->GetViewProperties().mode)
|
||||
switch (this->_output->GetPresenterProperties().mode)
|
||||
{
|
||||
case ClientDisplayMode_Main:
|
||||
{
|
||||
|
@ -7287,10 +7280,10 @@ void OGLDisplayLayer::RenderOGL(bool isRenderingFlipped)
|
|||
|
||||
case ClientDisplayMode_Dual:
|
||||
{
|
||||
const NDSDisplayID majorDisplayID = (this->_output->GetViewProperties().order == ClientDisplayOrder_MainFirst) ? NDSDisplayID_Main : NDSDisplayID_Touch;
|
||||
const size_t majorDisplayVtx = (this->_output->GetViewProperties().order == ClientDisplayOrder_MainFirst) ? 8 : 12;
|
||||
const NDSDisplayID majorDisplayID = (this->_output->GetPresenterProperties().order == ClientDisplayOrder_MainFirst) ? NDSDisplayID_Main : NDSDisplayID_Touch;
|
||||
const size_t majorDisplayVtx = (this->_output->GetPresenterProperties().order == ClientDisplayOrder_MainFirst) ? 8 : 12;
|
||||
|
||||
switch (this->_output->GetViewProperties().layout)
|
||||
switch (this->_output->GetPresenterProperties().layout)
|
||||
{
|
||||
case ClientDisplayLayout_Hybrid_2_1:
|
||||
case ClientDisplayLayout_Hybrid_16_9:
|
||||
|
|
|
@ -373,7 +373,7 @@ public:
|
|||
virtual void SetFetchBuffers(const NDSDisplayInfo ¤tDisplayInfo);
|
||||
};
|
||||
|
||||
class OGLVideoOutput : public ClientDisplay3DView
|
||||
class OGLVideoOutput : public ClientDisplay3DPresenter
|
||||
{
|
||||
protected:
|
||||
OGLContextInfo *_contextInfo;
|
||||
|
@ -381,10 +381,12 @@ protected:
|
|||
GLsizei _viewportHeight;
|
||||
bool _needUpdateViewport;
|
||||
bool _hasOGLPixelScaler;
|
||||
std::vector<OGLVideoLayer *> *_layerList;
|
||||
|
||||
GLuint _texCPUFilterDstID[2];
|
||||
GLuint _fboFrameCopyID;
|
||||
|
||||
std::vector<OGLVideoLayer *> *_layerList;
|
||||
|
||||
void _UpdateViewport();
|
||||
|
||||
virtual void _UpdateNormalSize();
|
||||
|
|
|
@ -62,12 +62,10 @@ typedef std::map<CGDirectDisplayID, int64_t> DisplayLinkFlushTimeLimitMap;
|
|||
@property (assign, nonatomic) GPUClientFetchObject *GPUFetchObject;
|
||||
@property (readonly, nonatomic) volatile int32_t numberViewsUsingDirectToCPUFiltering;
|
||||
|
||||
- (const NDSDisplayInfo &) fetchDisplayInfoForIndex:(const u8)bufferIndex;
|
||||
- (pthread_rwlock_t *) rwlockFramebufferAtIndex:(const u8)bufferIndex;
|
||||
- (void) setOutputList:(NSMutableArray *)theOutputList mutex:(pthread_mutex_t *)theMutex;
|
||||
- (void) incrementViewsUsingDirectToCPUFiltering;
|
||||
- (void) decrementViewsUsingDirectToCPUFiltering;
|
||||
- (void) handleFetchFromBufferIndexAndPushVideo:(NSData *)indexData;
|
||||
- (void) pushVideoDataToAllDisplayViews;
|
||||
- (void) finishAllDisplayViewsAtIndex:(const u8)bufferIndex;
|
||||
- (void) flushAllDisplaysOnDisplayLink:(CVDisplayLinkRef)displayLink timeStamp:(const CVTimeStamp *)timeStamp;
|
||||
|
|
|
@ -950,19 +950,6 @@ public:
|
|||
[super dealloc];
|
||||
}
|
||||
|
||||
- (void) handleFetchFromBufferIndexAndPushVideo:(NSData *)indexData
|
||||
{
|
||||
const NSInteger index = *(NSInteger *)[indexData bytes];
|
||||
|
||||
GPUFetchObject->FetchFromBufferIndex(index);
|
||||
[self pushVideoDataToAllDisplayViews];
|
||||
}
|
||||
|
||||
- (const NDSDisplayInfo &) fetchDisplayInfoForIndex:(const u8)bufferIndex
|
||||
{
|
||||
return GPUFetchObject->GetFetchDisplayInfoForBufferIndex(bufferIndex);
|
||||
}
|
||||
|
||||
- (pthread_rwlock_t *) rwlockFramebufferAtIndex:(const u8)bufferIndex
|
||||
{
|
||||
return _rwlockFramebuffer[bufferIndex];
|
||||
|
@ -1035,8 +1022,8 @@ public:
|
|||
{
|
||||
if ([cdsOutput isKindOfClass:[CocoaDSDisplayVideo class]])
|
||||
{
|
||||
ClientDisplay3DView *cdv = [(CocoaDSDisplayVideo *)cdsOutput clientDisplayView];
|
||||
cdv->FinishFrameAtIndex(bufferIndex);
|
||||
ClientDisplay3DView *cdv = [(CocoaDSDisplayVideo *)cdsOutput clientDisplay3DView];
|
||||
cdv->Get3DPresenter()->FinishFrameAtIndex(bufferIndex);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1063,7 +1050,7 @@ public:
|
|||
{
|
||||
if ([(CocoaDSDisplayVideo *)cdsOutput currentDisplayID] == displayID)
|
||||
{
|
||||
ClientDisplay3DView *cdv = [(CocoaDSDisplayVideo *)cdsOutput clientDisplayView];
|
||||
ClientDisplay3DView *cdv = [(CocoaDSDisplayVideo *)cdsOutput clientDisplay3DView];
|
||||
|
||||
if (cdv->GetViewNeedsFlush())
|
||||
{
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
#define NSSTRING_TITLE_SELECT_MPCF_DISK_IMAGE_PANEL NSLocalizedString(@"Select MPCF Disk Image", nil)
|
||||
#define NSSTRING_TITLE_CHOOSE_GBA_CARTRIDGE_PANEL NSLocalizedString(@"Choose GBA Cartridge", nil)
|
||||
#define NSSTRING_TITLE_CHOOSE_GBA_SRAM_PANEL NSLocalizedString(@"Choose GBA SRAM File", nil)
|
||||
#define NSSTRING_TITLE_SAVE_SCREENSHOT_PANEL NSLocalizedString(@"Save Screenshot", nil)
|
||||
#define NSSTRING_TITLE_SAVE_SCREENSHOT_PANEL NSLocalizedString(@"Screenshot Save Location", nil)
|
||||
|
||||
#define NSSTRING_TITLE_EXECUTE_CONTROL NSLocalizedString(@"Execute", nil)
|
||||
#define NSSTRING_TITLE_PAUSE_CONTROL NSLocalizedString(@"Pause", nil)
|
||||
|
@ -367,7 +367,6 @@ enum
|
|||
MESSAGE_SET_SPU_INTERPOLATION_MODE,
|
||||
MESSAGE_SET_VOLUME,
|
||||
|
||||
MESSAGE_REQUEST_SCREENSHOT,
|
||||
MESSAGE_COPY_TO_PASTEBOARD
|
||||
};
|
||||
|
||||
|
|
|
@ -116,7 +116,7 @@
|
|||
@interface CocoaDSDisplayVideo : CocoaDSDisplay
|
||||
{
|
||||
ClientDisplay3DView *_cdv;
|
||||
ClientDisplayViewProperties _intermediateViewProps;
|
||||
ClientDisplayPresenterProperties _intermediateViewProps;
|
||||
|
||||
OSSpinLock spinlockViewProperties;
|
||||
OSSpinLock spinlockIsHUDVisible;
|
||||
|
@ -129,7 +129,7 @@
|
|||
OSSpinLock spinlockDisplayID;
|
||||
}
|
||||
|
||||
@property (assign, nonatomic) ClientDisplay3DView *clientDisplayView;
|
||||
@property (assign, nonatomic, getter=clientDisplay3DView, setter=setClientDisplay3DView:) ClientDisplay3DView *_cdv;
|
||||
@property (readonly, nonatomic) BOOL canFilterOnGPU;
|
||||
@property (readonly, nonatomic) BOOL willFilterOnGPU;
|
||||
@property (assign) BOOL isHUDVisible;
|
||||
|
@ -158,7 +158,7 @@
|
|||
@property (assign) NSInteger outputFilter;
|
||||
@property (assign) NSInteger pixelScaler;
|
||||
|
||||
- (void) commitViewProperties:(const ClientDisplayViewProperties &)viewProps;
|
||||
- (void) commitPresenterProperties:(const ClientDisplayPresenterProperties &)viewProps;
|
||||
|
||||
- (void) handleChangeViewProperties;
|
||||
- (void) handleReceiveGPUFrame;
|
||||
|
@ -166,12 +166,9 @@
|
|||
- (void) handleReprocessRedraw;
|
||||
- (void) handleRedraw;
|
||||
- (void) handleCopyToPasteboard;
|
||||
- (void) handleRequestScreenshot:(NSData *)fileURLStringData fileTypeData:(NSData *)fileTypeData;
|
||||
|
||||
- (void) setScaleFactor:(float)theScaleFactor;
|
||||
- (void) hudUpdate;
|
||||
- (NSImage *) copyImageFromView;
|
||||
- (NSImage *) image;
|
||||
- (NSBitmapImageRep *) bitmapImageRep;
|
||||
|
||||
@end
|
||||
|
|
|
@ -568,7 +568,7 @@
|
|||
|
||||
@implementation CocoaDSDisplayVideo
|
||||
|
||||
@dynamic clientDisplayView;
|
||||
@synthesize _cdv;
|
||||
@dynamic canFilterOnGPU;
|
||||
@dynamic willFilterOnGPU;
|
||||
@dynamic isHUDVisible;
|
||||
|
@ -625,17 +625,7 @@
|
|||
[super dealloc];
|
||||
}
|
||||
|
||||
- (void) setClientDisplayView:(ClientDisplay3DView *)clientDisplayView
|
||||
{
|
||||
_cdv = clientDisplayView;
|
||||
}
|
||||
|
||||
- (ClientDisplay3DView *) clientDisplayView
|
||||
{
|
||||
return _cdv;
|
||||
}
|
||||
|
||||
- (void) commitViewProperties:(const ClientDisplayViewProperties &)viewProps
|
||||
- (void) commitPresenterProperties:(const ClientDisplayPresenterProperties &)viewProps
|
||||
{
|
||||
OSSpinLockLock(&spinlockViewProperties);
|
||||
_intermediateViewProps = viewProps;
|
||||
|
@ -646,25 +636,27 @@
|
|||
|
||||
- (BOOL) canFilterOnGPU
|
||||
{
|
||||
return (_cdv->CanFilterOnGPU()) ? YES : NO;
|
||||
return (_cdv->Get3DPresenter()->CanFilterOnGPU()) ? YES : NO;
|
||||
}
|
||||
|
||||
- (BOOL) willFilterOnGPU
|
||||
{
|
||||
return (_cdv->WillFilterOnGPU()) ? YES : NO;
|
||||
return (_cdv->Get3DPresenter()->WillFilterOnGPU()) ? YES : NO;
|
||||
}
|
||||
|
||||
- (void) setIsHUDVisible:(BOOL)theState
|
||||
{
|
||||
OSSpinLockLock(&spinlockIsHUDVisible);
|
||||
_cdv->SetHUDVisibility((theState) ? true : false);
|
||||
_cdv->Get3DPresenter()->SetHUDVisibility((theState) ? true : false);
|
||||
OSSpinLockUnlock(&spinlockIsHUDVisible);
|
||||
|
||||
_cdv->SetViewNeedsFlush();
|
||||
}
|
||||
|
||||
- (BOOL) isHUDVisible
|
||||
{
|
||||
OSSpinLockLock(&spinlockIsHUDVisible);
|
||||
const BOOL theState = (_cdv->GetHUDVisibility()) ? YES : NO;
|
||||
const BOOL theState = (_cdv->Get3DPresenter()->GetHUDVisibility()) ? YES : NO;
|
||||
OSSpinLockUnlock(&spinlockIsHUDVisible);
|
||||
|
||||
return theState;
|
||||
|
@ -673,14 +665,16 @@
|
|||
- (void) setIsHUDVideoFPSVisible:(BOOL)theState
|
||||
{
|
||||
OSSpinLockLock(&spinlockIsHUDVisible);
|
||||
_cdv->SetHUDShowVideoFPS((theState) ? true : false);
|
||||
_cdv->Get3DPresenter()->SetHUDShowVideoFPS((theState) ? true : false);
|
||||
OSSpinLockUnlock(&spinlockIsHUDVisible);
|
||||
|
||||
_cdv->SetViewNeedsFlush();
|
||||
}
|
||||
|
||||
- (BOOL) isHUDVideoFPSVisible
|
||||
{
|
||||
OSSpinLockLock(&spinlockIsHUDVisible);
|
||||
const BOOL theState = (_cdv->GetHUDShowVideoFPS()) ? YES : NO;
|
||||
const BOOL theState = (_cdv->Get3DPresenter()->GetHUDShowVideoFPS()) ? YES : NO;
|
||||
OSSpinLockUnlock(&spinlockIsHUDVisible);
|
||||
|
||||
return theState;
|
||||
|
@ -689,14 +683,16 @@
|
|||
- (void) setIsHUDRender3DFPSVisible:(BOOL)theState
|
||||
{
|
||||
OSSpinLockLock(&spinlockIsHUDVisible);
|
||||
_cdv->SetHUDShowRender3DFPS((theState) ? true : false);
|
||||
_cdv->Get3DPresenter()->SetHUDShowRender3DFPS((theState) ? true : false);
|
||||
OSSpinLockUnlock(&spinlockIsHUDVisible);
|
||||
|
||||
_cdv->SetViewNeedsFlush();
|
||||
}
|
||||
|
||||
- (BOOL) isHUDRender3DFPSVisible
|
||||
{
|
||||
OSSpinLockLock(&spinlockIsHUDVisible);
|
||||
const BOOL theState = (_cdv->GetHUDShowRender3DFPS()) ? YES : NO;
|
||||
const BOOL theState = (_cdv->Get3DPresenter()->GetHUDShowRender3DFPS()) ? YES : NO;
|
||||
OSSpinLockUnlock(&spinlockIsHUDVisible);
|
||||
|
||||
return theState;
|
||||
|
@ -705,14 +701,16 @@
|
|||
- (void) setIsHUDFrameIndexVisible:(BOOL)theState
|
||||
{
|
||||
OSSpinLockLock(&spinlockIsHUDVisible);
|
||||
_cdv->SetHUDShowFrameIndex((theState) ? true : false);
|
||||
_cdv->Get3DPresenter()->SetHUDShowFrameIndex((theState) ? true : false);
|
||||
OSSpinLockUnlock(&spinlockIsHUDVisible);
|
||||
|
||||
_cdv->SetViewNeedsFlush();
|
||||
}
|
||||
|
||||
- (BOOL) isHUDFrameIndexVisible
|
||||
{
|
||||
OSSpinLockLock(&spinlockIsHUDVisible);
|
||||
const BOOL theState = (_cdv->GetHUDShowFrameIndex()) ? YES : NO;
|
||||
const BOOL theState = (_cdv->Get3DPresenter()->GetHUDShowFrameIndex()) ? YES : NO;
|
||||
OSSpinLockUnlock(&spinlockIsHUDVisible);
|
||||
|
||||
return theState;
|
||||
|
@ -721,14 +719,16 @@
|
|||
- (void) setIsHUDLagFrameCountVisible:(BOOL)theState
|
||||
{
|
||||
OSSpinLockLock(&spinlockIsHUDVisible);
|
||||
_cdv->SetHUDShowLagFrameCount((theState) ? true : false);
|
||||
_cdv->Get3DPresenter()->SetHUDShowLagFrameCount((theState) ? true : false);
|
||||
OSSpinLockUnlock(&spinlockIsHUDVisible);
|
||||
|
||||
_cdv->SetViewNeedsFlush();
|
||||
}
|
||||
|
||||
- (BOOL) isHUDLagFrameCountVisible
|
||||
{
|
||||
OSSpinLockLock(&spinlockIsHUDVisible);
|
||||
const BOOL theState = (_cdv->GetHUDShowLagFrameCount()) ? YES : NO;
|
||||
const BOOL theState = (_cdv->Get3DPresenter()->GetHUDShowLagFrameCount()) ? YES : NO;
|
||||
OSSpinLockUnlock(&spinlockIsHUDVisible);
|
||||
|
||||
return theState;
|
||||
|
@ -737,14 +737,16 @@
|
|||
- (void) setIsHUDCPULoadAverageVisible:(BOOL)theState
|
||||
{
|
||||
OSSpinLockLock(&spinlockIsHUDVisible);
|
||||
_cdv->SetHUDShowCPULoadAverage((theState) ? true : false);
|
||||
_cdv->Get3DPresenter()->SetHUDShowCPULoadAverage((theState) ? true : false);
|
||||
OSSpinLockUnlock(&spinlockIsHUDVisible);
|
||||
|
||||
_cdv->SetViewNeedsFlush();
|
||||
}
|
||||
|
||||
- (BOOL) isHUDCPULoadAverageVisible
|
||||
{
|
||||
OSSpinLockLock(&spinlockIsHUDVisible);
|
||||
const BOOL theState = (_cdv->GetHUDShowCPULoadAverage()) ? YES : NO;
|
||||
const BOOL theState = (_cdv->Get3DPresenter()->GetHUDShowCPULoadAverage()) ? YES : NO;
|
||||
OSSpinLockUnlock(&spinlockIsHUDVisible);
|
||||
|
||||
return theState;
|
||||
|
@ -753,14 +755,16 @@
|
|||
- (void) setIsHUDRealTimeClockVisible:(BOOL)theState
|
||||
{
|
||||
OSSpinLockLock(&spinlockIsHUDVisible);
|
||||
_cdv->SetHUDShowRTC((theState) ? true : false);
|
||||
_cdv->Get3DPresenter()->SetHUDShowRTC((theState) ? true : false);
|
||||
OSSpinLockUnlock(&spinlockIsHUDVisible);
|
||||
|
||||
_cdv->SetViewNeedsFlush();
|
||||
}
|
||||
|
||||
- (BOOL) isHUDRealTimeClockVisible
|
||||
{
|
||||
OSSpinLockLock(&spinlockIsHUDVisible);
|
||||
const BOOL theState = (_cdv->GetHUDShowRTC()) ? YES : NO;
|
||||
const BOOL theState = (_cdv->Get3DPresenter()->GetHUDShowRTC()) ? YES : NO;
|
||||
OSSpinLockUnlock(&spinlockIsHUDVisible);
|
||||
|
||||
return theState;
|
||||
|
@ -769,14 +773,16 @@
|
|||
- (void) setIsHUDInputVisible:(BOOL)theState
|
||||
{
|
||||
OSSpinLockLock(&spinlockIsHUDVisible);
|
||||
_cdv->SetHUDShowInput((theState) ? true : false);
|
||||
_cdv->Get3DPresenter()->SetHUDShowInput((theState) ? true : false);
|
||||
OSSpinLockUnlock(&spinlockIsHUDVisible);
|
||||
|
||||
_cdv->SetViewNeedsFlush();
|
||||
}
|
||||
|
||||
- (BOOL) isHUDInputVisible
|
||||
{
|
||||
OSSpinLockLock(&spinlockIsHUDVisible);
|
||||
const BOOL theState = (_cdv->GetHUDShowInput()) ? YES : NO;
|
||||
const BOOL theState = (_cdv->Get3DPresenter()->GetHUDShowInput()) ? YES : NO;
|
||||
OSSpinLockUnlock(&spinlockIsHUDVisible);
|
||||
|
||||
return theState;
|
||||
|
@ -785,14 +791,16 @@
|
|||
- (void) setHudColorVideoFPS:(uint32_t)theColor
|
||||
{
|
||||
OSSpinLockLock(&spinlockIsHUDVisible);
|
||||
_cdv->SetHUDColorVideoFPS(theColor);
|
||||
_cdv->Get3DPresenter()->SetHUDColorVideoFPS(theColor);
|
||||
OSSpinLockUnlock(&spinlockIsHUDVisible);
|
||||
|
||||
_cdv->SetViewNeedsFlush();
|
||||
}
|
||||
|
||||
- (uint32_t) hudColorVideoFPS
|
||||
{
|
||||
OSSpinLockLock(&spinlockIsHUDVisible);
|
||||
const uint32_t color32 = _cdv->GetHUDColorVideoFPS();
|
||||
const uint32_t color32 = _cdv->Get3DPresenter()->GetHUDColorVideoFPS();
|
||||
OSSpinLockUnlock(&spinlockIsHUDVisible);
|
||||
|
||||
return color32;
|
||||
|
@ -801,14 +809,16 @@
|
|||
- (void) setHudColorRender3DFPS:(uint32_t)theColor
|
||||
{
|
||||
OSSpinLockLock(&spinlockIsHUDVisible);
|
||||
_cdv->SetHUDColorRender3DFPS(theColor);
|
||||
_cdv->Get3DPresenter()->SetHUDColorRender3DFPS(theColor);
|
||||
OSSpinLockUnlock(&spinlockIsHUDVisible);
|
||||
|
||||
_cdv->SetViewNeedsFlush();
|
||||
}
|
||||
|
||||
- (uint32_t) hudColorRender3DFPS
|
||||
{
|
||||
OSSpinLockLock(&spinlockIsHUDVisible);
|
||||
const uint32_t color32 = _cdv->GetHUDColorRender3DFPS();
|
||||
const uint32_t color32 = _cdv->Get3DPresenter()->GetHUDColorRender3DFPS();
|
||||
OSSpinLockUnlock(&spinlockIsHUDVisible);
|
||||
|
||||
return color32;
|
||||
|
@ -817,14 +827,16 @@
|
|||
- (void) setHudColorFrameIndex:(uint32_t)theColor
|
||||
{
|
||||
OSSpinLockLock(&spinlockIsHUDVisible);
|
||||
_cdv->SetHUDColorFrameIndex(theColor);
|
||||
_cdv->Get3DPresenter()->SetHUDColorFrameIndex(theColor);
|
||||
OSSpinLockUnlock(&spinlockIsHUDVisible);
|
||||
|
||||
_cdv->SetViewNeedsFlush();
|
||||
}
|
||||
|
||||
- (uint32_t) hudColorFrameIndex
|
||||
{
|
||||
OSSpinLockLock(&spinlockIsHUDVisible);
|
||||
const uint32_t color32 = _cdv->GetHUDColorFrameIndex();
|
||||
const uint32_t color32 = _cdv->Get3DPresenter()->GetHUDColorFrameIndex();
|
||||
OSSpinLockUnlock(&spinlockIsHUDVisible);
|
||||
|
||||
return color32;
|
||||
|
@ -833,14 +845,16 @@
|
|||
- (void) setHudColorLagFrameCount:(uint32_t)theColor
|
||||
{
|
||||
OSSpinLockLock(&spinlockIsHUDVisible);
|
||||
_cdv->SetHUDColorLagFrameCount(theColor);
|
||||
_cdv->Get3DPresenter()->SetHUDColorLagFrameCount(theColor);
|
||||
OSSpinLockUnlock(&spinlockIsHUDVisible);
|
||||
|
||||
_cdv->SetViewNeedsFlush();
|
||||
}
|
||||
|
||||
- (uint32_t) hudColorLagFrameCount
|
||||
{
|
||||
OSSpinLockLock(&spinlockIsHUDVisible);
|
||||
const uint32_t color32 = _cdv->GetHUDColorLagFrameCount();
|
||||
const uint32_t color32 = _cdv->Get3DPresenter()->GetHUDColorLagFrameCount();
|
||||
OSSpinLockUnlock(&spinlockIsHUDVisible);
|
||||
|
||||
return color32;
|
||||
|
@ -849,14 +863,16 @@
|
|||
- (void) setHudColorCPULoadAverage:(uint32_t)theColor
|
||||
{
|
||||
OSSpinLockLock(&spinlockIsHUDVisible);
|
||||
_cdv->SetHUDColorCPULoadAverage(theColor);
|
||||
_cdv->Get3DPresenter()->SetHUDColorCPULoadAverage(theColor);
|
||||
OSSpinLockUnlock(&spinlockIsHUDVisible);
|
||||
|
||||
_cdv->SetViewNeedsFlush();
|
||||
}
|
||||
|
||||
- (uint32_t) hudColorCPULoadAverage
|
||||
{
|
||||
OSSpinLockLock(&spinlockIsHUDVisible);
|
||||
const uint32_t color32 = _cdv->GetHUDColorCPULoadAverage();
|
||||
const uint32_t color32 = _cdv->Get3DPresenter()->GetHUDColorCPULoadAverage();
|
||||
OSSpinLockUnlock(&spinlockIsHUDVisible);
|
||||
|
||||
return color32;
|
||||
|
@ -865,14 +881,16 @@
|
|||
- (void) setHudColorRTC:(uint32_t)theColor
|
||||
{
|
||||
OSSpinLockLock(&spinlockIsHUDVisible);
|
||||
_cdv->SetHUDColorRTC(theColor);
|
||||
_cdv->Get3DPresenter()->SetHUDColorRTC(theColor);
|
||||
OSSpinLockUnlock(&spinlockIsHUDVisible);
|
||||
|
||||
_cdv->SetViewNeedsFlush();
|
||||
}
|
||||
|
||||
- (uint32_t) hudColorRTC
|
||||
{
|
||||
OSSpinLockLock(&spinlockIsHUDVisible);
|
||||
const uint32_t color32 = _cdv->GetHUDColorRTC();
|
||||
const uint32_t color32 = _cdv->Get3DPresenter()->GetHUDColorRTC();
|
||||
OSSpinLockUnlock(&spinlockIsHUDVisible);
|
||||
|
||||
return color32;
|
||||
|
@ -881,14 +899,16 @@
|
|||
- (void) setHudColorInputPendingAndApplied:(uint32_t)theColor
|
||||
{
|
||||
OSSpinLockLock(&spinlockIsHUDVisible);
|
||||
_cdv->SetHUDColorInputPendingAndApplied(theColor);
|
||||
_cdv->Get3DPresenter()->SetHUDColorInputPendingAndApplied(theColor);
|
||||
OSSpinLockUnlock(&spinlockIsHUDVisible);
|
||||
|
||||
_cdv->SetViewNeedsFlush();
|
||||
}
|
||||
|
||||
- (uint32_t) hudColorInputPendingAndApplied
|
||||
{
|
||||
OSSpinLockLock(&spinlockIsHUDVisible);
|
||||
const uint32_t color32 = _cdv->GetHUDColorInputPendingAndApplied();
|
||||
const uint32_t color32 = _cdv->Get3DPresenter()->GetHUDColorInputPendingAndApplied();
|
||||
OSSpinLockUnlock(&spinlockIsHUDVisible);
|
||||
|
||||
return color32;
|
||||
|
@ -897,14 +917,16 @@
|
|||
- (void) setHudColorInputAppliedOnly:(uint32_t)theColor
|
||||
{
|
||||
OSSpinLockLock(&spinlockIsHUDVisible);
|
||||
_cdv->SetHUDColorInputAppliedOnly(theColor);
|
||||
_cdv->Get3DPresenter()->SetHUDColorInputAppliedOnly(theColor);
|
||||
OSSpinLockUnlock(&spinlockIsHUDVisible);
|
||||
|
||||
_cdv->SetViewNeedsFlush();
|
||||
}
|
||||
|
||||
- (uint32_t) hudColorInputAppliedOnly
|
||||
{
|
||||
OSSpinLockLock(&spinlockIsHUDVisible);
|
||||
const uint32_t color32 = _cdv->GetHUDColorInputAppliedOnly();
|
||||
const uint32_t color32 = _cdv->Get3DPresenter()->GetHUDColorInputAppliedOnly();
|
||||
OSSpinLockUnlock(&spinlockIsHUDVisible);
|
||||
|
||||
return color32;
|
||||
|
@ -913,14 +935,16 @@
|
|||
- (void) setHudColorInputPendingOnly:(uint32_t)theColor
|
||||
{
|
||||
OSSpinLockLock(&spinlockIsHUDVisible);
|
||||
_cdv->SetHUDColorInputPendingOnly(theColor);
|
||||
_cdv->Get3DPresenter()->SetHUDColorInputPendingOnly(theColor);
|
||||
OSSpinLockUnlock(&spinlockIsHUDVisible);
|
||||
|
||||
_cdv->SetViewNeedsFlush();
|
||||
}
|
||||
|
||||
- (uint32_t) hudColorInputPendingOnly
|
||||
{
|
||||
OSSpinLockLock(&spinlockIsHUDVisible);
|
||||
const uint32_t color32 = _cdv->GetHUDColorInputPendingOnly();
|
||||
const uint32_t color32 = _cdv->Get3DPresenter()->GetHUDColorInputPendingOnly();
|
||||
OSSpinLockUnlock(&spinlockIsHUDVisible);
|
||||
|
||||
return color32;
|
||||
|
@ -929,14 +953,16 @@
|
|||
- (void) setDisplayMainVideoSource:(NSInteger)displaySourceID
|
||||
{
|
||||
OSSpinLockLock(&spinlockDisplayVideoSource);
|
||||
_cdv->SetDisplayVideoSource(NDSDisplayID_Main, (ClientDisplaySource)displaySourceID);
|
||||
_cdv->Get3DPresenter()->SetDisplayVideoSource(NDSDisplayID_Main, (ClientDisplaySource)displaySourceID);
|
||||
OSSpinLockUnlock(&spinlockDisplayVideoSource);
|
||||
|
||||
_cdv->SetViewNeedsFlush();
|
||||
}
|
||||
|
||||
- (NSInteger) displayMainVideoSource
|
||||
{
|
||||
OSSpinLockLock(&spinlockDisplayVideoSource);
|
||||
const NSInteger displayVideoSource = _cdv->GetDisplayVideoSource(NDSDisplayID_Main);
|
||||
const NSInteger displayVideoSource = _cdv->Get3DPresenter()->GetDisplayVideoSource(NDSDisplayID_Main);
|
||||
OSSpinLockUnlock(&spinlockDisplayVideoSource);
|
||||
|
||||
return displayVideoSource;
|
||||
|
@ -945,14 +971,16 @@
|
|||
- (void) setDisplayTouchVideoSource:(NSInteger)displaySourceID
|
||||
{
|
||||
OSSpinLockLock(&spinlockDisplayVideoSource);
|
||||
_cdv->SetDisplayVideoSource(NDSDisplayID_Touch, (ClientDisplaySource)displaySourceID);
|
||||
_cdv->Get3DPresenter()->SetDisplayVideoSource(NDSDisplayID_Touch, (ClientDisplaySource)displaySourceID);
|
||||
OSSpinLockUnlock(&spinlockDisplayVideoSource);
|
||||
|
||||
_cdv->SetViewNeedsFlush();
|
||||
}
|
||||
|
||||
- (NSInteger) displayTouchVideoSource
|
||||
{
|
||||
OSSpinLockLock(&spinlockDisplayVideoSource);
|
||||
const NSInteger displayVideoSource = _cdv->GetDisplayVideoSource(NDSDisplayID_Touch);
|
||||
const NSInteger displayVideoSource = _cdv->Get3DPresenter()->GetDisplayVideoSource(NDSDisplayID_Touch);
|
||||
OSSpinLockUnlock(&spinlockDisplayVideoSource);
|
||||
|
||||
return displayVideoSource;
|
||||
|
@ -993,14 +1021,14 @@
|
|||
- (void) setVideoFiltersPreferGPU:(BOOL)theState
|
||||
{
|
||||
OSSpinLockLock(&spinlockVideoFiltersPreferGPU);
|
||||
_cdv->SetFiltersPreferGPU((theState) ? true : false);
|
||||
_cdv->Get3DPresenter()->SetFiltersPreferGPU((theState) ? true : false);
|
||||
OSSpinLockUnlock(&spinlockVideoFiltersPreferGPU);
|
||||
}
|
||||
|
||||
- (BOOL) videoFiltersPreferGPU
|
||||
{
|
||||
OSSpinLockLock(&spinlockVideoFiltersPreferGPU);
|
||||
const BOOL theState = (_cdv->GetFiltersPreferGPU()) ? YES : NO;
|
||||
const BOOL theState = (_cdv->Get3DPresenter()->GetFiltersPreferGPU()) ? YES : NO;
|
||||
OSSpinLockUnlock(&spinlockVideoFiltersPreferGPU);
|
||||
|
||||
return theState;
|
||||
|
@ -1009,14 +1037,14 @@
|
|||
- (void) setSourceDeposterize:(BOOL)theState
|
||||
{
|
||||
OSSpinLockLock(&spinlockSourceDeposterize);
|
||||
_cdv->SetSourceDeposterize((theState) ? true : false);
|
||||
_cdv->Get3DPresenter()->SetSourceDeposterize((theState) ? true : false);
|
||||
OSSpinLockUnlock(&spinlockSourceDeposterize);
|
||||
}
|
||||
|
||||
- (BOOL) sourceDeposterize
|
||||
{
|
||||
OSSpinLockLock(&spinlockSourceDeposterize);
|
||||
const BOOL theState = (_cdv->GetSourceDeposterize()) ? YES : NO;
|
||||
const BOOL theState = (_cdv->Get3DPresenter()->GetSourceDeposterize()) ? YES : NO;
|
||||
OSSpinLockUnlock(&spinlockSourceDeposterize);
|
||||
|
||||
return theState;
|
||||
|
@ -1025,14 +1053,14 @@
|
|||
- (void) setOutputFilter:(NSInteger)filterID
|
||||
{
|
||||
OSSpinLockLock(&spinlockOutputFilter);
|
||||
_cdv->SetOutputFilter((OutputFilterTypeID)filterID);
|
||||
_cdv->Get3DPresenter()->SetOutputFilter((OutputFilterTypeID)filterID);
|
||||
OSSpinLockUnlock(&spinlockOutputFilter);
|
||||
}
|
||||
|
||||
- (NSInteger) outputFilter
|
||||
{
|
||||
OSSpinLockLock(&spinlockOutputFilter);
|
||||
const NSInteger filterID = _cdv->GetOutputFilter();
|
||||
const NSInteger filterID = _cdv->Get3DPresenter()->GetOutputFilter();
|
||||
OSSpinLockUnlock(&spinlockOutputFilter);
|
||||
|
||||
return filterID;
|
||||
|
@ -1041,14 +1069,14 @@
|
|||
- (void) setPixelScaler:(NSInteger)filterID
|
||||
{
|
||||
OSSpinLockLock(&spinlockPixelScaler);
|
||||
_cdv->SetPixelScaler((VideoFilterTypeID)filterID);
|
||||
_cdv->Get3DPresenter()->SetPixelScaler((VideoFilterTypeID)filterID);
|
||||
OSSpinLockUnlock(&spinlockPixelScaler);
|
||||
}
|
||||
|
||||
- (NSInteger) pixelScaler
|
||||
{
|
||||
OSSpinLockLock(&spinlockPixelScaler);
|
||||
const NSInteger filterID = _cdv->GetPixelScaler();
|
||||
const NSInteger filterID = _cdv->Get3DPresenter()->GetPixelScaler();
|
||||
OSSpinLockUnlock(&spinlockPixelScaler);
|
||||
|
||||
return filterID;
|
||||
|
@ -1057,7 +1085,6 @@
|
|||
- (void)handlePortMessage:(NSPortMessage *)portMessage
|
||||
{
|
||||
NSInteger message = (NSInteger)[portMessage msgid];
|
||||
NSArray *messageComponents = [portMessage components];
|
||||
|
||||
switch (message)
|
||||
{
|
||||
|
@ -1081,10 +1108,6 @@
|
|||
[self handleCopyToPasteboard];
|
||||
break;
|
||||
|
||||
case MESSAGE_REQUEST_SCREENSHOT:
|
||||
[self handleRequestScreenshot:[messageComponents objectAtIndex:0] fileTypeData:[messageComponents objectAtIndex:1]];
|
||||
break;
|
||||
|
||||
default:
|
||||
[super handlePortMessage:portMessage];
|
||||
break;
|
||||
|
@ -1095,52 +1118,53 @@
|
|||
{
|
||||
[super handleEmuFrameProcessed];
|
||||
[self hudUpdate];
|
||||
_cdv->HandleEmulatorFrameEndEvent();
|
||||
_cdv->SetViewNeedsFlush();
|
||||
}
|
||||
|
||||
- (void) handleChangeViewProperties
|
||||
{
|
||||
OSSpinLockLock(&spinlockViewProperties);
|
||||
_cdv->CommitViewProperties(_intermediateViewProps);
|
||||
_cdv->Get3DPresenter()->CommitPresenterProperties(_intermediateViewProps);
|
||||
OSSpinLockUnlock(&spinlockViewProperties);
|
||||
|
||||
_cdv->SetupViewProperties();
|
||||
_cdv->Get3DPresenter()->SetupPresenterProperties();
|
||||
_cdv->SetViewNeedsFlush();
|
||||
}
|
||||
|
||||
- (void) handleReceiveGPUFrame
|
||||
{
|
||||
[super handleReceiveGPUFrame];
|
||||
|
||||
_cdv->LoadDisplays();
|
||||
_cdv->ProcessDisplays();
|
||||
_cdv->Get3DPresenter()->LoadDisplays();
|
||||
_cdv->Get3DPresenter()->ProcessDisplays();
|
||||
}
|
||||
|
||||
- (void) handleReloadReprocessRedraw
|
||||
{
|
||||
GPUClientFetchObject &fetchObjMutable = (GPUClientFetchObject &)_cdv->GetFetchObject();
|
||||
GPUClientFetchObject &fetchObjMutable = (GPUClientFetchObject &)_cdv->Get3DPresenter()->GetFetchObject();
|
||||
const u8 bufferIndex = fetchObjMutable.GetLastFetchIndex();
|
||||
|
||||
fetchObjMutable.FetchFromBufferIndex(bufferIndex);
|
||||
_cdv->LoadDisplays();
|
||||
_cdv->ProcessDisplays();
|
||||
_cdv->Get3DPresenter()->LoadDisplays();
|
||||
_cdv->Get3DPresenter()->ProcessDisplays();
|
||||
|
||||
[self handleEmuFrameProcessed];
|
||||
}
|
||||
|
||||
- (void) handleReprocessRedraw
|
||||
{
|
||||
_cdv->ProcessDisplays();
|
||||
_cdv->UpdateView();
|
||||
_cdv->Get3DPresenter()->ProcessDisplays();
|
||||
_cdv->SetViewNeedsFlush();
|
||||
}
|
||||
|
||||
- (void) handleRedraw
|
||||
{
|
||||
_cdv->UpdateView();
|
||||
_cdv->SetViewNeedsFlush();
|
||||
}
|
||||
|
||||
- (void) handleCopyToPasteboard
|
||||
{
|
||||
NSImage *screenshot = [self copyImageFromView];
|
||||
NSImage *screenshot = [self image];
|
||||
if (screenshot == nil)
|
||||
{
|
||||
return;
|
||||
|
@ -1151,28 +1175,10 @@
|
|||
[pboard setData:[screenshot TIFFRepresentationUsingCompression:NSTIFFCompressionLZW factor:1.0f] forType:NSTIFFPboardType];
|
||||
}
|
||||
|
||||
- (void) handleRequestScreenshot:(NSData *)fileURLStringData fileTypeData:(NSData *)fileTypeData
|
||||
{
|
||||
NSString *fileURLString = [[NSString alloc] initWithData:fileURLStringData encoding:NSUTF8StringEncoding];
|
||||
NSURL *fileURL = [NSURL URLWithString:fileURLString];
|
||||
NSBitmapImageFileType fileType = *(NSBitmapImageFileType *)[fileTypeData bytes];
|
||||
|
||||
NSDictionary *userInfo = [[NSDictionary alloc] initWithObjectsAndKeys:
|
||||
fileURL, @"fileURL",
|
||||
[NSNumber numberWithInteger:(NSInteger)fileType], @"fileType",
|
||||
[self image], @"screenshotImage",
|
||||
nil];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] postNotificationOnMainThreadName:@"org.desmume.DeSmuME.requestScreenshotDidFinish" object:self userInfo:userInfo];
|
||||
[userInfo release];
|
||||
|
||||
[fileURLString release];
|
||||
}
|
||||
|
||||
- (void) setScaleFactor:(float)theScaleFactor
|
||||
{
|
||||
OSSpinLockLock(&spinlockIsHUDVisible);
|
||||
_cdv->SetScaleFactor(theScaleFactor);
|
||||
_cdv->Get3DPresenter()->SetScaleFactor(theScaleFactor);
|
||||
OSSpinLockUnlock(&spinlockIsHUDVisible);
|
||||
}
|
||||
|
||||
|
@ -1184,13 +1190,13 @@
|
|||
OSSpinLockUnlock(&spinlockReceivedFrameIndex);
|
||||
|
||||
OSSpinLockLock(&spinlockNDSFrameInfo);
|
||||
_cdv->SetHUDInfo(clientFrameInfo, _ndsFrameInfo);
|
||||
_cdv->Get3DPresenter()->SetHUDInfo(clientFrameInfo, _ndsFrameInfo);
|
||||
OSSpinLockUnlock(&spinlockNDSFrameInfo);
|
||||
}
|
||||
|
||||
- (NSImage *) copyImageFromView
|
||||
- (NSImage *) image
|
||||
{
|
||||
NSSize viewSize = NSMakeSize(_cdv->GetViewProperties().clientWidth, _cdv->GetViewProperties().clientHeight);
|
||||
NSSize viewSize = NSMakeSize(_cdv->Get3DPresenter()->GetPresenterProperties().clientWidth, _cdv->Get3DPresenter()->GetPresenterProperties().clientHeight);
|
||||
NSUInteger w = viewSize.width;
|
||||
NSUInteger h = viewSize.height;
|
||||
|
||||
|
@ -1218,7 +1224,7 @@
|
|||
return newImage;
|
||||
}
|
||||
|
||||
_cdv->CopyFrameToBuffer((uint32_t *)[newImageRep bitmapData]);
|
||||
_cdv->Get3DPresenter()->CopyFrameToBuffer((uint32_t *)[newImageRep bitmapData]);
|
||||
|
||||
// Attach the rendered frame to the NSImageRep
|
||||
[newImage addRepresentation:newImageRep];
|
||||
|
@ -1226,86 +1232,4 @@
|
|||
return [newImage autorelease];
|
||||
}
|
||||
|
||||
- (NSImage *) image
|
||||
{
|
||||
pthread_rwlock_rdlock(self.rwlockProducer);
|
||||
NSSize displaySize = NSMakeSize((CGFloat)GPU->GetCustomFramebufferWidth(), (_cdv->GetMode() == ClientDisplayMode_Dual) ? (CGFloat)(GPU->GetCustomFramebufferHeight() * 2): (CGFloat)GPU->GetCustomFramebufferHeight());
|
||||
pthread_rwlock_unlock(self.rwlockProducer);
|
||||
|
||||
NSImage *newImage = [[NSImage alloc] initWithSize:displaySize];
|
||||
if (newImage == nil)
|
||||
{
|
||||
return newImage;
|
||||
}
|
||||
|
||||
// Render the frame in an NSBitmapImageRep
|
||||
NSBitmapImageRep *newImageRep = [self bitmapImageRep];
|
||||
if (newImageRep == nil)
|
||||
{
|
||||
[newImage release];
|
||||
newImage = nil;
|
||||
return newImage;
|
||||
}
|
||||
|
||||
// Attach the rendered frame to the NSImageRep
|
||||
[newImage addRepresentation:newImageRep];
|
||||
|
||||
return [newImage autorelease];
|
||||
}
|
||||
|
||||
- (NSBitmapImageRep *) bitmapImageRep
|
||||
{
|
||||
GPUClientFetchObject &fetchObjMutable = (GPUClientFetchObject &)_cdv->GetFetchObject();
|
||||
NDSDisplayInfo &displayInfoMutable = (NDSDisplayInfo &)fetchObjMutable.GetFetchDisplayInfoForBufferIndex(fetchObjMutable.GetLastFetchIndex());
|
||||
|
||||
NSUInteger w = (NSUInteger)displayInfoMutable.customWidth;
|
||||
NSUInteger h = (_cdv->GetMode() == ClientDisplayMode_Dual) ? (NSUInteger)(displayInfoMutable.customHeight * 2) : (NSUInteger)displayInfoMutable.customHeight;
|
||||
|
||||
NSBitmapImageRep *imageRep = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL
|
||||
pixelsWide:w
|
||||
pixelsHigh:h
|
||||
bitsPerSample:8
|
||||
samplesPerPixel:4
|
||||
hasAlpha:YES
|
||||
isPlanar:NO
|
||||
colorSpaceName:NSCalibratedRGBColorSpace
|
||||
bytesPerRow:w * 4
|
||||
bitsPerPixel:32];
|
||||
|
||||
if (imageRep == nil)
|
||||
{
|
||||
return imageRep;
|
||||
}
|
||||
|
||||
void *displayBuffer = displayInfoMutable.masterCustomBuffer;
|
||||
uint32_t *bitmapData = (uint32_t *)[imageRep bitmapData];
|
||||
|
||||
pthread_rwlock_wrlock(self.rwlockProducer);
|
||||
|
||||
GPU->PostprocessDisplay(NDSDisplayID_Main, displayInfoMutable);
|
||||
GPU->PostprocessDisplay(NDSDisplayID_Touch, displayInfoMutable);
|
||||
GPU->ResolveDisplayToCustomFramebuffer(NDSDisplayID_Main, displayInfoMutable);
|
||||
GPU->ResolveDisplayToCustomFramebuffer(NDSDisplayID_Touch, displayInfoMutable);
|
||||
|
||||
if (displayInfoMutable.pixelBytes == 2)
|
||||
{
|
||||
ColorspaceConvertBuffer555To8888Opaque<false, true>((u16 *)displayBuffer, bitmapData, (w * h));
|
||||
}
|
||||
else if (displayInfoMutable.pixelBytes == 4)
|
||||
{
|
||||
memcpy(bitmapData, displayBuffer, w * h * sizeof(uint32_t));
|
||||
}
|
||||
|
||||
pthread_rwlock_unlock(self.rwlockProducer);
|
||||
|
||||
#ifdef MSB_FIRST
|
||||
for (size_t i = 0; i < w * h; i++)
|
||||
{
|
||||
bitmapData[i] = LE_TO_LOCAL_32(bitmapData[i]);
|
||||
}
|
||||
#endif
|
||||
|
||||
return [imageRep autorelease];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
|
@ -22,15 +22,17 @@
|
|||
#import <QuartzCore/QuartzCore.h>
|
||||
|
||||
#import "InputManager.h"
|
||||
#import "../ClientDisplayView.h"
|
||||
|
||||
@class CocoaDSDisplayVideo;
|
||||
@class MacClientSharedObject;
|
||||
class ClientDisplay3DView;
|
||||
class MacDisplayLayeredView;
|
||||
|
||||
@protocol DisplayViewCALayer <NSObject>
|
||||
|
||||
@required
|
||||
- (ClientDisplay3DView *) clientDisplay3DView;
|
||||
|
||||
@property (assign, nonatomic, getter=clientDisplayView, setter=setClientDisplayView:) MacDisplayLayeredView *_cdv;
|
||||
|
||||
@end
|
||||
|
||||
|
@ -39,7 +41,7 @@ class ClientDisplay3DView;
|
|||
@required
|
||||
@property (retain) InputManager *inputManager;
|
||||
@property (retain) CocoaDSDisplayVideo *cdsVideoOutput;
|
||||
@property (readonly, nonatomic) ClientDisplay3DView *clientDisplay3DView;
|
||||
@property (readonly, nonatomic) MacDisplayLayeredView *clientDisplayView;
|
||||
@property (readonly) BOOL canUseShaderBasedFilters;
|
||||
@property (assign, nonatomic) BOOL allowViewUpdates;
|
||||
@property (assign) BOOL isHUDVisible;
|
||||
|
@ -68,34 +70,43 @@ class ClientDisplay3DView;
|
|||
@property (assign) NSInteger pixelScaler;
|
||||
|
||||
- (void) setupLayer;
|
||||
- (void) requestScreenshot:(NSURL *)fileURL fileType:(NSBitmapImageFileType)fileType;
|
||||
|
||||
@end
|
||||
|
||||
class DisplayViewCALayerInterface
|
||||
class MacDisplayPresenterInterface
|
||||
{
|
||||
private:
|
||||
NSView *_nsView;
|
||||
CALayer<DisplayViewCALayer> *_frontendLayer;
|
||||
bool _willRenderToCALayer;
|
||||
|
||||
protected:
|
||||
MacClientSharedObject *_sharedData;
|
||||
|
||||
public:
|
||||
DisplayViewCALayerInterface();
|
||||
MacDisplayPresenterInterface();
|
||||
MacDisplayPresenterInterface(MacClientSharedObject *sharedObject);
|
||||
|
||||
MacClientSharedObject* GetSharedData();
|
||||
virtual void SetSharedData(MacClientSharedObject *sharedObject);
|
||||
};
|
||||
|
||||
class MacDisplayLayeredView : public ClientDisplay3DView
|
||||
{
|
||||
private:
|
||||
void __InstanceInit();
|
||||
|
||||
protected:
|
||||
NSView *_nsView;
|
||||
CALayer<DisplayViewCALayer> *_caLayer;
|
||||
bool _willRenderToCALayer;
|
||||
|
||||
public:
|
||||
MacDisplayLayeredView();
|
||||
MacDisplayLayeredView(ClientDisplay3DPresenter *thePresenter);
|
||||
|
||||
NSView* GetNSView() const;
|
||||
void SetNSView(NSView *theView);
|
||||
|
||||
CALayer<DisplayViewCALayer>* GetFrontendLayer() const;
|
||||
void SetFrontendLayer(CALayer<DisplayViewCALayer> *layer);
|
||||
void CALayerDisplay();
|
||||
CALayer<DisplayViewCALayer>* GetCALayer() const;
|
||||
|
||||
bool GetRenderToCALayer() const;
|
||||
void SetRenderToCALayer(const bool renderToLayer);
|
||||
|
||||
MacClientSharedObject* GetSharedData();
|
||||
void SetSharedData(MacClientSharedObject *sharedObject);
|
||||
};
|
||||
|
||||
#endif // _DISPLAYVIEWCALAYER_H
|
||||
|
|
|
@ -18,55 +18,66 @@
|
|||
#import "DisplayViewCALayer.h"
|
||||
#import "../cocoa_GPU.h"
|
||||
|
||||
DisplayViewCALayerInterface::DisplayViewCALayerInterface()
|
||||
MacDisplayPresenterInterface::MacDisplayPresenterInterface()
|
||||
{
|
||||
_nsView = nil;
|
||||
_frontendLayer = nil;
|
||||
_sharedData = nil;
|
||||
_willRenderToCALayer = false;
|
||||
}
|
||||
|
||||
NSView* DisplayViewCALayerInterface::GetNSView() const
|
||||
MacDisplayPresenterInterface::MacDisplayPresenterInterface(MacClientSharedObject *sharedObject)
|
||||
{
|
||||
return this->_nsView;
|
||||
_sharedData = sharedObject;
|
||||
}
|
||||
|
||||
void DisplayViewCALayerInterface::SetNSView(NSView *theView)
|
||||
{
|
||||
this->_nsView = theView;
|
||||
}
|
||||
|
||||
CALayer<DisplayViewCALayer>* DisplayViewCALayerInterface::GetFrontendLayer() const
|
||||
{
|
||||
return this->_frontendLayer;
|
||||
}
|
||||
|
||||
void DisplayViewCALayerInterface::SetFrontendLayer(CALayer<DisplayViewCALayer> *layer)
|
||||
{
|
||||
this->_frontendLayer = layer;
|
||||
}
|
||||
|
||||
void DisplayViewCALayerInterface::CALayerDisplay()
|
||||
{
|
||||
[this->_frontendLayer setNeedsDisplay];
|
||||
}
|
||||
|
||||
bool DisplayViewCALayerInterface::GetRenderToCALayer() const
|
||||
{
|
||||
return this->_willRenderToCALayer;
|
||||
}
|
||||
|
||||
void DisplayViewCALayerInterface::SetRenderToCALayer(const bool renderToLayer)
|
||||
{
|
||||
this->_willRenderToCALayer = renderToLayer;
|
||||
}
|
||||
|
||||
MacClientSharedObject* DisplayViewCALayerInterface::GetSharedData()
|
||||
MacClientSharedObject* MacDisplayPresenterInterface::GetSharedData()
|
||||
{
|
||||
return this->_sharedData;
|
||||
}
|
||||
|
||||
void DisplayViewCALayerInterface::SetSharedData(MacClientSharedObject *sharedObject)
|
||||
void MacDisplayPresenterInterface::SetSharedData(MacClientSharedObject *sharedObject)
|
||||
{
|
||||
this->_sharedData = sharedObject;
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
|
||||
MacDisplayLayeredView::MacDisplayLayeredView()
|
||||
{
|
||||
__InstanceInit();
|
||||
}
|
||||
|
||||
MacDisplayLayeredView::MacDisplayLayeredView(ClientDisplay3DPresenter *thePresenter) : ClientDisplay3DView(thePresenter)
|
||||
{
|
||||
__InstanceInit();
|
||||
}
|
||||
|
||||
void MacDisplayLayeredView::__InstanceInit()
|
||||
{
|
||||
_nsView = nil;
|
||||
_caLayer = nil;
|
||||
_willRenderToCALayer = false;
|
||||
}
|
||||
|
||||
NSView* MacDisplayLayeredView::GetNSView() const
|
||||
{
|
||||
return this->_nsView;
|
||||
}
|
||||
|
||||
void MacDisplayLayeredView::SetNSView(NSView *theView)
|
||||
{
|
||||
this->_nsView = theView;
|
||||
}
|
||||
|
||||
CALayer<DisplayViewCALayer>* MacDisplayLayeredView::GetCALayer() const
|
||||
{
|
||||
return this->_caLayer;
|
||||
}
|
||||
|
||||
bool MacDisplayLayeredView::GetRenderToCALayer() const
|
||||
{
|
||||
return this->_willRenderToCALayer;
|
||||
}
|
||||
|
||||
void MacDisplayLayeredView::SetRenderToCALayer(const bool renderToLayer)
|
||||
{
|
||||
this->_willRenderToCALayer = renderToLayer;
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ class OGLVideoOutput;
|
|||
{
|
||||
InputManager *inputManager;
|
||||
CocoaDSDisplayVideo *cdsVideoOutput;
|
||||
CALayer *localLayer;
|
||||
CALayer<DisplayViewCALayer> *localLayer;
|
||||
NSOpenGLContext *localOGLContext;
|
||||
}
|
||||
|
||||
|
@ -59,8 +59,7 @@ class OGLVideoOutput;
|
|||
{
|
||||
NSObject *dummyObject;
|
||||
|
||||
ClientDisplayViewProperties _localViewProps;
|
||||
NSView *saveScreenshotPanelAccessoryView;
|
||||
ClientDisplayPresenterProperties _localViewProps;
|
||||
NSView *outputVolumeControlView;
|
||||
NSView *microphoneGainControlView;
|
||||
NSMenuItem *outputVolumeMenuItem;
|
||||
|
@ -73,8 +72,6 @@ class OGLVideoOutput;
|
|||
NSScreen *assignedScreen;
|
||||
NSWindow *masterWindow;
|
||||
|
||||
NSInteger screenshotFileFormat;
|
||||
|
||||
NSSize _minDisplayViewSize;
|
||||
BOOL _isMinSizeNormal;
|
||||
NSUInteger _statusBarHeight;
|
||||
|
@ -89,7 +86,6 @@ class OGLVideoOutput;
|
|||
|
||||
@property (readonly) IBOutlet NSObject *dummyObject;
|
||||
|
||||
@property (readonly) IBOutlet NSView *saveScreenshotPanelAccessoryView;
|
||||
@property (readonly) IBOutlet NSView *outputVolumeControlView;
|
||||
@property (readonly) IBOutlet NSView *microphoneGainControlView;
|
||||
@property (readonly) IBOutlet NSMenuItem *outputVolumeMenuItem;
|
||||
|
@ -109,13 +105,12 @@ class OGLVideoOutput;
|
|||
@property (assign, nonatomic) double displayGap;
|
||||
@property (assign, nonatomic) double displayScale;
|
||||
@property (assign, nonatomic) double displayRotation;
|
||||
@property (assign) NSInteger screenshotFileFormat;
|
||||
@property (assign) BOOL isMinSizeNormal;
|
||||
@property (assign) BOOL isShowingStatusBar;
|
||||
|
||||
- (id)initWithWindowNibName:(NSString *)windowNibName emuControlDelegate:(EmuControllerDelegate *)theEmuController;
|
||||
|
||||
- (ClientDisplayViewProperties &) localViewProperties;
|
||||
- (ClientDisplayPresenterProperties &) localViewProperties;
|
||||
- (void) setVideoPropertiesWithoutUpdateUsingPreferGPU:(BOOL)preferGPU
|
||||
sourceDeposterize:(BOOL)useDeposterize
|
||||
outputFilter:(NSInteger)outputFilterID
|
||||
|
@ -150,7 +145,6 @@ class OGLVideoOutput;
|
|||
- (IBAction) reset:(id)sender;
|
||||
- (IBAction) changeCoreSpeed:(id)sender;
|
||||
- (IBAction) openRom:(id)sender;
|
||||
- (IBAction) saveScreenshotAs:(id)sender;
|
||||
|
||||
// View Menu
|
||||
- (IBAction) changeScale:(id)sender;
|
||||
|
|
|
@ -52,7 +52,6 @@
|
|||
@synthesize assignedScreen;
|
||||
@synthesize masterWindow;
|
||||
@synthesize view;
|
||||
@synthesize saveScreenshotPanelAccessoryView;
|
||||
@synthesize outputVolumeControlView;
|
||||
@synthesize microphoneGainControlView;
|
||||
@synthesize outputVolumeMenuItem;
|
||||
|
@ -67,7 +66,6 @@
|
|||
@dynamic displayOrientation;
|
||||
@dynamic displayOrder;
|
||||
@dynamic displayGap;
|
||||
@synthesize screenshotFileFormat;
|
||||
@dynamic isMinSizeNormal;
|
||||
@dynamic isShowingStatusBar;
|
||||
|
||||
|
@ -92,7 +90,6 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
|
|||
emuControl = [theEmuController retain];
|
||||
assignedScreen = nil;
|
||||
masterWindow = nil;
|
||||
screenshotFileFormat = NSTIFFFileType;
|
||||
|
||||
// These need to be initialized first since there are dependencies on these.
|
||||
_localViewProps.normalWidth = GPU_FRAMEBUFFER_NATIVE_WIDTH;
|
||||
|
@ -118,11 +115,6 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
|
|||
_masterWindowFrame = NSMakeRect(0.0, 0.0, _localViewProps.clientWidth, _localViewProps.clientHeight + _localViewProps.gapDistance);
|
||||
_masterStatusBarState = NO;
|
||||
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(saveScreenshotAsFinish:)
|
||||
name:@"org.desmume.DeSmuME.requestScreenshotDidFinish"
|
||||
object:nil];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(respondToScreenChange:)
|
||||
name:@"NSApplicationDidChangeScreenParametersNotification"
|
||||
|
@ -192,7 +184,7 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
|
|||
|
||||
if ([self isFullScreen])
|
||||
{
|
||||
[[[self view] cdsVideoOutput] commitViewProperties:_localViewProps];
|
||||
[[[self view] cdsVideoOutput] commitPresenterProperties:_localViewProps];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -207,7 +199,7 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
|
|||
// display view to update itself.
|
||||
if (oldBounds.width == newBounds.width && oldBounds.height == newBounds.height)
|
||||
{
|
||||
[[[self view] cdsVideoOutput] commitViewProperties:_localViewProps];
|
||||
[[[self view] cdsVideoOutput] commitPresenterProperties:_localViewProps];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -223,7 +215,7 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
|
|||
( ((_localViewProps.mode == ClientDisplayMode_Main) || (_localViewProps.mode == ClientDisplayMode_Touch)) && (displayModeID == ClientDisplayMode_Dual) );
|
||||
_localViewProps.mode = (ClientDisplayMode)displayModeID;
|
||||
|
||||
ClientDisplayView::CalculateNormalSize((ClientDisplayMode)displayModeID, (ClientDisplayLayout)[self displayOrientation], [self displayGap], _localViewProps.normalWidth, _localViewProps.normalHeight);
|
||||
ClientDisplayPresenter::CalculateNormalSize((ClientDisplayMode)displayModeID, (ClientDisplayLayout)[self displayOrientation], [self displayGap], _localViewProps.normalWidth, _localViewProps.normalHeight);
|
||||
[self setIsMinSizeNormal:[self isMinSizeNormal]];
|
||||
|
||||
if (![self isFullScreen] && willModeChangeSize)
|
||||
|
@ -232,7 +224,7 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
|
|||
}
|
||||
else
|
||||
{
|
||||
[[[self view] cdsVideoOutput] commitViewProperties:_localViewProps];
|
||||
[[[self view] cdsVideoOutput] commitPresenterProperties:_localViewProps];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -245,14 +237,14 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
|
|||
{
|
||||
_localViewProps.layout = (ClientDisplayLayout)theOrientation;
|
||||
|
||||
ClientDisplayView::CalculateNormalSize((ClientDisplayMode)[self displayMode], (ClientDisplayLayout)theOrientation, [self displayGap], _localViewProps.normalWidth, _localViewProps.normalHeight);
|
||||
ClientDisplayPresenter::CalculateNormalSize((ClientDisplayMode)[self displayMode], (ClientDisplayLayout)theOrientation, [self displayGap], _localViewProps.normalWidth, _localViewProps.normalHeight);
|
||||
[self setIsMinSizeNormal:[self isMinSizeNormal]];
|
||||
|
||||
if ([self displayMode] == ClientDisplayMode_Dual)
|
||||
{
|
||||
if ([self isFullScreen])
|
||||
{
|
||||
[[[self view] cdsVideoOutput] commitViewProperties:_localViewProps];
|
||||
[[[self view] cdsVideoOutput] commitPresenterProperties:_localViewProps];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -269,7 +261,7 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
|
|||
- (void) setDisplayOrder:(NSInteger)theOrder
|
||||
{
|
||||
_localViewProps.order = (ClientDisplayOrder)theOrder;
|
||||
[[[self view] cdsVideoOutput] commitViewProperties:_localViewProps];
|
||||
[[[self view] cdsVideoOutput] commitPresenterProperties:_localViewProps];
|
||||
}
|
||||
|
||||
- (NSInteger) displayOrder
|
||||
|
@ -280,7 +272,7 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
|
|||
- (void) setDisplayGap:(double)gapScalar
|
||||
{
|
||||
_localViewProps.gapScale = gapScalar;
|
||||
ClientDisplayView::CalculateNormalSize((ClientDisplayMode)[self displayMode], (ClientDisplayLayout)[self displayOrientation], gapScalar, _localViewProps.normalWidth, _localViewProps.normalHeight);
|
||||
ClientDisplayPresenter::CalculateNormalSize((ClientDisplayMode)[self displayMode], (ClientDisplayLayout)[self displayOrientation], gapScalar, _localViewProps.normalWidth, _localViewProps.normalHeight);
|
||||
[self setIsMinSizeNormal:[self isMinSizeNormal]];
|
||||
|
||||
if ([self displayMode] == ClientDisplayMode_Dual)
|
||||
|
@ -296,7 +288,7 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
|
|||
case ClientDisplayLayout_Hybrid_16_9:
|
||||
case ClientDisplayLayout_Hybrid_16_10:
|
||||
default:
|
||||
[[[self view] cdsVideoOutput] commitViewProperties:_localViewProps];
|
||||
[[[self view] cdsVideoOutput] commitPresenterProperties:_localViewProps];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -306,7 +298,7 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
|
|||
{
|
||||
case ClientDisplayLayout_Hybrid_16_9:
|
||||
case ClientDisplayLayout_Hybrid_16_10:
|
||||
[[[self view] cdsVideoOutput] commitViewProperties:_localViewProps];
|
||||
[[[self view] cdsVideoOutput] commitPresenterProperties:_localViewProps];
|
||||
break;
|
||||
|
||||
case ClientDisplayLayout_Horizontal:
|
||||
|
@ -341,7 +333,7 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
|
|||
// Set the minimum content size, keeping the display rotation in mind.
|
||||
double transformedMinWidth = _minDisplayViewSize.width;
|
||||
double transformedMinHeight = _minDisplayViewSize.height;
|
||||
ClientDisplayView::ConvertNormalToTransformedBounds(1.0, _localViewProps.rotation, transformedMinWidth, transformedMinHeight);
|
||||
ClientDisplayPresenter::ConvertNormalToTransformedBounds(1.0, _localViewProps.rotation, transformedMinWidth, transformedMinHeight);
|
||||
[[self window] setContentMinSize:NSMakeSize(transformedMinWidth, transformedMinHeight + _statusBarHeight)];
|
||||
}
|
||||
|
||||
|
@ -393,7 +385,7 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
|
|||
|
||||
#pragma mark Class Methods
|
||||
|
||||
- (ClientDisplayViewProperties &) localViewProperties
|
||||
- (ClientDisplayPresenterProperties &) localViewProperties
|
||||
{
|
||||
return _localViewProps;
|
||||
}
|
||||
|
@ -429,7 +421,7 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
|
|||
_localViewProps.gapDistance = DS_DISPLAY_UNSCALED_GAP * gapScale;
|
||||
_localViewProps.rotation = 360.0 - _localRotation;
|
||||
|
||||
ClientDisplayView::CalculateNormalSize(mode, layout, gapScale, _localViewProps.normalWidth, _localViewProps.normalHeight);
|
||||
ClientDisplayPresenter::CalculateNormalSize(mode, layout, gapScale, _localViewProps.normalWidth, _localViewProps.normalHeight);
|
||||
|
||||
// Set the minimum content size.
|
||||
_isMinSizeNormal = isMinSizeNormal;
|
||||
|
@ -444,7 +436,7 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
|
|||
|
||||
double transformedMinWidth = _minDisplayViewSize.width;
|
||||
double transformedMinHeight = _minDisplayViewSize.height;
|
||||
ClientDisplayView::ConvertNormalToTransformedBounds(1.0, _localViewProps.rotation, transformedMinWidth, transformedMinHeight);
|
||||
ClientDisplayPresenter::ConvertNormalToTransformedBounds(1.0, _localViewProps.rotation, transformedMinWidth, transformedMinHeight);
|
||||
[[self window] setContentMinSize:NSMakeSize(transformedMinWidth, transformedMinHeight + _statusBarHeight)];
|
||||
|
||||
// Set the client size and resize the window.
|
||||
|
@ -458,7 +450,7 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
|
|||
// window size changed or not.
|
||||
if (oldBounds.width == newBounds.width && oldBounds.height == newBounds.height)
|
||||
{
|
||||
[[[self view] cdsVideoOutput] commitViewProperties:_localViewProps];
|
||||
[[[self view] cdsVideoOutput] commitPresenterProperties:_localViewProps];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -529,7 +521,7 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
|
|||
// Get the maximum scalar size within drawBounds.
|
||||
double checkWidth = _localViewProps.normalWidth;
|
||||
double checkHeight = _localViewProps.normalHeight;
|
||||
ClientDisplayView::ConvertNormalToTransformedBounds(1.0, _localViewProps.rotation, checkWidth, checkHeight);
|
||||
ClientDisplayPresenter::ConvertNormalToTransformedBounds(1.0, _localViewProps.rotation, checkWidth, checkHeight);
|
||||
|
||||
const double maxViewScaleInHostScreen = [self maxViewScaleInHostScreen:checkWidth height:checkHeight];
|
||||
if (_localViewScale > maxViewScaleInHostScreen)
|
||||
|
@ -540,7 +532,7 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
|
|||
// Get the new bounds for the window's content view based on the transformed draw bounds.
|
||||
double transformedWidth = _localViewProps.normalWidth;
|
||||
double transformedHeight = _localViewProps.normalHeight;
|
||||
ClientDisplayView::ConvertNormalToTransformedBounds(_localViewScale, _localViewProps.rotation, transformedWidth, transformedHeight);
|
||||
ClientDisplayPresenter::ConvertNormalToTransformedBounds(_localViewScale, _localViewProps.rotation, transformedWidth, transformedHeight);
|
||||
|
||||
// Get the center of the content view in screen coordinates.
|
||||
const NSRect windowContentRect = [[masterWindow contentView] bounds];
|
||||
|
@ -573,29 +565,7 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
|
|||
const NSRect windowFrame = [[self window] frameRectForContentRect:NSMakeRect(0.0, 0.0, contentBoundsWidth, contentBoundsHeight + _statusBarHeight)];
|
||||
const NSSize visibleScreenBounds = { (screenFrame.size.width - (windowFrame.size.width - contentBoundsWidth)), (screenFrame.size.height - (windowFrame.size.height - contentBoundsHeight)) };
|
||||
|
||||
return ClientDisplayView::GetMaxScalarWithinBounds(contentBoundsWidth, contentBoundsHeight, 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:(NSBitmapImageRep *)[[screenshotImage representations] objectAtIndex:0] fileType:fileType];
|
||||
if (!fileSaved)
|
||||
{
|
||||
NSAlert *theAlert = [[NSAlert alloc] init];
|
||||
[theAlert setMessageText:NSSTRING_ALERT_SCREENSHOT_FAILED_TITLE];
|
||||
[theAlert setInformativeText:NSSTRING_ALERT_SCREENSHOT_FAILED_MESSAGE];
|
||||
[theAlert setAlertStyle:NSCriticalAlertStyle];
|
||||
|
||||
[theAlert runModal];
|
||||
|
||||
[theAlert release];
|
||||
}
|
||||
|
||||
[emuControl restoreCoreState];
|
||||
return ClientDisplayPresenter::GetMaxScalarWithinBounds(contentBoundsWidth, contentBoundsHeight, visibleScreenBounds.width, visibleScreenBounds.height);
|
||||
}
|
||||
|
||||
- (void) enterFullScreen
|
||||
|
@ -681,7 +651,7 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
|
|||
CGDirectDisplayID displayID = [idNumber unsignedIntValue];
|
||||
|
||||
[[[self view] cdsVideoOutput] setCurrentDisplayID:displayID];
|
||||
[[[self view] cdsVideoOutput] clientDisplayView]->UpdateView();
|
||||
[[[self view] cdsVideoOutput] clientDisplay3DView]->SetViewNeedsFlush();
|
||||
}
|
||||
|
||||
- (void) respondToScreenChange:(NSNotification *)aNotification
|
||||
|
@ -797,7 +767,7 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
|
|||
// Set the minimum content size, keeping the display rotation in mind.
|
||||
double transformedMinWidth = _minDisplayViewSize.width;
|
||||
double transformedMinHeight = _minDisplayViewSize.height;
|
||||
ClientDisplayView::ConvertNormalToTransformedBounds(1.0, _localViewProps.rotation, transformedMinWidth, transformedMinHeight);
|
||||
ClientDisplayPresenter::ConvertNormalToTransformedBounds(1.0, _localViewProps.rotation, transformedMinWidth, transformedMinHeight);
|
||||
transformedMinHeight += _statusBarHeight;
|
||||
|
||||
// Resize the window if it's smaller than the minimum content size.
|
||||
|
@ -870,26 +840,6 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
|
|||
[emuControl openRom:sender];
|
||||
}
|
||||
|
||||
- (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];
|
||||
}
|
||||
}
|
||||
|
||||
- (IBAction) changeScale:(id)sender
|
||||
{
|
||||
[self setDisplayScale:(double)[CocoaDSUtil getIBActionSenderTag:sender] / 100.0];
|
||||
|
@ -1324,11 +1274,12 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
|
|||
|
||||
// Set up the video output thread.
|
||||
CocoaDSDisplayVideo *newDisplayOutput = [[[CocoaDSDisplayVideo alloc] init] autorelease];
|
||||
[newDisplayOutput setClientDisplayView:[newView clientDisplay3DView]];
|
||||
ClientDisplay3DView *cdv = [newView clientDisplayView];
|
||||
|
||||
[newDisplayOutput setClientDisplay3DView:cdv];
|
||||
|
||||
ClientDisplayView *cdv = [newDisplayOutput clientDisplayView];
|
||||
NSString *fontPath = [[NSBundle mainBundle] pathForResource:@"SourceSansPro-Bold" ofType:@"otf"];
|
||||
cdv->SetHUDFontPath([fontPath cStringUsingEncoding:NSUTF8StringEncoding]);
|
||||
cdv->Get3DPresenter()->SetHUDFontPath([fontPath cStringUsingEncoding:NSUTF8StringEncoding]);
|
||||
|
||||
if (scaleFactor != 1.0f)
|
||||
{
|
||||
|
@ -1336,7 +1287,7 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
|
|||
}
|
||||
else
|
||||
{
|
||||
cdv->LoadHUDFont();
|
||||
cdv->Get3DPresenter()->LoadHUDFont();
|
||||
}
|
||||
|
||||
[newView setCdsVideoOutput:newDisplayOutput];
|
||||
|
@ -1390,9 +1341,9 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
|
|||
// Find the maximum scalar we can use for the display view, bounded by the content Rect.
|
||||
double checkWidth = _localViewProps.normalWidth;
|
||||
double checkHeight = _localViewProps.normalHeight;
|
||||
ClientDisplayView::ConvertNormalToTransformedBounds(1.0, _localViewProps.rotation, checkWidth, checkHeight);
|
||||
ClientDisplayPresenter::ConvertNormalToTransformedBounds(1.0, _localViewProps.rotation, checkWidth, checkHeight);
|
||||
const NSSize contentBounds = NSMakeSize(contentRect.size.width, contentRect.size.height - _statusBarHeight);
|
||||
_localViewScale = ClientDisplayView::GetMaxScalarWithinBounds(checkWidth, checkHeight, contentBounds.width, contentBounds.height);
|
||||
_localViewScale = ClientDisplayPresenter::GetMaxScalarWithinBounds(checkWidth, checkHeight, 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, checkWidth * _localViewScale, (checkHeight * _localViewScale) + _statusBarHeight);
|
||||
|
@ -1445,9 +1396,9 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
|
|||
// Find the maximum scalar we can use for the display view, bounded by the content Rect.
|
||||
double checkWidth = _localViewProps.normalWidth;
|
||||
double checkHeight = _localViewProps.normalHeight;
|
||||
ClientDisplayView::ConvertNormalToTransformedBounds(1.0, _localViewProps.rotation, checkWidth, checkHeight);
|
||||
ClientDisplayPresenter::ConvertNormalToTransformedBounds(1.0, _localViewProps.rotation, checkWidth, checkHeight);
|
||||
const NSSize contentBounds = NSMakeSize(contentRect.size.width, contentRect.size.height - _statusBarHeight);
|
||||
const double maxS = ClientDisplayView::GetMaxScalarWithinBounds(checkWidth, checkHeight, contentBounds.width, contentBounds.height);
|
||||
const double maxS = ClientDisplayPresenter::GetMaxScalarWithinBounds(checkWidth, checkHeight, 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, checkWidth * maxS, (checkHeight * maxS) + _statusBarHeight);
|
||||
|
@ -1640,7 +1591,7 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
|
|||
|
||||
@synthesize inputManager;
|
||||
@synthesize cdsVideoOutput;
|
||||
@dynamic clientDisplay3DView;
|
||||
@dynamic clientDisplayView;
|
||||
@dynamic canUseShaderBasedFilters;
|
||||
@dynamic allowViewUpdates;
|
||||
@dynamic isHUDVisible;
|
||||
|
@ -1725,8 +1676,8 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
|
|||
{
|
||||
BOOL isHandled = NO;
|
||||
DisplayWindowController *windowController = (DisplayWindowController *)[[self window] delegate];
|
||||
ClientDisplayView *cdv = [(id<DisplayViewCALayer>)localLayer clientDisplay3DView];
|
||||
const ClientDisplayMode displayMode = cdv->GetMode();
|
||||
MacDisplayLayeredView *cdv = [localLayer clientDisplayView];
|
||||
const ClientDisplayMode displayMode = cdv->Get3DPresenter()->GetMode();
|
||||
|
||||
// Convert the clicked location from window coordinates, to view coordinates,
|
||||
// and finally to DS touchscreen coordinates.
|
||||
|
@ -1736,12 +1687,17 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
|
|||
|
||||
if (displayMode != ClientDisplayMode_Main)
|
||||
{
|
||||
const ClientDisplayPresenterProperties &props = cdv->Get3DPresenter()->GetPresenterProperties();
|
||||
const double scaleFactor = cdv->Get3DPresenter()->GetScaleFactor();
|
||||
const NSEventType eventType = [theEvent type];
|
||||
const bool isInitialMouseDown = (eventType == NSLeftMouseDown) || (eventType == NSRightMouseDown) || (eventType == NSOtherMouseDown);
|
||||
|
||||
// Convert the clicked location from window coordinates, to view coordinates, and finally to NDS touchscreen coordinates.
|
||||
const NSPoint clientLoc = [self convertPoint:[theEvent locationInWindow] fromView:nil];
|
||||
cdv->GetNDSPoint((int)buttonNumber, isInitialMouseDown, clientLoc.x, clientLoc.y, x, y);
|
||||
|
||||
cdv->GetNDSPoint(props,
|
||||
props.clientWidth * scaleFactor, props.clientHeight * scaleFactor,
|
||||
(int)buttonNumber, isInitialMouseDown, clientLoc.x, clientLoc.y, x, y);
|
||||
}
|
||||
|
||||
MacInputDevicePropertiesEncoder *inputEncoder = [inputManager inputEncoder];
|
||||
|
@ -1759,9 +1715,9 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
|
|||
|
||||
#pragma mark CocoaDisplayView Protocol
|
||||
|
||||
- (ClientDisplay3DView *) clientDisplay3DView
|
||||
- (MacDisplayLayeredView *) clientDisplayView
|
||||
{
|
||||
return [(id<DisplayViewCALayer>)localLayer clientDisplay3DView];
|
||||
return [localLayer clientDisplayView];
|
||||
}
|
||||
|
||||
- (BOOL) canUseShaderBasedFilters
|
||||
|
@ -1771,12 +1727,12 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
|
|||
|
||||
- (BOOL) allowViewUpdates
|
||||
{
|
||||
return ([self clientDisplay3DView]->GetAllowViewUpdates()) ? YES : NO;
|
||||
return ([self clientDisplayView]->GetAllowViewUpdates()) ? YES : NO;
|
||||
}
|
||||
|
||||
- (void) setAllowViewUpdates:(BOOL)allowUpdates
|
||||
{
|
||||
[self clientDisplay3DView]->SetAllowViewUpdates((allowUpdates) ? true : false);
|
||||
[self clientDisplayView]->SetAllowViewUpdates((allowUpdates) ? true : false);
|
||||
}
|
||||
|
||||
- (void) setIsHUDVisible:(BOOL)theState
|
||||
|
@ -2031,9 +1987,9 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
|
|||
{
|
||||
[macSharedData decrementViewsUsingDirectToCPUFiltering];
|
||||
}
|
||||
|
||||
[CocoaDSUtil messageSendOneWay:[[self cdsVideoOutput] receivePort] msgID:MESSAGE_RELOAD_REPROCESS_REDRAW];
|
||||
}
|
||||
|
||||
[CocoaDSUtil messageSendOneWay:[[self cdsVideoOutput] receivePort] msgID:MESSAGE_REPROCESS_AND_REDRAW];
|
||||
}
|
||||
|
||||
- (BOOL) sourceDeposterize
|
||||
|
@ -2073,9 +2029,9 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
|
|||
{
|
||||
[macSharedData decrementViewsUsingDirectToCPUFiltering];
|
||||
}
|
||||
|
||||
[CocoaDSUtil messageSendOneWay:[[self cdsVideoOutput] receivePort] msgID:MESSAGE_RELOAD_REPROCESS_REDRAW];
|
||||
}
|
||||
|
||||
[CocoaDSUtil messageSendOneWay:[[self cdsVideoOutput] receivePort] msgID:MESSAGE_REPROCESS_AND_REDRAW];
|
||||
}
|
||||
|
||||
- (NSInteger) pixelScaler
|
||||
|
@ -2088,39 +2044,30 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
|
|||
DisplayWindowController *windowController = (DisplayWindowController *)[[self window] delegate];
|
||||
CocoaDSCore *cdsCore = (CocoaDSCore *)[[[windowController emuControl] cdsCoreController] content];
|
||||
CocoaDSGPU *cdsGPU = [cdsCore cdsGPU];
|
||||
MacClientSharedObject *macSharedData = [cdsGPU sharedData];
|
||||
BOOL isMetalLayer = NO;
|
||||
|
||||
#ifdef ENABLE_APPLE_METAL
|
||||
MacClientSharedObject *macSharedData = [cdsGPU sharedData];
|
||||
if ((macSharedData != nil) && [macSharedData isKindOfClass:[MetalDisplayViewSharedData class]])
|
||||
{
|
||||
localLayer = [[DisplayViewMetalLayer alloc] init];
|
||||
[(DisplayViewMetalLayer *)localLayer setSharedData:(MetalDisplayViewSharedData *)macSharedData];
|
||||
|
||||
MacMetalDisplayView *macMTLCDV = (MacMetalDisplayView *)[(id<DisplayViewCALayer>)localLayer clientDisplay3DView];
|
||||
macMTLCDV->SetFetchObject([cdsGPU fetchObject]);
|
||||
macMTLCDV->Init();
|
||||
macMTLCDV->SetNSView(self);
|
||||
macMTLCDV->SetSharedData([cdsGPU sharedData]);
|
||||
|
||||
if ([(DisplayViewMetalLayer *)localLayer device] == nil)
|
||||
if ([(MetalDisplayViewSharedData *)macSharedData device] != nil)
|
||||
{
|
||||
[localLayer release];
|
||||
localLayer = nil;
|
||||
MacMetalDisplayView *macMTLCDV = new MacMetalDisplayView(macSharedData);
|
||||
macMTLCDV->SetNSView(self);
|
||||
macMTLCDV->Init();
|
||||
|
||||
localLayer = macMTLCDV->GetCALayer();
|
||||
isMetalLayer = YES;
|
||||
}
|
||||
|
||||
isMetalLayer = YES;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
|
||||
if (localLayer == nil)
|
||||
{
|
||||
localLayer = [[DisplayViewOpenGLLayer alloc] init];
|
||||
MacOGLDisplayView *macOGLCDV = (MacOGLDisplayView *)[(id<DisplayViewCALayer>)localLayer clientDisplay3DView];
|
||||
macOGLCDV->SetFetchObject([cdsGPU fetchObject]);
|
||||
macOGLCDV->Init();
|
||||
MacOGLDisplayView *macOGLCDV = new MacOGLDisplayView(macSharedData);
|
||||
macOGLCDV->SetNSView(self);
|
||||
macOGLCDV->SetSharedData([cdsGPU sharedData]);
|
||||
macOGLCDV->Init();
|
||||
|
||||
localLayer = macOGLCDV->GetCALayer();
|
||||
|
||||
// For macOS 10.8 Mountain Lion and later, we can use the CAOpenGLLayer directly. But for
|
||||
// earlier versions of macOS, using the CALayer directly will cause too many strange issues,
|
||||
|
@ -2137,13 +2084,13 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
|
|||
[self setWantsBestResolutionOpenGLSurface:YES];
|
||||
}
|
||||
#endif
|
||||
localOGLContext = macOGLCDV->GetNSContext();
|
||||
localOGLContext = ((MacOGLDisplayPresenter *)macOGLCDV->Get3DPresenter())->GetNSContext();
|
||||
[localOGLContext retain];
|
||||
}
|
||||
}
|
||||
|
||||
ClientDisplay3DView *cdv = [(id<DisplayViewCALayer>)localLayer clientDisplay3DView];
|
||||
cdv->UpdateView();
|
||||
MacDisplayLayeredView *cdv = [localLayer clientDisplayView];
|
||||
cdv->Get3DPresenter()->UpdateLayout();
|
||||
|
||||
if (localOGLContext != nil)
|
||||
{
|
||||
|
@ -2174,19 +2121,6 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
|
|||
}
|
||||
}
|
||||
|
||||
- (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 cdsVideoOutput] receivePort] msgID:MESSAGE_REQUEST_SCREENSHOT array:messageComponents];
|
||||
|
||||
[bitmapImageFileTypeData release];
|
||||
[messageComponents release];
|
||||
}
|
||||
|
||||
#pragma mark InputHIDManagerTarget Protocol
|
||||
- (BOOL) handleHIDQueue:(IOHIDQueueRef)hidQueue hidManager:(InputHIDManager *)hidManager
|
||||
{
|
||||
|
@ -2261,12 +2195,12 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
|
|||
|
||||
- (void)updateLayer
|
||||
{
|
||||
[self clientDisplay3DView]->FlushView();
|
||||
[self clientDisplayView]->FlushView();
|
||||
}
|
||||
|
||||
- (void)drawRect:(NSRect)dirtyRect
|
||||
{
|
||||
[self clientDisplay3DView]->FlushView();
|
||||
[self clientDisplayView]->FlushView();
|
||||
}
|
||||
|
||||
- (void)setFrame:(NSRect)rect
|
||||
|
@ -2277,7 +2211,7 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
|
|||
if (rect.size.width != oldFrame.size.width || rect.size.height != oldFrame.size.height)
|
||||
{
|
||||
DisplayWindowController *windowController = (DisplayWindowController *)[[self window] delegate];
|
||||
ClientDisplayViewProperties &props = [windowController localViewProperties];
|
||||
ClientDisplayPresenterProperties &props = [windowController localViewProperties];
|
||||
NSRect newViewportRect = rect;
|
||||
|
||||
#if defined(MAC_OS_X_VERSION_10_7) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7)
|
||||
|
@ -2290,11 +2224,11 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
|
|||
// Calculate the view scale for the given client size.
|
||||
double checkWidth = props.normalWidth;
|
||||
double checkHeight = props.normalHeight;
|
||||
ClientDisplayView::ConvertNormalToTransformedBounds(1.0, props.rotation, checkWidth, checkHeight);
|
||||
ClientDisplayPresenter::ConvertNormalToTransformedBounds(1.0, props.rotation, checkWidth, checkHeight);
|
||||
|
||||
props.clientWidth = newViewportRect.size.width;
|
||||
props.clientHeight = newViewportRect.size.height;
|
||||
props.viewScale = ClientDisplayView::GetMaxScalarWithinBounds(checkWidth, checkHeight, props.clientWidth, props.clientHeight);
|
||||
props.viewScale = ClientDisplayPresenter::GetMaxScalarWithinBounds(checkWidth, checkHeight, props.clientWidth, props.clientHeight);
|
||||
|
||||
if (localOGLContext != nil)
|
||||
{
|
||||
|
@ -2311,7 +2245,7 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
|
|||
}
|
||||
#endif
|
||||
|
||||
[[self cdsVideoOutput] commitViewProperties:props];
|
||||
[[self cdsVideoOutput] commitPresenterProperties:props];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -28,6 +28,8 @@
|
|||
@class CocoaDSCheatManager;
|
||||
@class CheatWindowDelegate;
|
||||
@class DisplayWindowController;
|
||||
@class RomInfoPanel;
|
||||
@class MacScreenshotCaptureToolDelegate;
|
||||
class AudioSampleBlockGenerator;
|
||||
|
||||
@interface EmuControllerDelegate : NSObject <NSUserInterfaceValidations, CocoaDSControllerDelegate>
|
||||
|
@ -41,15 +43,19 @@ class AudioSampleBlockGenerator;
|
|||
CocoaDSCheatManager *dummyCheatList;
|
||||
|
||||
CheatWindowDelegate *cheatWindowDelegate;
|
||||
MacScreenshotCaptureToolDelegate *screenshotCaptureToolDelegate;
|
||||
NSObjectController *firmwarePanelController;
|
||||
NSObjectController *romInfoPanelController;
|
||||
NSObjectController *cdsCoreController;
|
||||
NSObjectController *cdsSoundController;
|
||||
NSObjectController *cheatWindowController;
|
||||
NSObjectController *slot2WindowController;
|
||||
NSArrayController *inputDeviceListController;
|
||||
NSArrayController *cheatListController;
|
||||
NSArrayController *cheatDatabaseController;
|
||||
|
||||
RomInfoPanel *romInfoPanel;
|
||||
|
||||
NSWindow *displayRotationPanel;
|
||||
NSWindow *displaySeparationPanel;
|
||||
NSWindow *displayVideoSettingsPanel;
|
||||
|
@ -116,15 +122,19 @@ class AudioSampleBlockGenerator;
|
|||
@property (retain) CocoaDSCheatManager *cdsCheats;
|
||||
|
||||
@property (readonly) IBOutlet CheatWindowDelegate *cheatWindowDelegate;
|
||||
@property (readonly) IBOutlet MacScreenshotCaptureToolDelegate *screenshotCaptureToolDelegate;
|
||||
@property (readonly) IBOutlet NSObjectController *firmwarePanelController;
|
||||
@property (readonly) IBOutlet NSObjectController *romInfoPanelController;
|
||||
@property (readonly) IBOutlet NSObjectController *cdsCoreController;
|
||||
@property (readonly) IBOutlet NSObjectController *cdsSoundController;
|
||||
@property (readonly) IBOutlet NSObjectController *cheatWindowController;
|
||||
@property (readonly) IBOutlet NSObjectController *slot2WindowController;
|
||||
@property (readonly) IBOutlet NSArrayController *inputDeviceListController;
|
||||
@property (readonly) IBOutlet NSArrayController *cheatListController;
|
||||
@property (readonly) IBOutlet NSArrayController *cheatDatabaseController;
|
||||
|
||||
@property (readonly) IBOutlet RomInfoPanel *romInfoPanel;
|
||||
|
||||
@property (readonly) IBOutlet NSWindow *displayRotationPanel;
|
||||
@property (readonly) IBOutlet NSWindow *displaySeparationPanel;
|
||||
@property (readonly) IBOutlet NSWindow *displayVideoSettingsPanel;
|
||||
|
@ -278,6 +288,10 @@ class AudioSampleBlockGenerator;
|
|||
|
||||
- (void) updateAllWindowTitles;
|
||||
- (void) updateDisplayPanelTitles;
|
||||
- (void) setupUserDefaults;
|
||||
- (void) appInit;
|
||||
- (void) readUserDefaults;
|
||||
- (void) writeUserDefaults;
|
||||
- (void) restoreDisplayWindowStates;
|
||||
- (void) saveDisplayWindowStates;
|
||||
|
||||
@end
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#import "InputManager.h"
|
||||
#import "cheatWindowDelegate.h"
|
||||
#import "Slot2WindowDelegate.h"
|
||||
#import "MacScreenshotCaptureTool.h"
|
||||
|
||||
#import "cocoa_globals.h"
|
||||
#import "cocoa_cheat.h"
|
||||
|
@ -42,6 +43,7 @@
|
|||
@synthesize cdsCheats;
|
||||
|
||||
@synthesize cheatWindowDelegate;
|
||||
@synthesize screenshotCaptureToolDelegate;
|
||||
@synthesize firmwarePanelController;
|
||||
@synthesize romInfoPanelController;
|
||||
@synthesize cdsCoreController;
|
||||
|
@ -50,6 +52,9 @@
|
|||
@synthesize cheatListController;
|
||||
@synthesize cheatDatabaseController;
|
||||
@synthesize slot2WindowController;
|
||||
@synthesize inputDeviceListController;
|
||||
|
||||
@synthesize romInfoPanel;
|
||||
|
||||
@synthesize displayRotationPanel;
|
||||
@synthesize displaySeparationPanel;
|
||||
|
@ -1029,7 +1034,7 @@
|
|||
|
||||
if ([[windowController view] isHUDInputVisible])
|
||||
{
|
||||
[[windowController view] clientDisplay3DView]->UpdateView();
|
||||
[[windowController view] clientDisplayView]->SetViewNeedsFlush();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1054,7 +1059,7 @@
|
|||
|
||||
if ([[windowController view] isHUDInputVisible])
|
||||
{
|
||||
[[windowController view] clientDisplay3DView]->UpdateView();
|
||||
[[windowController view] clientDisplayView]->SetViewNeedsFlush();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1078,7 +1083,7 @@
|
|||
|
||||
if ([[windowController view] isHUDInputVisible])
|
||||
{
|
||||
[[windowController view] clientDisplay3DView]->UpdateView();
|
||||
[[windowController view] clientDisplayView]->SetViewNeedsFlush();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1808,6 +1813,7 @@
|
|||
|
||||
// Update the UI to indicate that a ROM has indeed been loaded.
|
||||
[self updateAllWindowTitles];
|
||||
[screenshotCaptureToolDelegate setRomName:[currentRom internalName]];
|
||||
|
||||
for (DisplayWindowController *windowController in windowList)
|
||||
{
|
||||
|
@ -1889,6 +1895,7 @@
|
|||
|
||||
// Update the UI to indicate that the ROM has finished unloading.
|
||||
[self updateAllWindowTitles];
|
||||
[screenshotCaptureToolDelegate setRomName:[currentRom internalName]];
|
||||
|
||||
[[cdsCore cdsGPU] clearWithColor:0x8000];
|
||||
for (DisplayWindowController *windowController in windowList)
|
||||
|
@ -2245,9 +2252,37 @@
|
|||
}
|
||||
}
|
||||
|
||||
- (void) setupUserDefaults
|
||||
- (void) appInit
|
||||
{
|
||||
[romInfoPanelController setContent:[CocoaDSRom romNotLoadedBindings]];
|
||||
[cheatWindowController setContent:[cheatWindowDelegate bindings]];
|
||||
|
||||
// Update the SLOT-2 device list.
|
||||
Slot2WindowDelegate *slot2WindowDelegate = (Slot2WindowDelegate *)[slot2WindowController content];
|
||||
[slot2WindowDelegate update];
|
||||
[slot2WindowDelegate setHidManager:[inputManager hidManager]];
|
||||
[slot2WindowDelegate setAutoSelectedDeviceText:[[slot2WindowDelegate deviceManager] autoSelectedDeviceName]];
|
||||
|
||||
CocoaDSCore *cdsCore = (CocoaDSCore *)[cdsCoreController content];
|
||||
[screenshotCaptureToolDelegate setSharedData:[[cdsCore cdsGPU] sharedData]];
|
||||
}
|
||||
|
||||
- (void) readUserDefaults
|
||||
{
|
||||
CocoaDSCore *cdsCore = (CocoaDSCore *)[cdsCoreController content];
|
||||
Slot2WindowDelegate *slot2WindowDelegate = (Slot2WindowDelegate *)[slot2WindowController content];
|
||||
|
||||
// Set up the user's default input settings.
|
||||
NSDictionary *userMappings = [[NSUserDefaults standardUserDefaults] dictionaryForKey:@"Input_ControllerMappings"];
|
||||
if (userMappings == nil)
|
||||
{
|
||||
NSDictionary *defaultKeyMappingsDict = [NSDictionary dictionaryWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"DefaultKeyMappings" ofType:@"plist"]];
|
||||
NSArray *internalDefaultProfilesList = (NSArray *)[defaultKeyMappingsDict valueForKey:@"DefaultInputProfiles"];
|
||||
userMappings = [(NSDictionary *)[internalDefaultProfilesList objectAtIndex:0] valueForKey:@"Mappings"];
|
||||
}
|
||||
|
||||
[inputManager setMappingsWithMappings:userMappings];
|
||||
[[inputManager hidManager] setDeviceListController:inputDeviceListController];
|
||||
|
||||
// Set the microphone settings per user preferences.
|
||||
[[cdsCore cdsController] setHardwareMicMute:[[NSUserDefaults standardUserDefaults] boolForKey:@"Microphone_HardwareMicMute"]];
|
||||
|
@ -2279,6 +2314,227 @@
|
|||
|
||||
// Set the stylus options per user preferences.
|
||||
[[cdsCore cdsController] setStylusPressure:[[NSUserDefaults standardUserDefaults] integerForKey:@"Emulation_StylusPressure"]];
|
||||
|
||||
// Set up the default SLOT-2 device.
|
||||
[slot2WindowDelegate setupUserDefaults];
|
||||
|
||||
// Set up the ROM Info panel.
|
||||
[romInfoPanel setupUserDefaults];
|
||||
|
||||
// Set up the screenshot capture tool defaults.
|
||||
[screenshotCaptureToolDelegate readUserDefaults];
|
||||
}
|
||||
|
||||
- (void) writeUserDefaults
|
||||
{
|
||||
[romInfoPanel writeDefaults];
|
||||
[screenshotCaptureToolDelegate writeUserDefaults];
|
||||
}
|
||||
|
||||
- (void) restoreDisplayWindowStates
|
||||
{
|
||||
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.
|
||||
[self newDisplayWindow:self];
|
||||
}
|
||||
else
|
||||
{
|
||||
for (NSDictionary *windowProperties in windowPropertiesList)
|
||||
{
|
||||
DisplayWindowController *windowController = [[DisplayWindowController alloc] initWithWindowNibName:@"DisplayWindow" emuControlDelegate:self];
|
||||
|
||||
if (windowController == nil)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
const NSInteger displayMode = ([windowProperties objectForKey:@"displayMode"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"displayMode"] integerValue] : [[NSUserDefaults standardUserDefaults] integerForKey:@"DisplayView_Mode"];
|
||||
const double displayScale = ([windowProperties objectForKey:@"displayScale"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"displayScale"] doubleValue] : ([[NSUserDefaults standardUserDefaults] doubleForKey:@"DisplayView_Size"] / 100.0);
|
||||
const double displayRotation = ([windowProperties objectForKey:@"displayRotation"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"displayRotation"] doubleValue] : [[NSUserDefaults standardUserDefaults] doubleForKey:@"DisplayView_Rotation"];
|
||||
const NSInteger displayOrientation = ([windowProperties objectForKey:@"displayOrientation"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"displayOrientation"] integerValue] : [[NSUserDefaults standardUserDefaults] integerForKey:@"DisplayViewCombo_Orientation"];
|
||||
const NSInteger displayOrder = ([windowProperties objectForKey:@"displayOrder"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"displayOrder"] integerValue] : [[NSUserDefaults standardUserDefaults] integerForKey:@"DisplayViewCombo_Order"];
|
||||
const double displayGap = ([windowProperties objectForKey:@"displayGap"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"displayGap"] doubleValue] : ([[NSUserDefaults standardUserDefaults] doubleForKey:@"DisplayViewCombo_Gap"] / 100.0);
|
||||
|
||||
const NSInteger displayMainSource = ([windowProperties objectForKey:@"displayMainVideoSource"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"displayMainVideoSource"] integerValue] : [[NSUserDefaults standardUserDefaults] integerForKey:@"DisplayView_DisplayMainVideoSource"];
|
||||
const NSInteger displayTouchSource = ([windowProperties objectForKey:@"displayTouchVideoSource"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"displayTouchVideoSource"] integerValue] : [[NSUserDefaults standardUserDefaults] integerForKey:@"DisplayView_DisplayTouchVideoSource"];
|
||||
|
||||
const BOOL videoFiltersPreferGPU = ([windowProperties objectForKey:@"videoFiltersPreferGPU"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"videoFiltersPreferGPU"] boolValue] : [[NSUserDefaults standardUserDefaults] boolForKey:@"DisplayView_FiltersPreferGPU"];
|
||||
const BOOL videoSourceDeposterize = ([windowProperties objectForKey:@"videoSourceDeposterize"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"videoSourceDeposterize"] boolValue] : [[NSUserDefaults standardUserDefaults] boolForKey:@"DisplayView_Deposterize"];
|
||||
const NSInteger videoPixelScaler = ([windowProperties objectForKey:@"videoFilterType"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"videoFilterType"] integerValue] : [[NSUserDefaults standardUserDefaults] integerForKey:@"DisplayView_VideoFilter"];
|
||||
const NSInteger videoOutputFilter = ([windowProperties objectForKey:@"videoOutputFilter"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"videoOutputFilter"] integerValue] : [[NSUserDefaults standardUserDefaults] integerForKey:@"DisplayView_OutputFilter"];
|
||||
|
||||
const BOOL hudEnable = ([windowProperties objectForKey:@"hudEnable"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"hudEnable"] boolValue] : [[NSUserDefaults standardUserDefaults] boolForKey:@"DisplayView_EnableHUD"];
|
||||
const BOOL hudShowVideoFPS = ([windowProperties objectForKey:@"hudShowVideoFPS"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"hudShowVideoFPS"] boolValue] : [[NSUserDefaults standardUserDefaults] boolForKey:@"HUD_ShowVideoFPS"];
|
||||
const BOOL hudShowRender3DFPS = ([windowProperties objectForKey:@"hudShowRender3DFPS"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"hudShowRender3DFPS"] boolValue] : [[NSUserDefaults standardUserDefaults] boolForKey:@"HUD_ShowRender3DFPS"];
|
||||
const BOOL hudShowFrameIndex = ([windowProperties objectForKey:@"hudShowFrameIndex"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"hudShowFrameIndex"] boolValue] : [[NSUserDefaults standardUserDefaults] boolForKey:@"HUD_ShowFrameIndex"];
|
||||
const BOOL hudShowLagFrameCount = ([windowProperties objectForKey:@"hudShowLagFrameCount"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"hudShowLagFrameCount"] boolValue] : [[NSUserDefaults standardUserDefaults] boolForKey:@"HUD_ShowLagFrameCount"];
|
||||
const BOOL hudShowCPULoadAverage = ([windowProperties objectForKey:@"hudShowCPULoadAverage"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"hudShowCPULoadAverage"] boolValue] : [[NSUserDefaults standardUserDefaults] boolForKey:@"HUD_ShowCPULoadAverage"];
|
||||
const BOOL hudShowRTC = ([windowProperties objectForKey:@"hudShowRTC"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"hudShowRTC"] boolValue] : [[NSUserDefaults standardUserDefaults] boolForKey:@"HUD_ShowRTC"];
|
||||
const BOOL hudShowInput = ([windowProperties objectForKey:@"hudShowInput"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"hudShowInput"] boolValue] : [[NSUserDefaults standardUserDefaults] boolForKey:@"HUD_ShowInput"];
|
||||
|
||||
const NSUInteger hudColorVideoFPS = ([windowProperties objectForKey:@"hudColorVideoFPS"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"hudColorVideoFPS"] unsignedIntegerValue] : [[NSUserDefaults standardUserDefaults] integerForKey:@"HUD_Color_VideoFPS"];
|
||||
const NSUInteger hudColorRender3DFPS = ([windowProperties objectForKey:@"hudColorRender3DFPS"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"hudColorRender3DFPS"] unsignedIntegerValue] : [[NSUserDefaults standardUserDefaults] integerForKey:@"HUD_Color_Render3DFPS"];
|
||||
const NSUInteger hudColorFrameIndex = ([windowProperties objectForKey:@"hudColorFrameIndex"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"hudColorFrameIndex"] unsignedIntegerValue] : [[NSUserDefaults standardUserDefaults] integerForKey:@"HUD_Color_FrameIndex"];
|
||||
const NSUInteger hudColorLagFrameCount = ([windowProperties objectForKey:@"hudColorLagFrameCount"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"hudColorLagFrameCount"] unsignedIntegerValue] : [[NSUserDefaults standardUserDefaults] integerForKey:@"HUD_Color_LagFrameCount"];
|
||||
const NSUInteger hudColorCPULoadAverage = ([windowProperties objectForKey:@"hudColorCPULoadAverage"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"hudColorCPULoadAverage"] unsignedIntegerValue] : [[NSUserDefaults standardUserDefaults] integerForKey:@"HUD_Color_CPULoadAverage"];
|
||||
const NSUInteger hudColorRTC = ([windowProperties objectForKey:@"hudColorRTC"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"hudColorRTC"] unsignedIntegerValue] : [[NSUserDefaults standardUserDefaults] integerForKey:@"HUD_Color_RTC"];
|
||||
const NSUInteger hudColorInputPendingAndApplied = ([windowProperties objectForKey:@"hudColorInputPendingAndApplied"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"hudColorInputPendingAndApplied"] unsignedIntegerValue] : [[NSUserDefaults standardUserDefaults] integerForKey:@"HUD_Color_Input_PendingAndApplied"];
|
||||
const NSUInteger hudColorInputAppliedOnly = ([windowProperties objectForKey:@"hudColorInputAppliedOnly"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"hudColorInputAppliedOnly"] unsignedIntegerValue] : [[NSUserDefaults standardUserDefaults] integerForKey:@"HUD_Color_Input_AppliedOnly"];
|
||||
const NSUInteger hudColorInputPendingOnly = ([windowProperties objectForKey:@"hudColorInputPendingOnly"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"hudColorInputPendingOnly"] unsignedIntegerValue] : [[NSUserDefaults standardUserDefaults] integerForKey:@"HUD_Color_Input_PendingOnly"];
|
||||
|
||||
const BOOL useVerticalSync = ([windowProperties objectForKey:@"useVerticalSync"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"useVerticalSync"] boolValue] : YES;
|
||||
const BOOL isMinSizeNormal = ([windowProperties objectForKey:@"isMinSizeNormal"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"isMinSizeNormal"] boolValue] : YES;
|
||||
const BOOL isShowingStatusBar = ([windowProperties objectForKey:@"isShowingStatusBar"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"isShowingStatusBar"] boolValue] : [[NSUserDefaults standardUserDefaults] boolForKey:@"DisplayView_ShowStatusBar"];
|
||||
const BOOL isInFullScreenMode = ([windowProperties objectForKey:@"isInFullScreenMode"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"isInFullScreenMode"] boolValue] : NO;
|
||||
const NSUInteger screenIndex = ([windowProperties objectForKey:@"screenIndex"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"screenIndex"] unsignedIntegerValue] : 0;
|
||||
NSString *windowFrameStr = (NSString *)[windowProperties valueForKey:@"windowFrame"];
|
||||
|
||||
int frameX = 0;
|
||||
int frameY = 0;
|
||||
int frameWidth = 256;
|
||||
int frameHeight = 192*2;
|
||||
const char *frameCStr = [windowFrameStr cStringUsingEncoding:NSUTF8StringEncoding];
|
||||
sscanf(frameCStr, "%i %i %i %i", &frameX, &frameY, &frameWidth, &frameHeight);
|
||||
|
||||
// Force the window to load now so that we can overwrite its internal defaults with the user's defaults.
|
||||
[windowController window];
|
||||
|
||||
[windowController setDisplayMode:(ClientDisplayMode)displayMode
|
||||
viewScale:displayScale
|
||||
rotation:displayRotation
|
||||
layout:(ClientDisplayLayout)displayOrientation
|
||||
order:(ClientDisplayOrder)displayOrder
|
||||
gapScale:displayGap
|
||||
isMinSizeNormal:isMinSizeNormal
|
||||
isShowingStatusBar:isShowingStatusBar];
|
||||
|
||||
[[windowController view] setDisplayMainVideoSource:displayMainSource];
|
||||
[[windowController view] setDisplayTouchVideoSource:displayTouchSource];
|
||||
|
||||
[windowController setVideoPropertiesWithoutUpdateUsingPreferGPU:videoFiltersPreferGPU
|
||||
sourceDeposterize:videoSourceDeposterize
|
||||
outputFilter:videoOutputFilter
|
||||
pixelScaler:videoPixelScaler];
|
||||
|
||||
[[windowController view] setUseVerticalSync:useVerticalSync];
|
||||
[[windowController view] setIsHUDVisible:hudEnable];
|
||||
[[windowController view] setIsHUDVideoFPSVisible:hudShowVideoFPS];
|
||||
[[windowController view] setIsHUDRender3DFPSVisible:hudShowRender3DFPS];
|
||||
[[windowController view] setIsHUDFrameIndexVisible:hudShowFrameIndex];
|
||||
[[windowController view] setIsHUDLagFrameCountVisible:hudShowLagFrameCount];
|
||||
[[windowController view] setIsHUDCPULoadAverageVisible:hudShowCPULoadAverage];
|
||||
[[windowController view] setIsHUDRealTimeClockVisible:hudShowRTC];
|
||||
[[windowController view] setIsHUDInputVisible:hudShowInput];
|
||||
|
||||
[[windowController view] setHudColorVideoFPS:[CocoaDSUtil NSColorFromRGBA8888:(uint32_t)hudColorVideoFPS]];
|
||||
[[windowController view] setHudColorRender3DFPS:[CocoaDSUtil NSColorFromRGBA8888:(uint32_t)hudColorRender3DFPS]];
|
||||
[[windowController view] setHudColorFrameIndex:[CocoaDSUtil NSColorFromRGBA8888:(uint32_t)hudColorFrameIndex]];
|
||||
[[windowController view] setHudColorLagFrameCount:[CocoaDSUtil NSColorFromRGBA8888:(uint32_t)hudColorLagFrameCount]];
|
||||
[[windowController view] setHudColorCPULoadAverage:[CocoaDSUtil NSColorFromRGBA8888:(uint32_t)hudColorCPULoadAverage]];
|
||||
[[windowController view] setHudColorRTC:[CocoaDSUtil NSColorFromRGBA8888:(uint32_t)hudColorRTC]];
|
||||
[[windowController view] setHudColorInputPendingAndApplied:[CocoaDSUtil NSColorFromRGBA8888:(uint32_t)hudColorInputPendingAndApplied]];
|
||||
[[windowController view] setHudColorInputAppliedOnly:[CocoaDSUtil NSColorFromRGBA8888:(uint32_t)hudColorInputAppliedOnly]];
|
||||
[[windowController view] setHudColorInputPendingOnly:[CocoaDSUtil NSColorFromRGBA8888:(uint32_t)hudColorInputPendingOnly]];
|
||||
|
||||
[[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.
|
||||
[[windowController view] setAllowViewUpdates:YES];
|
||||
[[[windowController view] cdsVideoOutput] handleReloadReprocessRedraw];
|
||||
|
||||
if (windowProperties == [windowPropertiesList lastObject])
|
||||
{
|
||||
[[windowController window] makeKeyAndOrderFront:self];
|
||||
[[windowController window] makeMainWindow];
|
||||
}
|
||||
else
|
||||
{
|
||||
[[windowController window] orderFront:self];
|
||||
}
|
||||
|
||||
// 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 toggleFullScreenDisplay:self];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void) saveDisplayWindowStates
|
||||
{
|
||||
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 NSUInteger screenIndex = [[NSScreen screens] indexOfObject:[[windowController masterWindow] screen]];
|
||||
|
||||
const NSRect windowFrame = [windowController masterWindowFrame];
|
||||
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 masterWindowScale]], @"displayScale",
|
||||
[NSNumber numberWithDouble:[windowController displayRotation]], @"displayRotation",
|
||||
[NSNumber numberWithInteger:[[windowController view] displayMainVideoSource]], @"displayMainVideoSource",
|
||||
[NSNumber numberWithInteger:[[windowController view] displayTouchVideoSource]], @"displayTouchVideoSource",
|
||||
[NSNumber numberWithInteger:[windowController displayOrientation]], @"displayOrientation",
|
||||
[NSNumber numberWithInteger:[windowController displayOrder]], @"displayOrder",
|
||||
[NSNumber numberWithDouble:[windowController displayGap]], @"displayGap",
|
||||
[NSNumber numberWithBool:[[windowController view] videoFiltersPreferGPU]], @"videoFiltersPreferGPU",
|
||||
[NSNumber numberWithInteger:[[windowController view] pixelScaler]], @"videoFilterType",
|
||||
[NSNumber numberWithInteger:[[windowController view] outputFilter]], @"videoOutputFilter",
|
||||
[NSNumber numberWithBool:[[windowController view] sourceDeposterize]], @"videoSourceDeposterize",
|
||||
[NSNumber numberWithBool:[[windowController view] useVerticalSync]], @"useVerticalSync",
|
||||
[NSNumber numberWithBool:[[windowController view] isHUDVisible]], @"hudEnable",
|
||||
[NSNumber numberWithBool:[[windowController view] isHUDVideoFPSVisible]], @"hudShowVideoFPS",
|
||||
[NSNumber numberWithBool:[[windowController view] isHUDRender3DFPSVisible]], @"hudShowRender3DFPS",
|
||||
[NSNumber numberWithBool:[[windowController view] isHUDFrameIndexVisible]], @"hudShowFrameIndex",
|
||||
[NSNumber numberWithBool:[[windowController view] isHUDLagFrameCountVisible]], @"hudShowLagFrameCount",
|
||||
[NSNumber numberWithBool:[[windowController view] isHUDCPULoadAverageVisible]], @"hudShowCPULoadAverage",
|
||||
[NSNumber numberWithBool:[[windowController view] isHUDRealTimeClockVisible]], @"hudShowRTC",
|
||||
[NSNumber numberWithBool:[[windowController view] isHUDInputVisible]], @"hudShowInput",
|
||||
[NSNumber numberWithUnsignedInteger:[CocoaDSUtil RGBA8888FromNSColor:[[windowController view] hudColorVideoFPS]]], @"hudColorVideoFPS",
|
||||
[NSNumber numberWithUnsignedInteger:[CocoaDSUtil RGBA8888FromNSColor:[[windowController view] hudColorRender3DFPS]]], @"hudColorRender3DFPS",
|
||||
[NSNumber numberWithUnsignedInteger:[CocoaDSUtil RGBA8888FromNSColor:[[windowController view] hudColorFrameIndex]]], @"hudColorFrameIndex",
|
||||
[NSNumber numberWithUnsignedInteger:[CocoaDSUtil RGBA8888FromNSColor:[[windowController view] hudColorLagFrameCount]]], @"hudColorLagFrameCount",
|
||||
[NSNumber numberWithUnsignedInteger:[CocoaDSUtil RGBA8888FromNSColor:[[windowController view] hudColorCPULoadAverage]]], @"hudColorCPULoadAverage",
|
||||
[NSNumber numberWithUnsignedInteger:[CocoaDSUtil RGBA8888FromNSColor:[[windowController view] hudColorRTC]]], @"hudColorRTC",
|
||||
[NSNumber numberWithUnsignedInteger:[CocoaDSUtil RGBA8888FromNSColor:[[windowController view] hudColorInputPendingAndApplied]]], @"hudColorInputPendingAndApplied",
|
||||
[NSNumber numberWithUnsignedInteger:[CocoaDSUtil RGBA8888FromNSColor:[[windowController view] hudColorInputAppliedOnly]]], @"hudColorInputAppliedOnly",
|
||||
[NSNumber numberWithUnsignedInteger:[CocoaDSUtil RGBA8888FromNSColor:[[windowController view] hudColorInputPendingOnly]]], @"hudColorInputPendingOnly",
|
||||
[NSNumber numberWithBool:[windowController isMinSizeNormal]], @"isMinSizeNormal",
|
||||
[NSNumber numberWithBool:[windowController masterStatusBarState]], @"isShowingStatusBar",
|
||||
[NSNumber numberWithBool:[windowController isFullScreen]], @"isInFullScreenMode",
|
||||
[NSNumber numberWithUnsignedInteger:screenIndex], @"screenIndex",
|
||||
windowFrameStr, @"windowFrame",
|
||||
nil];
|
||||
|
||||
[windowPropertiesList addObject:windowProperties];
|
||||
}
|
||||
|
||||
[[NSUserDefaults standardUserDefaults] setObject:windowPropertiesList forKey:@"General_DisplayWindowRestorableStates"];
|
||||
}
|
||||
else
|
||||
{
|
||||
[[NSUserDefaults standardUserDefaults] removeObjectForKey:@"General_DisplayWindowRestorableStates"];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark NSUserInterfaceValidations Protocol
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#endif
|
||||
|
||||
class MacMetalFetchObject;
|
||||
class MacMetalDisplayPresenter;
|
||||
class MacMetalDisplayView;
|
||||
|
||||
struct DisplayViewShaderProperties
|
||||
|
@ -155,16 +156,17 @@ typedef DisplayViewShaderProperties DisplayViewShaderProperties;
|
|||
|
||||
@end
|
||||
|
||||
@interface DisplayViewMetalLayer : CAMetalLayer <DisplayViewCALayer>
|
||||
@interface MacMetalDisplayPresenterObject : NSObject
|
||||
{
|
||||
MacMetalDisplayView *_cdv;
|
||||
ClientDisplay3DPresenter *cdp;
|
||||
MetalDisplayViewSharedData *sharedData;
|
||||
|
||||
MTLRenderPassDescriptor *_outputRenderPassDesc;
|
||||
MTLRenderPassColorAttachmentDescriptor *colorAttachment0Desc;
|
||||
id<MTLComputePipelineState> pixelScalePipeline;
|
||||
id<MTLRenderPipelineState> displayOutputPipeline;
|
||||
id<MTLRenderPipelineState> displayRGBAOutputPipeline;
|
||||
id<MTLRenderPipelineState> outputRGBAPipeline;
|
||||
id<MTLRenderPipelineState> outputDrawablePipeline;
|
||||
MTLPixelFormat drawableFormat;
|
||||
|
||||
id<MTLBuffer> _cdvPropertiesBuffer;
|
||||
id<MTLBuffer> _displayVtxPositionBuffer;
|
||||
|
@ -202,11 +204,15 @@ typedef DisplayViewShaderProperties DisplayViewShaderProperties;
|
|||
size_t _hudTouchLineLength;
|
||||
}
|
||||
|
||||
@property (readonly, nonatomic) ClientDisplay3DPresenter *cdp;
|
||||
@property (assign, nonatomic) MetalDisplayViewSharedData *sharedData;
|
||||
@property (readonly, nonatomic) MTLRenderPassColorAttachmentDescriptor *colorAttachment0Desc;
|
||||
@property (readonly, nonatomic) pthread_mutex_t *mutexDisplayTextureUpdate;
|
||||
@property (readonly, nonatomic) pthread_mutex_t *mutexBufferUpdate;
|
||||
@property (retain) id<MTLComputePipelineState> pixelScalePipeline;
|
||||
@property (retain) id<MTLRenderPipelineState> displayOutputPipeline;
|
||||
@property (retain) id<MTLRenderPipelineState> displayRGBAOutputPipeline;
|
||||
@property (retain) id<MTLRenderPipelineState> outputRGBAPipeline;
|
||||
@property (retain) id<MTLRenderPipelineState> outputDrawablePipeline;
|
||||
@property (assign) MTLPixelFormat drawableFormat;
|
||||
@property (retain) id<MTLBuffer> bufCPUFilterSrcMain;
|
||||
@property (retain) id<MTLBuffer> bufCPUFilterSrcTouch;
|
||||
@property (retain) id<MTLBuffer> bufCPUFilterDstMain;
|
||||
|
@ -221,17 +227,31 @@ typedef DisplayViewShaderProperties DisplayViewShaderProperties;
|
|||
@property (assign, nonatomic) VideoFilterTypeID pixelScaler;
|
||||
@property (assign, nonatomic) OutputFilterTypeID outputFilter;
|
||||
|
||||
- (id) initWithDisplayPresenter:(MacMetalDisplayPresenter *)thePresenter;
|
||||
- (id<MTLCommandBuffer>) newCommandBuffer;
|
||||
- (void) setupLayer;
|
||||
- (void) setup;
|
||||
- (void) resizeCPUPixelScalerUsingFilterID:(const VideoFilterTypeID)filterID;
|
||||
- (void) copyHUDFontUsingFace:(const FT_Face &)fontFace size:(const size_t)glyphSize tileSize:(const size_t)glyphTileSize info:(GlyphInfo *)glyphInfo;
|
||||
- (void) processDisplays;
|
||||
- (void) updateRenderBuffers;
|
||||
- (void) renderForCommandBuffer:(id<MTLCommandBuffer>)cb
|
||||
displayPipelineState:(id<MTLRenderPipelineState>)displayPipelineState
|
||||
outputPipelineState:(id<MTLRenderPipelineState>)outputPipelineState
|
||||
hudPipelineState:(id<MTLRenderPipelineState>)hudPipelineState;
|
||||
- (void) renderAndDownloadToBuffer:(uint32_t *)dstBuffer;
|
||||
- (void) renderAndFlushDrawable;
|
||||
- (void) renderToBuffer:(uint32_t *)dstBuffer;
|
||||
|
||||
@end
|
||||
|
||||
@interface DisplayViewMetalLayer : CAMetalLayer<DisplayViewCALayer>
|
||||
{
|
||||
MacDisplayLayeredView *_cdv;
|
||||
MacMetalDisplayPresenterObject *presenterObject;
|
||||
}
|
||||
|
||||
@property (readonly, nonatomic) MacMetalDisplayPresenterObject *presenterObject;
|
||||
|
||||
- (id) initWithDisplayPresenterObject:(MacMetalDisplayPresenterObject *)thePresenterObject;
|
||||
- (void) setupLayer;
|
||||
- (void) renderToDrawable;
|
||||
|
||||
@end
|
||||
|
||||
|
@ -260,11 +280,14 @@ public:
|
|||
|
||||
#pragma mark -
|
||||
|
||||
class MacMetalDisplayView : public ClientDisplay3DView, public DisplayViewCALayerInterface
|
||||
class MacMetalDisplayPresenter : public ClientDisplay3DPresenter, public MacDisplayPresenterInterface
|
||||
{
|
||||
private:
|
||||
void __InstanceInit(MacClientSharedObject *sharedObject);
|
||||
|
||||
protected:
|
||||
pthread_mutex_t *_mutexProcessPtr;
|
||||
OSSpinLock _spinlockViewNeedsFlush;
|
||||
MacMetalDisplayPresenterObject *_presenterObject;
|
||||
pthread_mutex_t _mutexProcessPtr;
|
||||
|
||||
virtual void _UpdateNormalSize();
|
||||
virtual void _UpdateOrder();
|
||||
|
@ -275,15 +298,15 @@ protected:
|
|||
virtual void _ResizeCPUPixelScaler(const VideoFilterTypeID filterID);
|
||||
|
||||
public:
|
||||
MacMetalDisplayView();
|
||||
virtual ~MacMetalDisplayView();
|
||||
MacMetalDisplayPresenter();
|
||||
MacMetalDisplayPresenter(MacClientSharedObject *sharedObject);
|
||||
virtual ~MacMetalDisplayPresenter();
|
||||
|
||||
pthread_mutex_t* GetMutexProcessPtr() const;
|
||||
MacMetalDisplayPresenterObject* GetPresenterObject() const;
|
||||
pthread_mutex_t* GetMutexProcessPtr();
|
||||
|
||||
virtual void Init();
|
||||
virtual bool GetViewNeedsFlush();
|
||||
virtual void SetAllowViewFlushes(bool allowFlushes);
|
||||
|
||||
virtual void SetSharedData(MacClientSharedObject *sharedObject);
|
||||
virtual void CopyHUDFont(const FT_Face &fontFace, const size_t glyphSize, const size_t glyphTileSize, GlyphInfo *glyphInfo);
|
||||
|
||||
// NDS screen filters
|
||||
|
@ -293,12 +316,35 @@ public:
|
|||
|
||||
// Client view interface
|
||||
virtual void ProcessDisplays();
|
||||
virtual void UpdateView();
|
||||
virtual void FlushView();
|
||||
virtual void UpdateLayout();
|
||||
|
||||
virtual void CopyFrameToBuffer(uint32_t *dstBuffer);
|
||||
};
|
||||
|
||||
class MacMetalDisplayView : public MacDisplayLayeredView
|
||||
{
|
||||
private:
|
||||
void __InstanceInit(MacClientSharedObject *sharedObject);
|
||||
|
||||
protected:
|
||||
OSSpinLock _spinlockViewNeedsFlush;
|
||||
|
||||
public:
|
||||
MacMetalDisplayView();
|
||||
MacMetalDisplayView(MacClientSharedObject *sharedObject);
|
||||
virtual ~MacMetalDisplayView();
|
||||
|
||||
virtual void Init();
|
||||
|
||||
virtual bool GetViewNeedsFlush();
|
||||
virtual void SetViewNeedsFlush();
|
||||
|
||||
virtual void SetAllowViewFlushes(bool allowFlushes);
|
||||
|
||||
// Client view interface
|
||||
virtual void FlushView();
|
||||
};
|
||||
|
||||
#pragma mark -
|
||||
void SetupHQnxLUTs_Metal(id<MTLDevice> &device, id<MTLTexture> &texLQ2xLUT, id<MTLTexture> &texHQ2xLUT, id<MTLTexture> &texHQ3xLUT, id<MTLTexture> &texHQ4xLUT);
|
||||
void DeleteHQnxLUTs_Metal(id<MTLTexture> &texLQ2xLUT, id<MTLTexture> &texHQ2xLUT, id<MTLTexture> &texHQ3xLUT, id<MTLTexture> &texHQ4xLUT);
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -39,8 +39,9 @@ class MacOGLDisplayView;
|
|||
|
||||
@interface DisplayViewOpenGLLayer : CAOpenGLLayer <DisplayViewCALayer>
|
||||
{
|
||||
MacOGLDisplayView *_cdv;
|
||||
MacDisplayLayeredView *_cdv;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
class MacOGLClientFetchObject : public OGLClientFetchObject
|
||||
|
@ -61,19 +62,21 @@ public:
|
|||
virtual void FetchFromBufferIndex(const u8 index);
|
||||
};
|
||||
|
||||
class MacOGLDisplayView : public OGLVideoOutput, public DisplayViewCALayerInterface
|
||||
class MacOGLDisplayPresenter : public OGLVideoOutput, public MacDisplayPresenterInterface
|
||||
{
|
||||
private:
|
||||
void __InstanceInit(MacClientSharedObject *sharedObject);
|
||||
|
||||
protected:
|
||||
NSOpenGLContext *_nsContext;
|
||||
NSOpenGLPixelFormat *_nsPixelFormat;
|
||||
CGLContextObj _context;
|
||||
CGLPixelFormatObj _pixelFormat;
|
||||
|
||||
OSSpinLock _spinlockViewNeedsFlush;
|
||||
|
||||
public:
|
||||
void operator delete(void *ptr);
|
||||
MacOGLDisplayView();
|
||||
MacOGLDisplayPresenter();
|
||||
MacOGLDisplayPresenter(MacClientSharedObject *sharedObject);
|
||||
|
||||
virtual void Init();
|
||||
|
||||
|
@ -82,12 +85,7 @@ public:
|
|||
CGLPixelFormatObj GetPixelFormat() const;
|
||||
CGLContextObj GetContext() const;
|
||||
|
||||
virtual bool GetViewNeedsFlush();
|
||||
virtual void SetAllowViewFlushes(bool allowFlushes);
|
||||
|
||||
virtual void LoadHUDFont();
|
||||
|
||||
virtual void SetUseVerticalSync(const bool useVerticalSync);
|
||||
virtual void SetScaleFactor(const double scaleFactor);
|
||||
|
||||
// NDS screen filters
|
||||
|
@ -98,12 +96,34 @@ public:
|
|||
// Client view interface
|
||||
virtual void LoadDisplays();
|
||||
virtual void ProcessDisplays();
|
||||
virtual void UpdateView();
|
||||
virtual void FlushView();
|
||||
virtual void CopyFrameToBuffer(uint32_t *dstBuffer);
|
||||
virtual void FinishFrameAtIndex(const uint8_t bufferIndex);
|
||||
virtual void LockDisplayTextures();
|
||||
virtual void UnlockDisplayTextures();
|
||||
};
|
||||
|
||||
class MacOGLDisplayView : public MacDisplayLayeredView
|
||||
{
|
||||
private:
|
||||
void __InstanceInit(MacClientSharedObject *sharedObject);
|
||||
|
||||
protected:
|
||||
OSSpinLock _spinlockViewNeedsFlush;
|
||||
|
||||
public:
|
||||
MacOGLDisplayView();
|
||||
MacOGLDisplayView(MacClientSharedObject *sharedObject);
|
||||
virtual ~MacOGLDisplayView();
|
||||
|
||||
virtual bool GetViewNeedsFlush();
|
||||
virtual void SetViewNeedsFlush();
|
||||
|
||||
virtual void SetAllowViewFlushes(bool allowFlushes);
|
||||
|
||||
virtual void SetUseVerticalSync(const bool useVerticalSync);
|
||||
|
||||
// Client view interface
|
||||
virtual void FlushView();
|
||||
};
|
||||
|
||||
#endif // _MAC_OGLDISPLAYOUTPUT_H_
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
|
||||
@implementation DisplayViewOpenGLLayer
|
||||
|
||||
@synthesize _cdv;
|
||||
|
||||
- (id)init
|
||||
{
|
||||
self = [super init];
|
||||
|
@ -29,8 +31,7 @@
|
|||
return nil;
|
||||
}
|
||||
|
||||
_cdv = new MacOGLDisplayView();
|
||||
_cdv->SetFrontendLayer(self);
|
||||
_cdv = NULL;
|
||||
|
||||
[self setBounds:CGRectMake(0.0f, 0.0f, (float)GPU_FRAMEBUFFER_NATIVE_WIDTH, (float)GPU_FRAMEBUFFER_NATIVE_HEIGHT)];
|
||||
[self setAsynchronous:NO];
|
||||
|
@ -39,21 +40,9 @@
|
|||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
delete _cdv;
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (OGLContextInfo *) contextInfo
|
||||
{
|
||||
return _cdv->GetContextInfo();
|
||||
}
|
||||
|
||||
- (ClientDisplay3DView *)clientDisplay3DView
|
||||
{
|
||||
return _cdv;
|
||||
return ((MacOGLDisplayPresenter *)(_cdv->Get3DPresenter()))->GetContextInfo();
|
||||
}
|
||||
|
||||
- (BOOL)isAsynchronous
|
||||
|
@ -63,19 +52,19 @@
|
|||
|
||||
- (CGLPixelFormatObj)copyCGLPixelFormatForDisplayMask:(uint32_t)mask
|
||||
{
|
||||
return _cdv->GetPixelFormat();
|
||||
return ((MacOGLDisplayPresenter *)(_cdv->Get3DPresenter()))->GetPixelFormat();
|
||||
}
|
||||
|
||||
- (CGLContextObj)copyCGLContextForPixelFormat:(CGLPixelFormatObj)pixelFormat
|
||||
{
|
||||
return _cdv->GetContext();
|
||||
return ((MacOGLDisplayPresenter *)(_cdv->Get3DPresenter()))->GetContext();
|
||||
}
|
||||
|
||||
- (void)drawInCGLContext:(CGLContextObj)glContext pixelFormat:(CGLPixelFormatObj)pixelFormat forLayerTime:(CFTimeInterval)timeInterval displayTime:(const CVTimeStamp *)timeStamp
|
||||
{
|
||||
CGLSetCurrentContext(glContext);
|
||||
CGLLockContext(glContext);
|
||||
_cdv->RenderFrameOGL(false);
|
||||
((MacOGLDisplayPresenter *)(_cdv->Get3DPresenter()))->RenderFrameOGL(false);
|
||||
[super drawInCGLContext:glContext pixelFormat:pixelFormat forLayerTime:timeInterval displayTime:timeStamp];
|
||||
CGLUnlockContext(glContext);
|
||||
}
|
||||
|
@ -214,18 +203,18 @@ void MacOGLClientFetchObject::FetchFromBufferIndex(const u8 index)
|
|||
|
||||
#pragma mark -
|
||||
|
||||
void MacOGLDisplayView::operator delete(void *ptr)
|
||||
void MacOGLDisplayPresenter::operator delete(void *ptr)
|
||||
{
|
||||
CGLContextObj context = ((MacOGLDisplayView *)ptr)->GetContext();
|
||||
CGLContextObj context = ((MacOGLDisplayPresenter *)ptr)->GetContext();
|
||||
|
||||
if (context != NULL)
|
||||
{
|
||||
OGLContextInfo *contextInfo = ((MacOGLDisplayView *)ptr)->GetContextInfo();
|
||||
OGLContextInfo *contextInfo = ((MacOGLDisplayPresenter *)ptr)->GetContextInfo();
|
||||
CGLContextObj prevContext = CGLGetCurrentContext();
|
||||
CGLSetCurrentContext(context);
|
||||
|
||||
[((MacOGLDisplayView *)ptr)->GetNSContext() release];
|
||||
[((MacOGLDisplayView *)ptr)->GetNSPixelFormat() release];
|
||||
[((MacOGLDisplayPresenter *)ptr)->GetNSContext() release];
|
||||
[((MacOGLDisplayPresenter *)ptr)->GetNSPixelFormat() release];
|
||||
delete contextInfo;
|
||||
::operator delete(ptr);
|
||||
|
||||
|
@ -233,7 +222,17 @@ void MacOGLDisplayView::operator delete(void *ptr)
|
|||
}
|
||||
}
|
||||
|
||||
MacOGLDisplayView::MacOGLDisplayView()
|
||||
MacOGLDisplayPresenter::MacOGLDisplayPresenter()
|
||||
{
|
||||
__InstanceInit(nil);
|
||||
}
|
||||
|
||||
MacOGLDisplayPresenter::MacOGLDisplayPresenter(MacClientSharedObject *sharedObject) : MacDisplayPresenterInterface(sharedObject)
|
||||
{
|
||||
__InstanceInit(sharedObject);
|
||||
}
|
||||
|
||||
void MacOGLDisplayPresenter::__InstanceInit(MacClientSharedObject *sharedObject)
|
||||
{
|
||||
// Initialize the OpenGL context.
|
||||
//
|
||||
|
@ -241,7 +240,6 @@ MacOGLDisplayView::MacOGLDisplayView()
|
|||
// [NSOpenGLContext CGLContextObj] is available on macOS 10.5 Leopard, but
|
||||
// [NSOpenGLContext initWithCGLContextObj:] is only available on macOS 10.6
|
||||
// Snow Leopard.
|
||||
bool useContext_3_2 = false;
|
||||
NSOpenGLPixelFormatAttribute attributes[] = {
|
||||
NSOpenGLPFAColorSize, (NSOpenGLPixelFormatAttribute)24,
|
||||
NSOpenGLPFAAlphaSize, (NSOpenGLPixelFormatAttribute)8,
|
||||
|
@ -255,7 +253,7 @@ MacOGLDisplayView::MacOGLDisplayView()
|
|||
#ifdef _OGLDISPLAYOUTPUT_3_2_H_
|
||||
// If we can support a 3.2 Core Profile context, then request that in our
|
||||
// pixel format attributes.
|
||||
useContext_3_2 = IsOSXVersionSupported(10, 7, 0);
|
||||
bool useContext_3_2 = IsOSXVersionSupported(10, 7, 0);
|
||||
if (useContext_3_2)
|
||||
{
|
||||
attributes[9] = NSOpenGLPFAOpenGLProfile;
|
||||
|
@ -277,11 +275,14 @@ MacOGLDisplayView::MacOGLDisplayView()
|
|||
|
||||
_nsContext = nil;
|
||||
_context = nil;
|
||||
_allowViewUpdates = false;
|
||||
_spinlockViewNeedsFlush = OS_SPINLOCK_INIT;
|
||||
|
||||
if (sharedObject != nil)
|
||||
{
|
||||
SetFetchObject([sharedObject GPUFetchObject]);
|
||||
}
|
||||
}
|
||||
|
||||
void MacOGLDisplayView::Init()
|
||||
void MacOGLDisplayPresenter::Init()
|
||||
{
|
||||
this->_nsContext = [[NSOpenGLContext alloc] initWithFormat:this->_nsPixelFormat
|
||||
shareContext:((MacOGLClientFetchObject *)this->_fetchObject)->GetNSContext()];
|
||||
|
@ -308,26 +309,146 @@ void MacOGLDisplayView::Init()
|
|||
CGLSetCurrentContext(prevContext);
|
||||
}
|
||||
|
||||
NSOpenGLPixelFormat* MacOGLDisplayView::GetNSPixelFormat() const
|
||||
NSOpenGLPixelFormat* MacOGLDisplayPresenter::GetNSPixelFormat() const
|
||||
{
|
||||
return this->_nsPixelFormat;
|
||||
}
|
||||
|
||||
NSOpenGLContext* MacOGLDisplayView::GetNSContext() const
|
||||
NSOpenGLContext* MacOGLDisplayPresenter::GetNSContext() const
|
||||
{
|
||||
return this->_nsContext;
|
||||
}
|
||||
|
||||
CGLPixelFormatObj MacOGLDisplayView::GetPixelFormat() const
|
||||
CGLPixelFormatObj MacOGLDisplayPresenter::GetPixelFormat() const
|
||||
{
|
||||
return this->_pixelFormat;
|
||||
}
|
||||
|
||||
CGLContextObj MacOGLDisplayView::GetContext() const
|
||||
CGLContextObj MacOGLDisplayPresenter::GetContext() const
|
||||
{
|
||||
return this->_context;
|
||||
}
|
||||
|
||||
void MacOGLDisplayPresenter::LoadHUDFont()
|
||||
{
|
||||
CGLLockContext(this->_context);
|
||||
CGLSetCurrentContext(this->_context);
|
||||
this->OGLVideoOutput::LoadHUDFont();
|
||||
CGLUnlockContext(this->_context);
|
||||
}
|
||||
|
||||
void MacOGLDisplayPresenter::SetScaleFactor(const double scaleFactor)
|
||||
{
|
||||
CGLLockContext(this->_context);
|
||||
CGLSetCurrentContext(this->_context);
|
||||
this->OGLVideoOutput::SetScaleFactor(scaleFactor);
|
||||
CGLUnlockContext(this->_context);
|
||||
}
|
||||
|
||||
void MacOGLDisplayPresenter::SetFiltersPreferGPU(const bool preferGPU)
|
||||
{
|
||||
CGLLockContext(this->_context);
|
||||
CGLSetCurrentContext(this->_context);
|
||||
this->OGLVideoOutput::SetFiltersPreferGPU(preferGPU);
|
||||
CGLUnlockContext(this->_context);
|
||||
}
|
||||
|
||||
void MacOGLDisplayPresenter::SetOutputFilter(const OutputFilterTypeID filterID)
|
||||
{
|
||||
CGLLockContext(this->_context);
|
||||
CGLSetCurrentContext(this->_context);
|
||||
this->OGLVideoOutput::SetOutputFilter(filterID);
|
||||
CGLUnlockContext(this->_context);
|
||||
}
|
||||
|
||||
void MacOGLDisplayPresenter::SetPixelScaler(const VideoFilterTypeID filterID)
|
||||
{
|
||||
CGLLockContext(this->_context);
|
||||
CGLSetCurrentContext(this->_context);
|
||||
this->OGLVideoOutput::SetPixelScaler(filterID);
|
||||
CGLUnlockContext(this->_context);
|
||||
}
|
||||
|
||||
// NDS GPU Interface
|
||||
void MacOGLDisplayPresenter::LoadDisplays()
|
||||
{
|
||||
CGLLockContext(this->_context);
|
||||
CGLSetCurrentContext(this->_context);
|
||||
this->OGLVideoOutput::LoadDisplays();
|
||||
CGLUnlockContext(this->_context);
|
||||
}
|
||||
|
||||
void MacOGLDisplayPresenter::ProcessDisplays()
|
||||
{
|
||||
CGLLockContext(this->_context);
|
||||
CGLSetCurrentContext(this->_context);
|
||||
this->OGLVideoOutput::ProcessDisplays();
|
||||
CGLUnlockContext(this->_context);
|
||||
}
|
||||
|
||||
void MacOGLDisplayPresenter::CopyFrameToBuffer(uint32_t *dstBuffer)
|
||||
{
|
||||
CGLLockContext(this->_context);
|
||||
CGLSetCurrentContext(this->_context);
|
||||
this->OGLVideoOutput::CopyFrameToBuffer(dstBuffer);
|
||||
CGLUnlockContext(this->_context);
|
||||
}
|
||||
|
||||
void MacOGLDisplayPresenter::FinishFrameAtIndex(const uint8_t bufferIndex)
|
||||
{
|
||||
CGLLockContext(this->_context);
|
||||
CGLSetCurrentContext(this->_context);
|
||||
this->OGLVideoOutput::FinishFrameAtIndex(bufferIndex);
|
||||
CGLUnlockContext(this->_context);
|
||||
}
|
||||
|
||||
void MacOGLDisplayPresenter::LockDisplayTextures()
|
||||
{
|
||||
const GPUClientFetchObject &fetchObj = this->GetFetchObject();
|
||||
const u8 bufferIndex = this->_emuDisplayInfo.bufferIndex;
|
||||
MacClientSharedObject *sharedViewObject = (MacClientSharedObject *)fetchObj.GetClientData();
|
||||
|
||||
pthread_rwlock_rdlock([sharedViewObject rwlockFramebufferAtIndex:bufferIndex]);
|
||||
}
|
||||
|
||||
void MacOGLDisplayPresenter::UnlockDisplayTextures()
|
||||
{
|
||||
const GPUClientFetchObject &fetchObj = this->GetFetchObject();
|
||||
const u8 bufferIndex = this->_emuDisplayInfo.bufferIndex;
|
||||
MacClientSharedObject *sharedViewObject = (MacClientSharedObject *)fetchObj.GetClientData();
|
||||
|
||||
pthread_rwlock_unlock([sharedViewObject rwlockFramebufferAtIndex:bufferIndex]);
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
|
||||
MacOGLDisplayView::MacOGLDisplayView()
|
||||
{
|
||||
__InstanceInit(nil);
|
||||
}
|
||||
|
||||
MacOGLDisplayView::MacOGLDisplayView(MacClientSharedObject *sharedObject)
|
||||
{
|
||||
__InstanceInit(sharedObject);
|
||||
}
|
||||
|
||||
MacOGLDisplayView::~MacOGLDisplayView()
|
||||
{
|
||||
[this->_caLayer release];
|
||||
}
|
||||
|
||||
void MacOGLDisplayView::__InstanceInit(MacClientSharedObject *sharedObject)
|
||||
{
|
||||
_allowViewUpdates = false;
|
||||
_spinlockViewNeedsFlush = OS_SPINLOCK_INIT;
|
||||
|
||||
MacOGLDisplayPresenter *newOpenGLPresenter = new MacOGLDisplayPresenter(sharedObject);
|
||||
_presenter = newOpenGLPresenter;
|
||||
|
||||
_caLayer = [[DisplayViewOpenGLLayer alloc] init];
|
||||
[_caLayer setClientDisplayView:this];
|
||||
}
|
||||
|
||||
bool MacOGLDisplayView::GetViewNeedsFlush()
|
||||
{
|
||||
OSSpinLockLock(&this->_spinlockViewNeedsFlush);
|
||||
|
@ -337,88 +458,9 @@ bool MacOGLDisplayView::GetViewNeedsFlush()
|
|||
return viewNeedsFlush;
|
||||
}
|
||||
|
||||
void MacOGLDisplayView::SetAllowViewFlushes(bool allowFlushes)
|
||||
void MacOGLDisplayView::SetViewNeedsFlush()
|
||||
{
|
||||
CGDirectDisplayID displayID = (CGDirectDisplayID)this->GetDisplayViewID();
|
||||
MacClientSharedObject *sharedData = this->GetSharedData();
|
||||
|
||||
if (![sharedData isDisplayLinkRunningUsingID:displayID])
|
||||
{
|
||||
[sharedData displayLinkStartUsingID:displayID];
|
||||
}
|
||||
}
|
||||
|
||||
void MacOGLDisplayView::LoadHUDFont()
|
||||
{
|
||||
CGLLockContext(this->_context);
|
||||
CGLSetCurrentContext(this->_context);
|
||||
this->OGLVideoOutput::LoadHUDFont();
|
||||
CGLUnlockContext(this->_context);
|
||||
}
|
||||
|
||||
void MacOGLDisplayView::SetUseVerticalSync(const bool useVerticalSync)
|
||||
{
|
||||
const GLint swapInt = (useVerticalSync) ? 1 : 0;
|
||||
|
||||
CGLLockContext(this->_context);
|
||||
CGLSetCurrentContext(this->_context);
|
||||
CGLSetParameter(this->_context, kCGLCPSwapInterval, &swapInt);
|
||||
this->OGLVideoOutput::SetUseVerticalSync(useVerticalSync);
|
||||
CGLUnlockContext(this->_context);
|
||||
}
|
||||
|
||||
void MacOGLDisplayView::SetScaleFactor(const double scaleFactor)
|
||||
{
|
||||
CGLLockContext(this->_context);
|
||||
CGLSetCurrentContext(this->_context);
|
||||
this->OGLVideoOutput::SetScaleFactor(scaleFactor);
|
||||
CGLUnlockContext(this->_context);
|
||||
}
|
||||
|
||||
void MacOGLDisplayView::SetFiltersPreferGPU(const bool preferGPU)
|
||||
{
|
||||
CGLLockContext(this->_context);
|
||||
CGLSetCurrentContext(this->_context);
|
||||
this->OGLVideoOutput::SetFiltersPreferGPU(preferGPU);
|
||||
CGLUnlockContext(this->_context);
|
||||
}
|
||||
|
||||
void MacOGLDisplayView::SetOutputFilter(const OutputFilterTypeID filterID)
|
||||
{
|
||||
CGLLockContext(this->_context);
|
||||
CGLSetCurrentContext(this->_context);
|
||||
this->OGLVideoOutput::SetOutputFilter(filterID);
|
||||
CGLUnlockContext(this->_context);
|
||||
}
|
||||
|
||||
void MacOGLDisplayView::SetPixelScaler(const VideoFilterTypeID filterID)
|
||||
{
|
||||
CGLLockContext(this->_context);
|
||||
CGLSetCurrentContext(this->_context);
|
||||
this->OGLVideoOutput::SetPixelScaler(filterID);
|
||||
CGLUnlockContext(this->_context);
|
||||
}
|
||||
|
||||
// NDS GPU Interface
|
||||
void MacOGLDisplayView::LoadDisplays()
|
||||
{
|
||||
CGLLockContext(this->_context);
|
||||
CGLSetCurrentContext(this->_context);
|
||||
this->OGLVideoOutput::LoadDisplays();
|
||||
CGLUnlockContext(this->_context);
|
||||
}
|
||||
|
||||
void MacOGLDisplayView::ProcessDisplays()
|
||||
{
|
||||
CGLLockContext(this->_context);
|
||||
CGLSetCurrentContext(this->_context);
|
||||
this->OGLVideoOutput::ProcessDisplays();
|
||||
CGLUnlockContext(this->_context);
|
||||
}
|
||||
|
||||
void MacOGLDisplayView::UpdateView()
|
||||
{
|
||||
if (!this->_allowViewUpdates || (this->GetNSView() == nil))
|
||||
if (!this->_allowViewUpdates || (this->_presenter == nil) || (this->GetNSView() == nil))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -439,49 +481,40 @@ void MacOGLDisplayView::UpdateView()
|
|||
}
|
||||
}
|
||||
|
||||
void MacOGLDisplayView::SetAllowViewFlushes(bool allowFlushes)
|
||||
{
|
||||
CGDirectDisplayID displayID = (CGDirectDisplayID)this->GetDisplayViewID();
|
||||
MacClientSharedObject *sharedData = ((MacOGLDisplayPresenter *)this->_presenter)->GetSharedData();
|
||||
|
||||
if (![sharedData isDisplayLinkRunningUsingID:displayID])
|
||||
{
|
||||
[sharedData displayLinkStartUsingID:displayID];
|
||||
}
|
||||
}
|
||||
|
||||
void MacOGLDisplayView::SetUseVerticalSync(const bool useVerticalSync)
|
||||
{
|
||||
CGLContextObj context = ((MacOGLDisplayPresenter *)this->_presenter)->GetContext();
|
||||
const GLint swapInt = (useVerticalSync) ? 1 : 0;
|
||||
|
||||
CGLLockContext(context);
|
||||
CGLSetCurrentContext(context);
|
||||
CGLSetParameter(context, kCGLCPSwapInterval, &swapInt);
|
||||
MacDisplayLayeredView::SetUseVerticalSync(useVerticalSync);
|
||||
CGLUnlockContext(context);
|
||||
}
|
||||
|
||||
void MacOGLDisplayView::FlushView()
|
||||
{
|
||||
OSSpinLockLock(&this->_spinlockViewNeedsFlush);
|
||||
this->_viewNeedsFlush = false;
|
||||
OSSpinLockUnlock(&this->_spinlockViewNeedsFlush);
|
||||
|
||||
CGLLockContext(this->_context);
|
||||
CGLSetCurrentContext(this->_context);
|
||||
this->RenderFrameOGL(false);
|
||||
CGLFlushDrawable(this->_context);
|
||||
CGLUnlockContext(this->_context);
|
||||
}
|
||||
|
||||
void MacOGLDisplayView::CopyFrameToBuffer(uint32_t *dstBuffer)
|
||||
{
|
||||
CGLLockContext(this->_context);
|
||||
CGLSetCurrentContext(this->_context);
|
||||
this->OGLVideoOutput::CopyFrameToBuffer(dstBuffer);
|
||||
CGLUnlockContext(this->_context);
|
||||
}
|
||||
|
||||
void MacOGLDisplayView::FinishFrameAtIndex(const uint8_t bufferIndex)
|
||||
{
|
||||
CGLLockContext(this->_context);
|
||||
CGLSetCurrentContext(this->_context);
|
||||
this->OGLVideoOutput::FinishFrameAtIndex(bufferIndex);
|
||||
CGLUnlockContext(this->_context);
|
||||
}
|
||||
|
||||
void MacOGLDisplayView::LockDisplayTextures()
|
||||
{
|
||||
const GPUClientFetchObject &fetchObj = this->GetFetchObject();
|
||||
const u8 bufferIndex = this->_emuDisplayInfo.bufferIndex;
|
||||
MacClientSharedObject *sharedViewObject = (MacClientSharedObject *)fetchObj.GetClientData();
|
||||
|
||||
pthread_rwlock_rdlock([sharedViewObject rwlockFramebufferAtIndex:bufferIndex]);
|
||||
}
|
||||
|
||||
void MacOGLDisplayView::UnlockDisplayTextures()
|
||||
{
|
||||
const GPUClientFetchObject &fetchObj = this->GetFetchObject();
|
||||
const u8 bufferIndex = this->_emuDisplayInfo.bufferIndex;
|
||||
MacClientSharedObject *sharedViewObject = (MacClientSharedObject *)fetchObj.GetClientData();
|
||||
|
||||
pthread_rwlock_unlock([sharedViewObject rwlockFramebufferAtIndex:bufferIndex]);
|
||||
CGLContextObj context = ((MacOGLDisplayPresenter *)this->_presenter)->GetContext();
|
||||
|
||||
CGLLockContext(context);
|
||||
CGLSetCurrentContext(context);
|
||||
((MacOGLDisplayPresenter *)this->_presenter)->RenderFrameOGL(false);
|
||||
CGLFlushDrawable(context);
|
||||
CGLUnlockContext(context);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,97 @@
|
|||
/*
|
||||
Copyright (C) 2017 DeSmuME team
|
||||
|
||||
This file is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This file is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with the this software. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _MAC_SCREENSHOTCAPTURETOOL_H_
|
||||
#define _MAC_SCREENSHOTCAPTURETOOL_H_
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
#include <string>
|
||||
#include "../ClientDisplayView.h"
|
||||
|
||||
#ifdef BOOL
|
||||
#undef BOOL
|
||||
#endif
|
||||
|
||||
@class MacClientSharedObject;
|
||||
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_5
|
||||
@interface MacScreenshotCaptureToolDelegate : NSObject <NSWindowDelegate>
|
||||
#else
|
||||
@interface MacScreenshotCaptureToolDelegate : NSObject
|
||||
#endif
|
||||
{
|
||||
NSWindow *window;
|
||||
|
||||
MacClientSharedObject *sharedData;
|
||||
|
||||
NSString *saveDirectoryPath;
|
||||
NSString *romName;
|
||||
NSBitmapFormat fileFormat;
|
||||
NSInteger displayMode;
|
||||
NSInteger displayLayout;
|
||||
NSInteger displayOrder;
|
||||
NSInteger displaySeparation;
|
||||
NSInteger displayRotation;
|
||||
BOOL useDeposterize;
|
||||
NSInteger outputFilterID;
|
||||
NSInteger pixelScalerID;
|
||||
}
|
||||
|
||||
@property (readonly) IBOutlet NSWindow *window;
|
||||
|
||||
@property (retain) MacClientSharedObject *sharedData;
|
||||
|
||||
@property (copy) NSString *saveDirectoryPath;
|
||||
@property (copy) NSString *romName;
|
||||
@property (assign) NSBitmapFormat fileFormat;
|
||||
@property (assign) NSInteger displayMode;
|
||||
@property (assign) NSInteger displayLayout;
|
||||
@property (assign) NSInteger displayOrder;
|
||||
@property (assign) NSInteger displaySeparation;
|
||||
@property (assign) NSInteger displayRotation;
|
||||
@property (assign) BOOL useDeposterize;
|
||||
@property (assign) NSInteger outputFilterID;
|
||||
@property (assign) NSInteger pixelScalerID;
|
||||
|
||||
- (IBAction) chooseDirectoryPath:(id)sender;
|
||||
- (IBAction) takeScreenshot:(id)sender;
|
||||
|
||||
- (void) chooseDirectoryPathDidEnd:(NSOpenPanel *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo;
|
||||
|
||||
- (void) readUserDefaults;
|
||||
- (void) writeUserDefaults;
|
||||
|
||||
@end
|
||||
|
||||
class MacScreenshotCaptureToolParams
|
||||
{
|
||||
public:
|
||||
MacClientSharedObject *sharedData;
|
||||
|
||||
NSBitmapImageFileType fileFormat;
|
||||
std::string savePath;
|
||||
std::string romName;
|
||||
bool useDeposterize;
|
||||
OutputFilterTypeID outputFilterID;
|
||||
VideoFilterTypeID pixelScalerID;
|
||||
ClientDisplayPresenterProperties cdpProperty;
|
||||
};
|
||||
|
||||
static void* RunFileWriteThread(void *arg);
|
||||
|
||||
#endif // _MAC_SCREENSHOTCAPTURETOOL_H_
|
|
@ -0,0 +1,346 @@
|
|||
/*
|
||||
Copyright (C) 2017 DeSmuME team
|
||||
|
||||
This file is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This file is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with the this software. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
#import "../cocoa_file.h"
|
||||
#import "../cocoa_GPU.h"
|
||||
#import "../cocoa_globals.h"
|
||||
#import "MacScreenshotCaptureTool.h"
|
||||
#import "MacOGLDisplayView.h"
|
||||
|
||||
#ifdef ENABLE_APPLE_METAL
|
||||
#include "MacMetalDisplayView.h"
|
||||
#endif
|
||||
|
||||
@implementation MacScreenshotCaptureToolDelegate
|
||||
|
||||
@synthesize window;
|
||||
@synthesize sharedData;
|
||||
@synthesize saveDirectoryPath;
|
||||
@synthesize romName;
|
||||
@synthesize fileFormat;
|
||||
@synthesize displayMode;
|
||||
@synthesize displayLayout;
|
||||
@synthesize displayOrder;
|
||||
@synthesize displaySeparation;
|
||||
@synthesize displayRotation;
|
||||
@synthesize useDeposterize;
|
||||
@synthesize outputFilterID;
|
||||
@synthesize pixelScalerID;
|
||||
|
||||
- (id)init
|
||||
{
|
||||
self = [super init];
|
||||
if(self == nil)
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
sharedData = nil;
|
||||
saveDirectoryPath = nil;
|
||||
romName = @"No_ROM_loaded";
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[self setSharedData:nil];
|
||||
[self setSaveDirectoryPath:nil];
|
||||
[self setRomName:nil];
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (IBAction) chooseDirectoryPath:(id)sender
|
||||
{
|
||||
NSOpenPanel *panel = [NSOpenPanel openPanel];
|
||||
[panel setCanCreateDirectories:YES];
|
||||
[panel setCanChooseDirectories:YES];
|
||||
[panel setCanChooseFiles:NO];
|
||||
[panel setResolvesAliases:YES];
|
||||
[panel setAllowsMultipleSelection:NO];
|
||||
[panel setTitle:NSSTRING_TITLE_SAVE_SCREENSHOT_PANEL];
|
||||
|
||||
#if MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_5
|
||||
[panel beginSheetModalForWindow:[self window]
|
||||
completionHandler:^(NSInteger result) {
|
||||
[self chooseDirectoryPathDidEnd:panel returnCode:result contextInfo:nil];
|
||||
} ];
|
||||
#else
|
||||
[panel beginSheetForDirectory:nil
|
||||
file:nil
|
||||
types:nil
|
||||
modalForWindow:[self window]
|
||||
modalDelegate:self
|
||||
didEndSelector:@selector(chooseDirectoryPathDidEnd:returnCode:contextInfo:)
|
||||
contextInfo:nil];
|
||||
#endif
|
||||
}
|
||||
|
||||
- (IBAction) takeScreenshot:(id)sender
|
||||
{
|
||||
NSString *savePath = [self saveDirectoryPath];
|
||||
|
||||
if ( (savePath != nil) && ([savePath length] > 0) )
|
||||
{
|
||||
savePath = [savePath stringByExpandingTildeInPath];
|
||||
}
|
||||
else
|
||||
{
|
||||
[self chooseDirectoryPath:self];
|
||||
}
|
||||
|
||||
NSFileManager *fileManager = [[NSFileManager alloc] init];
|
||||
BOOL isDirectoryFound = [fileManager createDirectoryAtPath:savePath withIntermediateDirectories:YES attributes:nil error:nil];
|
||||
[fileManager release];
|
||||
|
||||
if (!isDirectoryFound)
|
||||
{
|
||||
[self chooseDirectoryPath:self];
|
||||
|
||||
isDirectoryFound = [fileManager createDirectoryAtPath:savePath withIntermediateDirectories:YES attributes:nil error:nil];
|
||||
if (!isDirectoryFound)
|
||||
{
|
||||
// This was the last chance for the user to try to get a working writable directory.
|
||||
// If the directory is still invalid, then just bail.
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Note: We're allocating the parameter's memory block here, but we will be freeing it once we copy it in the detached thread.
|
||||
MacScreenshotCaptureToolParams *param = new MacScreenshotCaptureToolParams;
|
||||
param->sharedData = [self sharedData];
|
||||
param->fileFormat = (NSBitmapImageFileType)[self fileFormat];
|
||||
param->savePath = std::string([savePath cStringUsingEncoding:NSUTF8StringEncoding]);
|
||||
param->romName = std::string([romName cStringUsingEncoding:NSUTF8StringEncoding]);
|
||||
param->useDeposterize = [self useDeposterize] ? true : false;
|
||||
param->outputFilterID = (OutputFilterTypeID)[self outputFilterID];
|
||||
param->pixelScalerID = (VideoFilterTypeID)[self pixelScalerID];
|
||||
|
||||
param->cdpProperty.mode = (ClientDisplayMode)[self displayMode];
|
||||
param->cdpProperty.layout = (ClientDisplayLayout)[self displayLayout];
|
||||
param->cdpProperty.order = (ClientDisplayOrder)[self displayOrder];
|
||||
param->cdpProperty.gapScale = (float)[self displaySeparation] / 100.0f;
|
||||
param->cdpProperty.rotation = (float)[self displayRotation];
|
||||
|
||||
pthread_t fileWriteThread;
|
||||
pthread_attr_t fileWriteThreadAttr;
|
||||
|
||||
pthread_attr_init(&fileWriteThreadAttr);
|
||||
pthread_attr_setdetachstate(&fileWriteThreadAttr, PTHREAD_CREATE_DETACHED);
|
||||
pthread_create(&fileWriteThread, &fileWriteThreadAttr, &RunFileWriteThread, param);
|
||||
pthread_attr_destroy(&fileWriteThreadAttr);
|
||||
}
|
||||
|
||||
- (void) chooseDirectoryPathDidEnd:(NSOpenPanel *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo
|
||||
{
|
||||
[sheet orderOut:self];
|
||||
|
||||
if (returnCode == NSCancelButton)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
NSURL *selectedFileURL = [[sheet URLs] lastObject]; //hopefully also the first object
|
||||
if(selectedFileURL == nil)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
[self setSaveDirectoryPath:[selectedFileURL path]];
|
||||
}
|
||||
|
||||
- (void) readUserDefaults
|
||||
{
|
||||
[self setSaveDirectoryPath:[[NSUserDefaults standardUserDefaults] stringForKey:@"ScreenshotCaptureTool_DirectoryPath"]];
|
||||
[self setFileFormat:[[NSUserDefaults standardUserDefaults] integerForKey:@"ScreenshotCaptureTool_FileFormat"]];
|
||||
[self setUseDeposterize:[[NSUserDefaults standardUserDefaults] boolForKey:@"ScreenshotCaptureTool_Deposterize"]];
|
||||
[self setOutputFilterID:[[NSUserDefaults standardUserDefaults] integerForKey:@"ScreenshotCaptureTool_OutputFilter"]];
|
||||
[self setPixelScalerID:[[NSUserDefaults standardUserDefaults] integerForKey:@"ScreenshotCaptureTool_PixelScaler"]];
|
||||
[self setDisplayMode:[[NSUserDefaults standardUserDefaults] integerForKey:@"ScreenshotCaptureTool_DisplayMode"]];
|
||||
[self setDisplayLayout:[[NSUserDefaults standardUserDefaults] integerForKey:@"ScreenshotCaptureTool_DisplayLayout"]];
|
||||
[self setDisplayOrder:[[NSUserDefaults standardUserDefaults] integerForKey:@"ScreenshotCaptureTool_DisplayOrder"]];
|
||||
[self setDisplaySeparation:[[NSUserDefaults standardUserDefaults] integerForKey:@"ScreenshotCaptureTool_DisplaySeparation"]];
|
||||
[self setDisplayRotation:[[NSUserDefaults standardUserDefaults] integerForKey:@"ScreenshotCaptureTool_DisplayRotation"]];
|
||||
}
|
||||
|
||||
- (void) writeUserDefaults
|
||||
{
|
||||
[[NSUserDefaults standardUserDefaults] setObject:[self saveDirectoryPath] forKey:@"ScreenshotCaptureTool_DirectoryPath"];
|
||||
[[NSUserDefaults standardUserDefaults] setInteger:[self fileFormat] forKey:@"ScreenshotCaptureTool_FileFormat"];
|
||||
[[NSUserDefaults standardUserDefaults] setBool:[self useDeposterize] forKey:@"ScreenshotCaptureTool_Deposterize"];
|
||||
[[NSUserDefaults standardUserDefaults] setInteger:[self outputFilterID] forKey:@"ScreenshotCaptureTool_OutputFilter"];
|
||||
[[NSUserDefaults standardUserDefaults] setInteger:[self pixelScalerID] forKey:@"ScreenshotCaptureTool_PixelScaler"];
|
||||
[[NSUserDefaults standardUserDefaults] setInteger:[self displayMode] forKey:@"ScreenshotCaptureTool_DisplayMode"];
|
||||
[[NSUserDefaults standardUserDefaults] setInteger:[self displayLayout] forKey:@"ScreenshotCaptureTool_DisplayLayout"];
|
||||
[[NSUserDefaults standardUserDefaults] setInteger:[self displayOrder] forKey:@"ScreenshotCaptureTool_DisplayOrder"];
|
||||
[[NSUserDefaults standardUserDefaults] setInteger:[self displaySeparation] forKey:@"ScreenshotCaptureTool_DisplaySeparation"];
|
||||
[[NSUserDefaults standardUserDefaults] setInteger:[self displayRotation] forKey:@"ScreenshotCaptureTool_DisplayRotation"];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
static void* RunFileWriteThread(void *arg)
|
||||
{
|
||||
// Copy the rendering properties from the calling thread.
|
||||
MacScreenshotCaptureToolParams *inParams = (MacScreenshotCaptureToolParams *)arg;
|
||||
MacScreenshotCaptureToolParams param;
|
||||
|
||||
param.sharedData = inParams->sharedData;
|
||||
param.fileFormat = inParams->fileFormat;
|
||||
param.savePath = inParams->savePath;
|
||||
param.romName = inParams->romName;
|
||||
param.useDeposterize = inParams->useDeposterize;
|
||||
param.outputFilterID = inParams->outputFilterID;
|
||||
param.pixelScalerID = inParams->pixelScalerID;
|
||||
|
||||
param.cdpProperty.mode = inParams->cdpProperty.mode;
|
||||
param.cdpProperty.layout = inParams->cdpProperty.layout;
|
||||
param.cdpProperty.order = inParams->cdpProperty.order;
|
||||
param.cdpProperty.gapScale = inParams->cdpProperty.gapScale;
|
||||
param.cdpProperty.rotation = inParams->cdpProperty.rotation;
|
||||
|
||||
delete inParams;
|
||||
inParams = NULL;
|
||||
|
||||
// Do a few sanity checks before proceeding.
|
||||
if (param.sharedData == nil)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
GPUClientFetchObject *fetchObject = [param.sharedData GPUFetchObject];
|
||||
if (fetchObject == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const NDSDisplayInfo &displayInfo = fetchObject->GetFetchDisplayInfoForBufferIndex( fetchObject->GetLastFetchIndex() );
|
||||
|
||||
if ( (displayInfo.renderedWidth[NDSDisplayID_Main] == 0) || (displayInfo.renderedHeight[NDSDisplayID_Main] == 0) ||
|
||||
(displayInfo.renderedWidth[NDSDisplayID_Touch] == 0) || (displayInfo.renderedHeight[NDSDisplayID_Touch] == 0) )
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Set up the rendering properties.
|
||||
ClientDisplayPresenter::CalculateNormalSize(param.cdpProperty.mode, param.cdpProperty.layout, param.cdpProperty.gapScale, param.cdpProperty.normalWidth, param.cdpProperty.normalHeight);
|
||||
double transformedWidth = param.cdpProperty.normalWidth;
|
||||
double transformedHeight = param.cdpProperty.normalHeight;
|
||||
|
||||
param.cdpProperty.viewScale = (double)displayInfo.customWidth / (double)GPU_FRAMEBUFFER_NATIVE_WIDTH;
|
||||
ClientDisplayPresenter::ConvertNormalToTransformedBounds(param.cdpProperty.viewScale, param.cdpProperty.rotation, transformedWidth, transformedHeight);
|
||||
|
||||
param.cdpProperty.clientWidth = transformedWidth;
|
||||
param.cdpProperty.clientHeight = transformedHeight;
|
||||
param.cdpProperty.gapDistance = (double)DS_DISPLAY_UNSCALED_GAP * param.cdpProperty.gapScale;
|
||||
|
||||
// Render the frame to an NSBitmapImageRep.
|
||||
NSAutoreleasePool *autoreleasePool = [[NSAutoreleasePool alloc] init];
|
||||
|
||||
NSUInteger w = param.cdpProperty.clientWidth;
|
||||
NSUInteger h = param.cdpProperty.clientHeight;
|
||||
|
||||
NSBitmapImageRep *newImageRep = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL
|
||||
pixelsWide:w
|
||||
pixelsHigh:h
|
||||
bitsPerSample:8
|
||||
samplesPerPixel:4
|
||||
hasAlpha:YES
|
||||
isPlanar:NO
|
||||
colorSpaceName:NSCalibratedRGBColorSpace
|
||||
bytesPerRow:w * 4
|
||||
bitsPerPixel:32];
|
||||
if (newImageRep == nil)
|
||||
{
|
||||
[autoreleasePool release];
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ClientDisplay3DPresenter *cdp = NULL;
|
||||
bool filtersPreferGPU = true;
|
||||
|
||||
#ifdef ENABLE_APPLE_METAL
|
||||
if ([param.sharedData isKindOfClass:[MetalDisplayViewSharedData class]])
|
||||
{
|
||||
if ([(MetalDisplayViewSharedData *)param.sharedData device] == nil)
|
||||
{
|
||||
[newImageRep release];
|
||||
[autoreleasePool release];
|
||||
return NULL;
|
||||
}
|
||||
|
||||
cdp = new MacMetalDisplayPresenter(param.sharedData);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
cdp = new MacOGLDisplayPresenter(param.sharedData);
|
||||
filtersPreferGPU = false; // Just in case we're capturing the screenshot on an older GPU, perform the filtering on the CPU to avoid potential issues.
|
||||
}
|
||||
|
||||
cdp->Init();
|
||||
cdp->SetFiltersPreferGPU(filtersPreferGPU);
|
||||
cdp->SetHUDVisibility(false);
|
||||
cdp->CommitPresenterProperties(param.cdpProperty);
|
||||
cdp->SetupPresenterProperties();
|
||||
cdp->SetSourceDeposterize(param.useDeposterize);
|
||||
|
||||
if ( (cdp->GetViewScale() > 0.999) && (cdp->GetViewScale() < 1.001) )
|
||||
{
|
||||
// Special case stuff for when capturing the screenshot at the native resolution.
|
||||
if ( (param.cdpProperty.layout == ClientDisplayLayout_Vertical) || (param.cdpProperty.layout == ClientDisplayLayout_Horizontal) )
|
||||
{
|
||||
cdp->SetOutputFilter(OutputFilterTypeID_NearestNeighbor);
|
||||
}
|
||||
else
|
||||
{
|
||||
cdp->SetOutputFilter(param.outputFilterID);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// For custom-sized resolutions, apply all the filters as normal.
|
||||
cdp->SetPixelScaler(param.pixelScalerID);
|
||||
cdp->SetOutputFilter(param.outputFilterID);
|
||||
}
|
||||
|
||||
cdp->LoadDisplays();
|
||||
cdp->ProcessDisplays();
|
||||
cdp->UpdateLayout();
|
||||
cdp->CopyFrameToBuffer((uint32_t *)[newImageRep bitmapData]);
|
||||
|
||||
// Write the file.
|
||||
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
|
||||
[dateFormatter setDateFormat:@"yyyyMMdd_HH-mm-ss.SSS "];
|
||||
NSString *fileName = [[dateFormatter stringFromDate:[NSDate date]] stringByAppendingString:[NSString stringWithCString:param.romName.c_str() encoding:NSUTF8StringEncoding]];
|
||||
[dateFormatter release];
|
||||
|
||||
NSString *savePath = [NSString stringWithCString:param.savePath.c_str() encoding:NSUTF8StringEncoding];
|
||||
NSURL *fileURL = [NSURL fileURLWithPath:[savePath stringByAppendingPathComponent:fileName]];
|
||||
[CocoaDSFile saveScreenshot:fileURL bitmapData:newImageRep fileType:param.fileFormat];
|
||||
|
||||
// Clean up.
|
||||
delete cdp;
|
||||
|
||||
[newImageRep release];
|
||||
[autoreleasePool release];
|
||||
|
||||
return NULL;
|
||||
}
|
|
@ -19,9 +19,7 @@
|
|||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
@class InputPrefsView;
|
||||
@class InputManager;
|
||||
@class FileMigrationDelegate;
|
||||
@class RomInfoPanel;
|
||||
|
||||
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_5
|
||||
|
@ -34,21 +32,12 @@
|
|||
|
||||
NSObjectController *aboutWindowController;
|
||||
NSObjectController *emuControlController;
|
||||
NSObjectController *cdsSoundController;
|
||||
NSObjectController *romInfoPanelController;
|
||||
NSObjectController *prefWindowController;
|
||||
NSObjectController *cheatWindowController;
|
||||
NSObjectController *cdsCoreController;
|
||||
NSArrayController *inputDeviceListController;
|
||||
FileMigrationDelegate *migrationDelegate;
|
||||
InputManager *inputManager;
|
||||
RomInfoPanel *romInfoPanel;
|
||||
|
||||
NSWindow *prefWindow;
|
||||
NSWindow *troubleshootingWindow;
|
||||
NSWindow *cheatListWindow;
|
||||
NSWindow *slot2Window;
|
||||
NSView *prefGeneralView;
|
||||
InputPrefsView *inputPrefsView;
|
||||
|
||||
NSMenu *mLoadStateSlot;
|
||||
|
@ -62,23 +51,14 @@
|
|||
|
||||
@property (readonly) IBOutlet NSObjectController *aboutWindowController;
|
||||
@property (readonly) IBOutlet NSObjectController *emuControlController;
|
||||
@property (readonly) IBOutlet NSObjectController *cdsSoundController;
|
||||
@property (readonly) IBOutlet NSObjectController *romInfoPanelController;
|
||||
@property (readonly) IBOutlet NSObjectController *prefWindowController;
|
||||
@property (readonly) IBOutlet NSObjectController *cheatWindowController;
|
||||
@property (readonly) IBOutlet NSObjectController *cdsCoreController;
|
||||
@property (readonly) IBOutlet NSArrayController *inputDeviceListController;
|
||||
@property (readonly) IBOutlet FileMigrationDelegate *migrationDelegate;
|
||||
@property (readonly) IBOutlet InputManager *inputManager;
|
||||
@property (readonly) IBOutlet NSWindow *prefWindow;
|
||||
@property (readonly) IBOutlet NSWindow *troubleshootingWindow;
|
||||
@property (readonly) IBOutlet NSWindow *cheatListWindow;
|
||||
@property (readonly) IBOutlet NSWindow *slot2Window;
|
||||
@property (readonly) IBOutlet NSView *prefGeneralView;
|
||||
@property (readonly) IBOutlet NSMenu *mLoadStateSlot;
|
||||
@property (readonly) IBOutlet NSMenu *mSaveStateSlot;
|
||||
@property (readonly) IBOutlet InputPrefsView *inputPrefsView;
|
||||
@property (readonly) IBOutlet RomInfoPanel *romInfoPanel;
|
||||
|
||||
@property (assign) BOOL isAppRunningOnIntel;
|
||||
@property (assign) BOOL isDeveloperPlusBuild;
|
||||
|
@ -91,7 +71,5 @@
|
|||
- (void) setupSlotMenuItems;
|
||||
- (NSMenuItem *) addSlotMenuItem:(NSMenu *)menu slotNumber:(NSUInteger)slotNumber;
|
||||
- (void) setupUserDefaults;
|
||||
- (void) restoreDisplayWindowStates;
|
||||
- (void) saveDisplayWindowStates;
|
||||
|
||||
@end
|
||||
|
|
|
@ -20,8 +20,6 @@
|
|||
#import "DisplayWindowController.h"
|
||||
#import "EmuControllerDelegate.h"
|
||||
#import "FileMigrationDelegate.h"
|
||||
#import "RomInfoPanel.h"
|
||||
#import "Slot2WindowDelegate.h"
|
||||
#import "preferencesWindowDelegate.h"
|
||||
#import "troubleshootingWindowDelegate.h"
|
||||
#import "cheatWindowDelegate.h"
|
||||
|
@ -43,23 +41,14 @@
|
|||
@dynamic dummyObject;
|
||||
@synthesize prefWindow;
|
||||
@synthesize troubleshootingWindow;
|
||||
@synthesize cheatListWindow;
|
||||
@synthesize slot2Window;
|
||||
@synthesize prefGeneralView;
|
||||
@synthesize mLoadStateSlot;
|
||||
@synthesize mSaveStateSlot;
|
||||
@synthesize inputPrefsView;
|
||||
@synthesize aboutWindowController;
|
||||
@synthesize emuControlController;
|
||||
@synthesize cdsSoundController;
|
||||
@synthesize romInfoPanelController;
|
||||
@synthesize prefWindowController;
|
||||
@synthesize cdsCoreController;
|
||||
@synthesize inputDeviceListController;
|
||||
@synthesize cheatWindowController;
|
||||
@synthesize migrationDelegate;
|
||||
@synthesize inputManager;
|
||||
@synthesize romInfoPanel;
|
||||
|
||||
@synthesize isAppRunningOnIntel;
|
||||
@synthesize isDeveloperPlusBuild;
|
||||
|
@ -136,8 +125,6 @@
|
|||
|
||||
EmuControllerDelegate *emuControl = (EmuControllerDelegate *)[emuControlController content];
|
||||
PreferencesWindowDelegate *prefWindowDelegate = (PreferencesWindowDelegate *)[prefWindow delegate];
|
||||
CheatWindowDelegate *cheatWindowDelegate = (CheatWindowDelegate *)[cheatListWindow delegate];
|
||||
Slot2WindowDelegate *slot2WindowDelegate = (Slot2WindowDelegate *)[slot2Window delegate];
|
||||
|
||||
// Create the needed directories in Application Support if they haven't already
|
||||
// been created.
|
||||
|
@ -149,6 +136,14 @@
|
|||
|
||||
[CocoaDSFile setupAllFilePaths];
|
||||
|
||||
// On macOS v10.13 and later, some unwanted menu items will show up in the View menu.
|
||||
// Disable automatic window tabbing for all NSWindows in order to rid ourselves of
|
||||
// these unwanted menu items.
|
||||
if ([[NSWindow class] respondsToSelector:@selector(setAllowsAutomaticWindowTabbing:)])
|
||||
{
|
||||
[NSWindow setAllowsAutomaticWindowTabbing:NO];
|
||||
}
|
||||
|
||||
// Setup the About window.
|
||||
NSString *descriptionStr = [[[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleName"] stringByAppendingString:@" "] stringByAppendingString:[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"]];
|
||||
descriptionStr = [[descriptionStr stringByAppendingString:@"\n"] stringByAppendingString:@STRING_DESMUME_SHORT_DESCRIPTION];
|
||||
|
@ -193,16 +188,11 @@
|
|||
[newCore addOutput:newSpeaker];
|
||||
[emuControl setCdsSpeaker:newSpeaker];
|
||||
|
||||
// Update the SLOT-2 device list after the emulation core is initialized.
|
||||
[slot2WindowDelegate update];
|
||||
[slot2WindowDelegate setHidManager:[inputManager hidManager]];
|
||||
[slot2WindowDelegate setAutoSelectedDeviceText:[[slot2WindowDelegate deviceManager] autoSelectedDeviceName]];
|
||||
|
||||
// Set up all the object controllers.
|
||||
[cdsCoreController setContent:newCore];
|
||||
[romInfoPanelController setContent:[CocoaDSRom romNotLoadedBindings]];
|
||||
[prefWindowController setContent:[prefWindowDelegate bindings]];
|
||||
[cheatWindowController setContent:[cheatWindowDelegate bindings]];
|
||||
|
||||
[emuControl appInit];
|
||||
}
|
||||
|
||||
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
|
||||
|
@ -241,7 +231,7 @@
|
|||
|
||||
// Bring the application to the front
|
||||
[NSApp activateIgnoringOtherApps:YES];
|
||||
[self restoreDisplayWindowStates];
|
||||
[emuControl restoreDisplayWindowStates];
|
||||
|
||||
// Load a new ROM on launch per user preferences.
|
||||
if ([[NSUserDefaults standardUserDefaults] objectForKey:@"General_AutoloadROMOnLaunch"] != nil)
|
||||
|
@ -337,8 +327,9 @@
|
|||
CocoaDSCore *cdsCore = (CocoaDSCore *)[cdsCoreController content];
|
||||
|
||||
// Save some settings to user defaults before app termination
|
||||
[self saveDisplayWindowStates];
|
||||
[romInfoPanel writeDefaults];
|
||||
[emuControl saveDisplayWindowStates];
|
||||
[emuControl writeUserDefaults];
|
||||
|
||||
[[NSUserDefaults standardUserDefaults] setBool:[[cdsCore cdsController] hardwareMicMute] forKey:@"Microphone_HardwareMicMute"];
|
||||
[[NSUserDefaults standardUserDefaults] setDouble:[emuControl currentVolumeValue] forKey:@"Sound_Volume"];
|
||||
[[NSUserDefaults standardUserDefaults] setDouble:[emuControl lastSetSpeedScalar] forKey:@"CoreControl_SpeedScalar"];
|
||||
|
@ -428,7 +419,6 @@
|
|||
{
|
||||
EmuControllerDelegate *emuControl = (EmuControllerDelegate *)[emuControlController content];
|
||||
PreferencesWindowDelegate *prefWindowDelegate = [prefWindow delegate];
|
||||
Slot2WindowDelegate *slot2WindowDelegate = (Slot2WindowDelegate *)[slot2Window delegate];
|
||||
CocoaDSCore *cdsCore = (CocoaDSCore *)[cdsCoreController content];
|
||||
|
||||
// Set the emulation flags.
|
||||
|
@ -520,244 +510,11 @@
|
|||
[cdsCore setGdbStubPortARM7:0];
|
||||
#endif
|
||||
|
||||
// Set up the user's default input settings.
|
||||
NSDictionary *userMappings = [[NSUserDefaults standardUserDefaults] dictionaryForKey:@"Input_ControllerMappings"];
|
||||
if (userMappings == nil)
|
||||
{
|
||||
NSDictionary *defaultKeyMappingsDict = [NSDictionary dictionaryWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"DefaultKeyMappings" ofType:@"plist"]];
|
||||
NSArray *internalDefaultProfilesList = (NSArray *)[defaultKeyMappingsDict valueForKey:@"DefaultInputProfiles"];
|
||||
userMappings = [(NSDictionary *)[internalDefaultProfilesList objectAtIndex:0] valueForKey:@"Mappings"];
|
||||
}
|
||||
|
||||
[inputManager setMappingsWithMappings:userMappings];
|
||||
[[inputManager hidManager] setDeviceListController:inputDeviceListController];
|
||||
|
||||
// Set up the ROM Info panel.
|
||||
[romInfoPanel setupUserDefaults];
|
||||
// Set up the rest of the emulation-related user defaults.
|
||||
[emuControl readUserDefaults];
|
||||
|
||||
// Set up the preferences window.
|
||||
[prefWindowDelegate setupUserDefaults];
|
||||
|
||||
// Set up the default SLOT-2 device.
|
||||
[slot2WindowDelegate setupUserDefaults];
|
||||
|
||||
// Set up the rest of the emulation-related user defaults.
|
||||
[emuControl setupUserDefaults];
|
||||
}
|
||||
|
||||
- (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 = ([windowProperties objectForKey:@"displayMode"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"displayMode"] integerValue] : [[NSUserDefaults standardUserDefaults] integerForKey:@"DisplayView_Mode"];
|
||||
const double displayScale = ([windowProperties objectForKey:@"displayScale"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"displayScale"] doubleValue] : ([[NSUserDefaults standardUserDefaults] doubleForKey:@"DisplayView_Size"] / 100.0);
|
||||
const double displayRotation = ([windowProperties objectForKey:@"displayRotation"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"displayRotation"] doubleValue] : [[NSUserDefaults standardUserDefaults] doubleForKey:@"DisplayView_Rotation"];
|
||||
const NSInteger displayOrientation = ([windowProperties objectForKey:@"displayOrientation"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"displayOrientation"] integerValue] : [[NSUserDefaults standardUserDefaults] integerForKey:@"DisplayViewCombo_Orientation"];
|
||||
const NSInteger displayOrder = ([windowProperties objectForKey:@"displayOrder"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"displayOrder"] integerValue] : [[NSUserDefaults standardUserDefaults] integerForKey:@"DisplayViewCombo_Order"];
|
||||
const double displayGap = ([windowProperties objectForKey:@"displayGap"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"displayGap"] doubleValue] : ([[NSUserDefaults standardUserDefaults] doubleForKey:@"DisplayViewCombo_Gap"] / 100.0);
|
||||
|
||||
const NSInteger displayMainSource = ([windowProperties objectForKey:@"displayMainVideoSource"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"displayMainVideoSource"] integerValue] : [[NSUserDefaults standardUserDefaults] integerForKey:@"DisplayView_DisplayMainVideoSource"];
|
||||
const NSInteger displayTouchSource = ([windowProperties objectForKey:@"displayTouchVideoSource"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"displayTouchVideoSource"] integerValue] : [[NSUserDefaults standardUserDefaults] integerForKey:@"DisplayView_DisplayTouchVideoSource"];
|
||||
|
||||
const BOOL videoFiltersPreferGPU = ([windowProperties objectForKey:@"videoFiltersPreferGPU"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"videoFiltersPreferGPU"] boolValue] : [[NSUserDefaults standardUserDefaults] boolForKey:@"DisplayView_FiltersPreferGPU"];
|
||||
const BOOL videoSourceDeposterize = ([windowProperties objectForKey:@"videoSourceDeposterize"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"videoSourceDeposterize"] boolValue] : [[NSUserDefaults standardUserDefaults] boolForKey:@"DisplayView_Deposterize"];
|
||||
const NSInteger videoPixelScaler = ([windowProperties objectForKey:@"videoFilterType"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"videoFilterType"] integerValue] : [[NSUserDefaults standardUserDefaults] integerForKey:@"DisplayView_VideoFilter"];
|
||||
const NSInteger videoOutputFilter = ([windowProperties objectForKey:@"videoOutputFilter"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"videoOutputFilter"] integerValue] : [[NSUserDefaults standardUserDefaults] integerForKey:@"DisplayView_OutputFilter"];
|
||||
|
||||
const BOOL hudEnable = ([windowProperties objectForKey:@"hudEnable"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"hudEnable"] boolValue] : [[NSUserDefaults standardUserDefaults] boolForKey:@"DisplayView_EnableHUD"];
|
||||
const BOOL hudShowVideoFPS = ([windowProperties objectForKey:@"hudShowVideoFPS"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"hudShowVideoFPS"] boolValue] : [[NSUserDefaults standardUserDefaults] boolForKey:@"HUD_ShowVideoFPS"];
|
||||
const BOOL hudShowRender3DFPS = ([windowProperties objectForKey:@"hudShowRender3DFPS"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"hudShowRender3DFPS"] boolValue] : [[NSUserDefaults standardUserDefaults] boolForKey:@"HUD_ShowRender3DFPS"];
|
||||
const BOOL hudShowFrameIndex = ([windowProperties objectForKey:@"hudShowFrameIndex"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"hudShowFrameIndex"] boolValue] : [[NSUserDefaults standardUserDefaults] boolForKey:@"HUD_ShowFrameIndex"];
|
||||
const BOOL hudShowLagFrameCount = ([windowProperties objectForKey:@"hudShowLagFrameCount"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"hudShowLagFrameCount"] boolValue] : [[NSUserDefaults standardUserDefaults] boolForKey:@"HUD_ShowLagFrameCount"];
|
||||
const BOOL hudShowCPULoadAverage = ([windowProperties objectForKey:@"hudShowCPULoadAverage"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"hudShowCPULoadAverage"] boolValue] : [[NSUserDefaults standardUserDefaults] boolForKey:@"HUD_ShowCPULoadAverage"];
|
||||
const BOOL hudShowRTC = ([windowProperties objectForKey:@"hudShowRTC"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"hudShowRTC"] boolValue] : [[NSUserDefaults standardUserDefaults] boolForKey:@"HUD_ShowRTC"];
|
||||
const BOOL hudShowInput = ([windowProperties objectForKey:@"hudShowInput"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"hudShowInput"] boolValue] : [[NSUserDefaults standardUserDefaults] boolForKey:@"HUD_ShowInput"];
|
||||
|
||||
const NSUInteger hudColorVideoFPS = ([windowProperties objectForKey:@"hudColorVideoFPS"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"hudColorVideoFPS"] unsignedIntegerValue] : [[NSUserDefaults standardUserDefaults] integerForKey:@"HUD_Color_VideoFPS"];
|
||||
const NSUInteger hudColorRender3DFPS = ([windowProperties objectForKey:@"hudColorRender3DFPS"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"hudColorRender3DFPS"] unsignedIntegerValue] : [[NSUserDefaults standardUserDefaults] integerForKey:@"HUD_Color_Render3DFPS"];
|
||||
const NSUInteger hudColorFrameIndex = ([windowProperties objectForKey:@"hudColorFrameIndex"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"hudColorFrameIndex"] unsignedIntegerValue] : [[NSUserDefaults standardUserDefaults] integerForKey:@"HUD_Color_FrameIndex"];
|
||||
const NSUInteger hudColorLagFrameCount = ([windowProperties objectForKey:@"hudColorLagFrameCount"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"hudColorLagFrameCount"] unsignedIntegerValue] : [[NSUserDefaults standardUserDefaults] integerForKey:@"HUD_Color_LagFrameCount"];
|
||||
const NSUInteger hudColorCPULoadAverage = ([windowProperties objectForKey:@"hudColorCPULoadAverage"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"hudColorCPULoadAverage"] unsignedIntegerValue] : [[NSUserDefaults standardUserDefaults] integerForKey:@"HUD_Color_CPULoadAverage"];
|
||||
const NSUInteger hudColorRTC = ([windowProperties objectForKey:@"hudColorRTC"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"hudColorRTC"] unsignedIntegerValue] : [[NSUserDefaults standardUserDefaults] integerForKey:@"HUD_Color_RTC"];
|
||||
const NSUInteger hudColorInputPendingAndApplied = ([windowProperties objectForKey:@"hudColorInputPendingAndApplied"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"hudColorInputPendingAndApplied"] unsignedIntegerValue] : [[NSUserDefaults standardUserDefaults] integerForKey:@"HUD_Color_Input_PendingAndApplied"];
|
||||
const NSUInteger hudColorInputAppliedOnly = ([windowProperties objectForKey:@"hudColorInputAppliedOnly"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"hudColorInputAppliedOnly"] unsignedIntegerValue] : [[NSUserDefaults standardUserDefaults] integerForKey:@"HUD_Color_Input_AppliedOnly"];
|
||||
const NSUInteger hudColorInputPendingOnly = ([windowProperties objectForKey:@"hudColorInputPendingOnly"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"hudColorInputPendingOnly"] unsignedIntegerValue] : [[NSUserDefaults standardUserDefaults] integerForKey:@"HUD_Color_Input_PendingOnly"];
|
||||
|
||||
const NSInteger screenshotFileFormat = ([windowProperties objectForKey:@"screenshotFileFormat"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"screenshotFileFormat"] integerValue] : NSTIFFFileType;
|
||||
const BOOL useVerticalSync = ([windowProperties objectForKey:@"useVerticalSync"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"useVerticalSync"] boolValue] : YES;
|
||||
const BOOL isMinSizeNormal = ([windowProperties objectForKey:@"isMinSizeNormal"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"isMinSizeNormal"] boolValue] : YES;
|
||||
const BOOL isShowingStatusBar = ([windowProperties objectForKey:@"isShowingStatusBar"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"isShowingStatusBar"] boolValue] : [[NSUserDefaults standardUserDefaults] boolForKey:@"DisplayView_ShowStatusBar"];
|
||||
const BOOL isInFullScreenMode = ([windowProperties objectForKey:@"isInFullScreenMode"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"isInFullScreenMode"] boolValue] : NO;
|
||||
const NSUInteger screenIndex = ([windowProperties objectForKey:@"screenIndex"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"screenIndex"] unsignedIntegerValue] : 0;
|
||||
NSString *windowFrameStr = (NSString *)[windowProperties valueForKey:@"windowFrame"];
|
||||
|
||||
int frameX = 0;
|
||||
int frameY = 0;
|
||||
int frameWidth = 256;
|
||||
int frameHeight = 192*2;
|
||||
const char *frameCStr = [windowFrameStr cStringUsingEncoding:NSUTF8StringEncoding];
|
||||
sscanf(frameCStr, "%i %i %i %i", &frameX, &frameY, &frameWidth, &frameHeight);
|
||||
|
||||
// Force the window to load now so that we can overwrite its internal defaults with the user's defaults.
|
||||
[windowController window];
|
||||
|
||||
[windowController setDisplayMode:(ClientDisplayMode)displayMode
|
||||
viewScale:displayScale
|
||||
rotation:displayRotation
|
||||
layout:(ClientDisplayLayout)displayOrientation
|
||||
order:(ClientDisplayOrder)displayOrder
|
||||
gapScale:displayGap
|
||||
isMinSizeNormal:isMinSizeNormal
|
||||
isShowingStatusBar:isShowingStatusBar];
|
||||
|
||||
[[windowController view] setDisplayMainVideoSource:displayMainSource];
|
||||
[[windowController view] setDisplayTouchVideoSource:displayTouchSource];
|
||||
|
||||
[windowController setVideoPropertiesWithoutUpdateUsingPreferGPU:videoFiltersPreferGPU
|
||||
sourceDeposterize:videoSourceDeposterize
|
||||
outputFilter:videoOutputFilter
|
||||
pixelScaler:videoPixelScaler];
|
||||
|
||||
[windowController setScreenshotFileFormat:screenshotFileFormat];
|
||||
[[windowController view] setUseVerticalSync:useVerticalSync];
|
||||
[[windowController view] setIsHUDVisible:hudEnable];
|
||||
[[windowController view] setIsHUDVideoFPSVisible:hudShowVideoFPS];
|
||||
[[windowController view] setIsHUDRender3DFPSVisible:hudShowRender3DFPS];
|
||||
[[windowController view] setIsHUDFrameIndexVisible:hudShowFrameIndex];
|
||||
[[windowController view] setIsHUDLagFrameCountVisible:hudShowLagFrameCount];
|
||||
[[windowController view] setIsHUDCPULoadAverageVisible:hudShowCPULoadAverage];
|
||||
[[windowController view] setIsHUDRealTimeClockVisible:hudShowRTC];
|
||||
[[windowController view] setIsHUDInputVisible:hudShowInput];
|
||||
|
||||
[[windowController view] setHudColorVideoFPS:[CocoaDSUtil NSColorFromRGBA8888:(uint32_t)hudColorVideoFPS]];
|
||||
[[windowController view] setHudColorRender3DFPS:[CocoaDSUtil NSColorFromRGBA8888:(uint32_t)hudColorRender3DFPS]];
|
||||
[[windowController view] setHudColorFrameIndex:[CocoaDSUtil NSColorFromRGBA8888:(uint32_t)hudColorFrameIndex]];
|
||||
[[windowController view] setHudColorLagFrameCount:[CocoaDSUtil NSColorFromRGBA8888:(uint32_t)hudColorLagFrameCount]];
|
||||
[[windowController view] setHudColorCPULoadAverage:[CocoaDSUtil NSColorFromRGBA8888:(uint32_t)hudColorCPULoadAverage]];
|
||||
[[windowController view] setHudColorRTC:[CocoaDSUtil NSColorFromRGBA8888:(uint32_t)hudColorRTC]];
|
||||
[[windowController view] setHudColorInputPendingAndApplied:[CocoaDSUtil NSColorFromRGBA8888:(uint32_t)hudColorInputPendingAndApplied]];
|
||||
[[windowController view] setHudColorInputAppliedOnly:[CocoaDSUtil NSColorFromRGBA8888:(uint32_t)hudColorInputAppliedOnly]];
|
||||
[[windowController view] setHudColorInputPendingOnly:[CocoaDSUtil NSColorFromRGBA8888:(uint32_t)hudColorInputPendingOnly]];
|
||||
|
||||
[[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.
|
||||
[[windowController view] setAllowViewUpdates:YES];
|
||||
[[[windowController view] cdsVideoOutput] handleReloadReprocessRedraw];
|
||||
|
||||
if (windowProperties == [windowPropertiesList lastObject])
|
||||
{
|
||||
[[windowController window] makeKeyAndOrderFront:self];
|
||||
[[windowController window] makeMainWindow];
|
||||
}
|
||||
else
|
||||
{
|
||||
[[windowController window] orderFront:self];
|
||||
}
|
||||
|
||||
// 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 toggleFullScreenDisplay:self];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (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 NSUInteger screenIndex = [[NSScreen screens] indexOfObject:[[windowController masterWindow] screen]];
|
||||
|
||||
const NSRect windowFrame = [windowController masterWindowFrame];
|
||||
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 masterWindowScale]], @"displayScale",
|
||||
[NSNumber numberWithDouble:[windowController displayRotation]], @"displayRotation",
|
||||
[NSNumber numberWithInteger:[[windowController view] displayMainVideoSource]], @"displayMainVideoSource",
|
||||
[NSNumber numberWithInteger:[[windowController view] displayTouchVideoSource]], @"displayTouchVideoSource",
|
||||
[NSNumber numberWithInteger:[windowController displayOrientation]], @"displayOrientation",
|
||||
[NSNumber numberWithInteger:[windowController displayOrder]], @"displayOrder",
|
||||
[NSNumber numberWithDouble:[windowController displayGap]], @"displayGap",
|
||||
[NSNumber numberWithBool:[[windowController view] videoFiltersPreferGPU]], @"videoFiltersPreferGPU",
|
||||
[NSNumber numberWithInteger:[[windowController view] pixelScaler]], @"videoFilterType",
|
||||
[NSNumber numberWithInteger:[windowController screenshotFileFormat]], @"screenshotFileFormat",
|
||||
[NSNumber numberWithInteger:[[windowController view] outputFilter]], @"videoOutputFilter",
|
||||
[NSNumber numberWithBool:[[windowController view] sourceDeposterize]], @"videoSourceDeposterize",
|
||||
[NSNumber numberWithBool:[[windowController view] useVerticalSync]], @"useVerticalSync",
|
||||
[NSNumber numberWithBool:[[windowController view] isHUDVisible]], @"hudEnable",
|
||||
[NSNumber numberWithBool:[[windowController view] isHUDVideoFPSVisible]], @"hudShowVideoFPS",
|
||||
[NSNumber numberWithBool:[[windowController view] isHUDRender3DFPSVisible]], @"hudShowRender3DFPS",
|
||||
[NSNumber numberWithBool:[[windowController view] isHUDFrameIndexVisible]], @"hudShowFrameIndex",
|
||||
[NSNumber numberWithBool:[[windowController view] isHUDLagFrameCountVisible]], @"hudShowLagFrameCount",
|
||||
[NSNumber numberWithBool:[[windowController view] isHUDCPULoadAverageVisible]], @"hudShowCPULoadAverage",
|
||||
[NSNumber numberWithBool:[[windowController view] isHUDRealTimeClockVisible]], @"hudShowRTC",
|
||||
[NSNumber numberWithBool:[[windowController view] isHUDInputVisible]], @"hudShowInput",
|
||||
[NSNumber numberWithUnsignedInteger:[CocoaDSUtil RGBA8888FromNSColor:[[windowController view] hudColorVideoFPS]]], @"hudColorVideoFPS",
|
||||
[NSNumber numberWithUnsignedInteger:[CocoaDSUtil RGBA8888FromNSColor:[[windowController view] hudColorRender3DFPS]]], @"hudColorRender3DFPS",
|
||||
[NSNumber numberWithUnsignedInteger:[CocoaDSUtil RGBA8888FromNSColor:[[windowController view] hudColorFrameIndex]]], @"hudColorFrameIndex",
|
||||
[NSNumber numberWithUnsignedInteger:[CocoaDSUtil RGBA8888FromNSColor:[[windowController view] hudColorLagFrameCount]]], @"hudColorLagFrameCount",
|
||||
[NSNumber numberWithUnsignedInteger:[CocoaDSUtil RGBA8888FromNSColor:[[windowController view] hudColorCPULoadAverage]]], @"hudColorCPULoadAverage",
|
||||
[NSNumber numberWithUnsignedInteger:[CocoaDSUtil RGBA8888FromNSColor:[[windowController view] hudColorRTC]]], @"hudColorRTC",
|
||||
[NSNumber numberWithUnsignedInteger:[CocoaDSUtil RGBA8888FromNSColor:[[windowController view] hudColorInputPendingAndApplied]]], @"hudColorInputPendingAndApplied",
|
||||
[NSNumber numberWithUnsignedInteger:[CocoaDSUtil RGBA8888FromNSColor:[[windowController view] hudColorInputAppliedOnly]]], @"hudColorInputAppliedOnly",
|
||||
[NSNumber numberWithUnsignedInteger:[CocoaDSUtil RGBA8888FromNSColor:[[windowController view] hudColorInputPendingOnly]]], @"hudColorInputPendingOnly",
|
||||
[NSNumber numberWithBool:[windowController isMinSizeNormal]], @"isMinSizeNormal",
|
||||
[NSNumber numberWithBool:[windowController masterStatusBarState]], @"isShowingStatusBar",
|
||||
[NSNumber numberWithBool:[windowController isFullScreen]], @"isInFullScreenMode",
|
||||
[NSNumber numberWithUnsignedInteger:screenIndex], @"screenIndex",
|
||||
windowFrameStr, @"windowFrame",
|
||||
nil];
|
||||
|
||||
// TODO: Show HUD Input.
|
||||
//[NSNumber numberWithBool:[[windowController view] isHUDInputVisible]], @"hudShowInput",
|
||||
|
||||
[windowPropertiesList addObject:windowProperties];
|
||||
}
|
||||
|
||||
[[NSUserDefaults standardUserDefaults] setObject:windowPropertiesList forKey:@"General_DisplayWindowRestorableStates"];
|
||||
}
|
||||
else
|
||||
{
|
||||
[[NSUserDefaults standardUserDefaults] removeObjectForKey:@"General_DisplayWindowRestorableStates"];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
Loading…
Reference in New Issue