Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 18 additions & 10 deletions fusepb/FuseX.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

/* Begin PBXBuildFile section */
576F061291E1888735FB9D38 /* FuseQLPreview.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = 2395678A67FCB7B7DAFF9A83 /* FuseQLPreview.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
70561DA4F03E4F3DA5B85553 /* MetalKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EAA54F20E902456BACB24998 /* MetalKit.framework */; };
B2D0915DE32D43E89E59E3EF /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8287F6EDEBAC4FFA8708CC4E /* Metal.framework */; };
B6013812164692F5005FD3AE /* Fuse.iconset in Resources */ = {isa = PBXBuildFile; fileRef = B6013811164692F5005FD3AE /* Fuse.iconset */; };
B61159BF0EEE99D50029FEA3 /* Graphics_Filter.png in Resources */ = {isa = PBXBuildFile; fileRef = B61159BE0EEE99D50029FEA3 /* Graphics_Filter.png */; };
B61159C10EEE99E20029FEA3 /* Machine.png in Resources */ = {isa = PBXBuildFile; fileRef = B61159C00EEE99E20029FEA3 /* Machine.png */; };
Expand Down Expand Up @@ -195,7 +197,6 @@
B6A6F0DA0B3D141B000B88E9 /* cocoaui.m in Sources */ = {isa = PBXBuildFile; fileRef = B6A6F0D90B3D141B000B88E9 /* cocoaui.m */; };
B6A6F0EE0B3D5F9E000B88E9 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B6A6F0ED0B3D5F9E000B88E9 /* CoreAudio.framework */; };
B6A6F0F30B3D602F000B88E9 /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B6A6F0F20B3D602F000B88E9 /* AudioUnit.framework */; };
B6A6F1060B3D60D0000B88E9 /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F520C8BC038D022E01A804BA /* OpenGL.framework */; };
B6A6F10E0B3D6360000B88E9 /* cocoaerror.m in Sources */ = {isa = PBXBuildFile; fileRef = B6A6F10D0B3D6360000B88E9 /* cocoaerror.m */; };
B6A6F1200B3EA737000B88E9 /* cocoascreenshot.m in Sources */ = {isa = PBXBuildFile; fileRef = B6A6F11E0B3EA737000B88E9 /* cocoascreenshot.m */; };
B6B076B30B59FE9A00D4F95C /* Emulator.m in Sources */ = {isa = PBXBuildFile; fileRef = B6B076B10B59FE9A00D4F95C /* Emulator.m */; };
Expand Down Expand Up @@ -288,6 +289,7 @@
B6F66E351E473D68005B270A /* memory_pages.c in Sources */ = {isa = PBXBuildFile; fileRef = B6F66E331E473D68005B270A /* memory_pages.c */; };
B6FA759D0C1D7507007F5A10 /* audiofile.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B6FA759C0C1D7507007F5A10 /* audiofile.framework */; };
B6FA75C60C1D76A5007F5A10 /* audiofile.framework in Copy Files */ = {isa = PBXBuildFile; fileRef = B6FA759C0C1D7507007F5A10 /* audiofile.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
CC2086963F8A491084EEBE3B /* DisplayShaders.metal in Sources */ = {isa = PBXBuildFile; fileRef = 2BDC12F02C4E48F98494D156 /* DisplayShaders.metal */; };
D12E7FF3292596B200185E4D /* AppSandboxFileAccess.m in Sources */ = {isa = PBXBuildFile; fileRef = D12E7FED292596B100185E4D /* AppSandboxFileAccess.m */; };
D12E7FF4292596B200185E4D /* AppSandboxFileAccessOpenSavePanelDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = D12E7FEE292596B100185E4D /* AppSandboxFileAccessOpenSavePanelDelegate.m */; };
D12E7FF5292596B200185E4D /* AppSandboxFileAccessPersist.m in Sources */ = {isa = PBXBuildFile; fileRef = D12E7FF2292596B200185E4D /* AppSandboxFileAccessPersist.m */; };
Expand Down Expand Up @@ -445,6 +447,8 @@
2395678A67FCB7B7DAFF9A83 /* FuseQLPreview.appex */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = "wrapper.app-extension"; name = FuseQLPreview.appex; path = ../3rdparty/FuseGenerator/build/Deployment/FuseQLPreview.appex; sourceTree = "<group>"; };
29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; };
29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; };
2BDC12F02C4E48F98494D156 /* DisplayShaders.metal */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.metal; path = DisplayShaders.metal; sourceTree = "<group>"; };
8287F6EDEBAC4FFA8708CC4E /* Metal.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Metal.framework; path = /System/Library/Frameworks/Metal.framework; sourceTree = "<absolute>"; };
9651D9A4AA56B244FA98440C /* FuseQLThumbnail.appex */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = "wrapper.app-extension"; name = FuseQLThumbnail.appex; path = ../3rdparty/FuseGenerator/build/Deployment/FuseQLThumbnail.appex; sourceTree = "<group>"; };
B6013811164692F5005FD3AE /* Fuse.iconset */ = {isa = PBXFileReference; lastKnownFileType = folder.iconset; name = Fuse.iconset; path = ../Fuse.iconset; sourceTree = "<group>"; };
B6018479065A586900B0BE59 /* zxatasp.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = zxatasp.c; sourceTree = "<group>"; };
Expand Down Expand Up @@ -810,7 +814,7 @@
D1DF6DD726F8077F004A4AB7 /* debug.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = debug.png; sourceTree = "<group>"; };
D1ECC73C2924069800147252 /* ttx2000s.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ttx2000s.h; sourceTree = "<group>"; };
D1ECC73D2924069800147252 /* ttx2000s.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ttx2000s.c; sourceTree = "<group>"; };
F520C8BC038D022E01A804BA /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = /System/Library/Frameworks/OpenGL.framework; sourceTree = "<absolute>"; };
EAA54F20E902456BACB24998 /* MetalKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MetalKit.framework; path = /System/Library/Frameworks/MetalKit.framework; sourceTree = "<absolute>"; };
F536B56503A0C275011517A0 /* utils.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = utils.c; path = ../utils.c; sourceTree = SOURCE_ROOT; };
F541FB5E03B0B33401FF8235 /* scaler.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = scaler.h; path = ../ui/scaler/scaler.h; sourceTree = SOURCE_ROOT; };
F54670EB03A3F3E70143EC2C /* settings.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = settings.m; sourceTree = SOURCE_ROOT; };
Expand Down Expand Up @@ -953,7 +957,8 @@
B6A6F0EE0B3D5F9E000B88E9 /* CoreAudio.framework in Frameworks */,
B6A6F0F30B3D602F000B88E9 /* AudioUnit.framework in Frameworks */,
FE9913050000000000000005 /* AudioToolbox.framework in Frameworks */,
B6A6F1060B3D60D0000B88E9 /* OpenGL.framework in Frameworks */,
B2D0915DE32D43E89E59E3EF /* Metal.framework in Frameworks */,
70561DA4F03E4F3DA5B85553 /* MetalKit.framework in Frameworks */,
B653532B0B902CB20083F942 /* IOKit.framework in Frameworks */,
B6251C3E0C2EB24500BD5543 /* QuartzCore.framework in Frameworks */,
);
Expand Down Expand Up @@ -1007,7 +1012,6 @@
B6A6F0ED0B3D5F9E000B88E9 /* CoreAudio.framework */,
29B97325FDCFA39411CA2CEA /* Foundation.framework */,
B653532A0B902CB20083F942 /* IOKit.framework */,
F520C8BC038D022E01A804BA /* OpenGL.framework */,
B6251C3D0C2EB24500BD5543 /* QuartzCore.framework */,
);
name = "Other Frameworks";
Expand Down Expand Up @@ -1084,6 +1088,8 @@
isa = PBXGroup;
children = (
FED24DE22EE108360013DD32 /* Security.framework */,
8287F6EDEBAC4FFA8708CC4E /* Metal.framework */,
EAA54F20E902456BACB24998 /* MetalKit.framework */,
1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */,
1058C7A2FEA54F0111CA2CBB /* Other Frameworks */,
);
Expand Down Expand Up @@ -1451,6 +1457,7 @@
B6CADD560C47AD90004BA954 /* Texture.m */,
B6CE7FCB0B28FBD600EB65B3 /* DisplayOpenGLView.h */,
B6CE7FCC0B28FBD600EB65B3 /* DisplayOpenGLView.m */,
2BDC12F02C4E48F98494D156 /* DisplayShaders.metal */,
);
name = Views;
path = views;
Expand Down Expand Up @@ -2145,6 +2152,7 @@
B6403FD80A7E4B1A00E00B11 /* loader.c in Sources */,
B6CE7F420B2830A300EB65B3 /* cocoajoystick.c in Sources */,
B6CE7FCE0B28FBD600EB65B3 /* DisplayOpenGLView.m in Sources */,
CC2086963F8A491084EEBE3B /* DisplayShaders.metal in Sources */,
B6E0252C0B38AFE500E23A0F /* keysyms.m in Sources */,
B6A6F0960B3C108C000B88E9 /* coreaudiosound.c in Sources */,
B6A6F0DA0B3D141B000B88E9 /* cocoaui.m in Sources */,
Expand Down Expand Up @@ -2514,7 +2522,7 @@
GCC_WARN_SHADOW = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
LLVM_LTO = YES;
MACOSX_DEPLOYMENT_TARGET = 10.13;
MACOSX_DEPLOYMENT_TARGET = 14.0;
ONLY_ACTIVE_ARCH = YES;
PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = NO;
RUN_CLANG_STATIC_ANALYZER = YES;
Expand Down Expand Up @@ -2542,7 +2550,7 @@
GCC_WARN_SHADOW = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
LLVM_LTO = YES;
MACOSX_DEPLOYMENT_TARGET = 10.13;
MACOSX_DEPLOYMENT_TARGET = 14.0;
PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = NO;
RUN_CLANG_STATIC_ANALYZER = YES;
SDKROOT = macosx;
Expand All @@ -2567,7 +2575,7 @@
GCC_WARN_SHADOW = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
LLVM_LTO = YES;
MACOSX_DEPLOYMENT_TARGET = 10.13;
MACOSX_DEPLOYMENT_TARGET = 14.0;
PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = NO;
RUN_CLANG_STATIC_ANALYZER = YES;
SDKROOT = macosx;
Expand Down Expand Up @@ -2624,7 +2632,7 @@
GCC_WARN_UNUSED_VARIABLE = YES;
INFOPLIST_FILE = FuseHelp/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Bundles";
MACOSX_DEPLOYMENT_TARGET = 10.13;
MACOSX_DEPLOYMENT_TARGET = 14.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
PRODUCT_BUNDLE_IDENTIFIER = "net.sourceforge.projects.fuse-for-macosx.FuseHelp";
Expand Down Expand Up @@ -2677,7 +2685,7 @@
GCC_WARN_UNUSED_VARIABLE = YES;
INFOPLIST_FILE = FuseHelp/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Bundles";
MACOSX_DEPLOYMENT_TARGET = 10.13;
MACOSX_DEPLOYMENT_TARGET = 14.0;
MTL_ENABLE_DEBUG_INFO = NO;
PRODUCT_BUNDLE_IDENTIFIER = "net.sourceforge.projects.fuse-for-macosx.FuseHelp";
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down Expand Up @@ -2729,7 +2737,7 @@
GCC_WARN_UNUSED_VARIABLE = YES;
INFOPLIST_FILE = FuseHelp/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Bundles";
MACOSX_DEPLOYMENT_TARGET = 10.13;
MACOSX_DEPLOYMENT_TARGET = 14.0;
MTL_ENABLE_DEBUG_INFO = NO;
PRODUCT_BUNDLE_IDENTIFIER = "net.sourceforge.projects.fuse-for-macosx.FuseHelp";
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down
40 changes: 18 additions & 22 deletions fusepb/views/DisplayOpenGLView.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,9 @@
*/

#import <Cocoa/Cocoa.h>
#import <MetalKit/MetalKit.h>
#import <QuartzCore/QuartzCore.h>

#include <OpenGL/gl.h>
#include <OpenGL/glext.h>
#include <OpenGL/glu.h>

#include <libspectrum.h>

#include "input.h"
Expand All @@ -41,11 +38,13 @@
@class Emulator;
@class Texture;

@interface DisplayOpenGLView : NSOpenGLView
@interface DisplayOpenGLView : MTKView <MTKViewDelegate>
{
/* Two backing textures */
/* Two CPU-side screen buffers; the dirty machinery in
-uploadDirtyToTexture keeps both consistent across frames. */
Cocoa_Texture screenTex[MAX_SCREEN_BUFFERS];
GLuint screenTexId[MAX_SCREEN_BUFFERS];
/* Matching MTLTextures uploaded to the GPU. */
id<MTLTexture> screenTexMTL[MAX_SCREEN_BUFFERS];
int currentScreenTex;

Texture *redCassette;
Expand All @@ -60,7 +59,6 @@
ui_statusbar_state disk_state;
ui_statusbar_state mdr_state;
ui_statusbar_state tape_state;
BOOL statusbar_updated;

NSLock *view_lock;

Expand All @@ -70,18 +68,25 @@
Emulator *proxy_emulator;
NSConnection *kitConnection;

CVDisplayLinkRef displayLink;
CGDirectDisplayID mainViewDisplayID;
BOOL displayLinkRunning;
BOOL isResizing;
/* Metal rendering state. */
id<MTLDevice> mtlDevice;
id<MTLCommandQueue> commandQueue;
id<MTLRenderPipelineState> pipelineState;
/* Reusable CPU-side staging buffer for the BGR5A1 -> BGRA8 conversion
done at upload time. Sized to a full screen on first use. */
uint32_t *conversionBuffer;
size_t conversionBufferPixels;

/* Frame pacing is driven by MTKView's built-in CADisplayLink, which
calls -drawInMTKView: each vsync. -displayLinkStart / -displayLinkStop
toggle self.paused (always on the main thread). */
}
+(DisplayOpenGLView *) instance;

-(IBAction) zoom:(id)sender;

-(void) createTexture:(Cocoa_Texture*)newScreen;
-(void) destroyTexture;
-(void) blitIcon:(Texture*)iconTexture;

-(void) setServer:(id)anObject;
-(id) initWithFrame:(NSRect)frameRect;
Expand All @@ -96,8 +101,6 @@
xOrigin:(int) x
yOrigin:(int) y;

-(void) setNeedsDisplayYes;

-(void) openFile:(const char *)filename;
-(void) snapOpen:(const char *)filename;
-(void) tapeOpen:(const char *)filename;
Expand Down Expand Up @@ -226,21 +229,14 @@

-(BOOL) isFlipped;

-(void) copyGLtoQuartz;
-(void) windowWillMiniaturize:(NSNotification *)aNotification;
-(void) windowDidMiniaturize:(NSNotification *)notification;
-(BOOL) windowShouldClose:(id)window;
-(void) windowDidResignKey:(NSNotification *)notification;

-(CVReturn) displayFrame:(const CVTimeStamp *)timeStamp;
-(void) windowChangedScreen:(NSNotification*)inNotification;
-(void) windowDidDeminiaturize:(NSNotification *)inNotification;

-(void) displayLinkStop;
-(void) displayLinkStart;

-(void) doReshape;

@end

/* Helper category used by every utility controller in §Affected Windows
Expand Down
Loading
Loading