From ef79bbde537d6b9c745a7d86cb9df1d04c35590d Mon Sep 17 00:00:00 2001 From: PCSX* teams Date: Tue, 16 Nov 2010 14:15:22 +0200 Subject: pcsxr-1.9.92 --- macosx/plugins/DFXVideo/English.lproj/Credits.rtf | 13 + .../DFXVideo/English.lproj/InfoPlist.strings | Bin 0 -> 518 bytes .../NetSfPeopsSoftGPUConfig.nib/classes.nib | 26 + .../NetSfPeopsSoftGPUConfig.nib/info.nib | 16 + .../NetSfPeopsSoftGPUConfig.nib/keyedobjects.nib | Bin 0 -> 15019 bytes macosx/plugins/DFXVideo/Info.plist | 20 + .../NetSfPeopsSoftGPUInterface.nib/classes.nib | 22 + .../NetSfPeopsSoftGPUInterface.nib/info.nib | 16 + .../keyedobjects.nib | Bin 0 -> 2247 bytes .../PeopsSoftGPU.xcodeproj/project.pbxproj | 416 +++++++++++++ macosx/plugins/DFXVideo/macsrc/ExtendedKeys.h | 23 + .../DFXVideo/macsrc/PluginConfigController.h | 26 + .../DFXVideo/macsrc/PluginConfigController.m | 216 +++++++ macosx/plugins/DFXVideo/macsrc/PluginGLView.h | 63 ++ macosx/plugins/DFXVideo/macsrc/PluginGLView.m | 692 +++++++++++++++++++++ macosx/plugins/DFXVideo/macsrc/PluginWindow.h | 24 + macosx/plugins/DFXVideo/macsrc/PluginWindow.m | 46 ++ .../DFXVideo/macsrc/PluginWindowController.h | 41 ++ .../DFXVideo/macsrc/PluginWindowController.m | 227 +++++++ macosx/plugins/DFXVideo/macsrc/drawgl.m | 181 ++++++ 20 files changed, 2068 insertions(+) create mode 100644 macosx/plugins/DFXVideo/English.lproj/Credits.rtf create mode 100644 macosx/plugins/DFXVideo/English.lproj/InfoPlist.strings create mode 100644 macosx/plugins/DFXVideo/English.lproj/NetSfPeopsSoftGPUConfig.nib/classes.nib create mode 100644 macosx/plugins/DFXVideo/English.lproj/NetSfPeopsSoftGPUConfig.nib/info.nib create mode 100644 macosx/plugins/DFXVideo/English.lproj/NetSfPeopsSoftGPUConfig.nib/keyedobjects.nib create mode 100644 macosx/plugins/DFXVideo/Info.plist create mode 100644 macosx/plugins/DFXVideo/NetSfPeopsSoftGPUInterface.nib/classes.nib create mode 100644 macosx/plugins/DFXVideo/NetSfPeopsSoftGPUInterface.nib/info.nib create mode 100644 macosx/plugins/DFXVideo/NetSfPeopsSoftGPUInterface.nib/keyedobjects.nib create mode 100644 macosx/plugins/DFXVideo/PeopsSoftGPU.xcodeproj/project.pbxproj create mode 100644 macosx/plugins/DFXVideo/macsrc/ExtendedKeys.h create mode 100644 macosx/plugins/DFXVideo/macsrc/PluginConfigController.h create mode 100644 macosx/plugins/DFXVideo/macsrc/PluginConfigController.m create mode 100644 macosx/plugins/DFXVideo/macsrc/PluginGLView.h create mode 100644 macosx/plugins/DFXVideo/macsrc/PluginGLView.m create mode 100644 macosx/plugins/DFXVideo/macsrc/PluginWindow.h create mode 100644 macosx/plugins/DFXVideo/macsrc/PluginWindow.m create mode 100644 macosx/plugins/DFXVideo/macsrc/PluginWindowController.h create mode 100644 macosx/plugins/DFXVideo/macsrc/PluginWindowController.m create mode 100644 macosx/plugins/DFXVideo/macsrc/drawgl.m (limited to 'macosx/plugins/DFXVideo') diff --git a/macosx/plugins/DFXVideo/English.lproj/Credits.rtf b/macosx/plugins/DFXVideo/English.lproj/Credits.rtf new file mode 100644 index 0000000..f49ff39 --- /dev/null +++ b/macosx/plugins/DFXVideo/English.lproj/Credits.rtf @@ -0,0 +1,13 @@ +{\rtf1\mac\ansicpg10000\cocoartf102 +{\fonttbl\f0\fswiss\fcharset77 Helvetica-Bold;\f1\fswiss\fcharset77 Helvetica;} +{\colortbl;\red255\green255\blue255;} +\pard\tx565\tx1133\tx1700\tx2266\tx2833\tx3401\tx3967\tx4535\tx5102\tx5669\tx6235\tx6802\ql\qnatural + +\f0\b\fs24 \cf0 Created By +\f1\b0 \ + Pete Bernert and the P.E.Op.S. team\ +\ + +\f0\b Macintosh Port By +\f1\b0 \ + Gil Pedersen} \ No newline at end of file diff --git a/macosx/plugins/DFXVideo/English.lproj/InfoPlist.strings b/macosx/plugins/DFXVideo/English.lproj/InfoPlist.strings new file mode 100644 index 0000000..df4dfcb Binary files /dev/null and b/macosx/plugins/DFXVideo/English.lproj/InfoPlist.strings differ diff --git a/macosx/plugins/DFXVideo/English.lproj/NetSfPeopsSoftGPUConfig.nib/classes.nib b/macosx/plugins/DFXVideo/English.lproj/NetSfPeopsSoftGPUConfig.nib/classes.nib new file mode 100644 index 0000000..b94b3c4 --- /dev/null +++ b/macosx/plugins/DFXVideo/English.lproj/NetSfPeopsSoftGPUConfig.nib/classes.nib @@ -0,0 +1,26 @@ +{ + IBClasses = ( + { + ACTIONS = {"" = id; }; + CLASS = FirstResponder; + LANGUAGE = ObjC; + SUPERCLASS = NSObject; + }, + { + ACTIONS = {cancel = id; hackToggle = id; ok = id; reset = id; }; + CLASS = NetSfPeopsSoftGPUPluginConfigController; + LANGUAGE = ObjC; + OUTLETS = { + autoFullScreen = NSControl; + ditherMode = NSPopUpButton; + fpsCounter = NSControl; + frameSkipping = NSControl; + hackEnable = NSControl; + hacksView = NSView; + vSync = NSControl; + }; + SUPERCLASS = NSWindowController; + } + ); + IBVersion = 1; +} \ No newline at end of file diff --git a/macosx/plugins/DFXVideo/English.lproj/NetSfPeopsSoftGPUConfig.nib/info.nib b/macosx/plugins/DFXVideo/English.lproj/NetSfPeopsSoftGPUConfig.nib/info.nib new file mode 100644 index 0000000..8dfe3d1 --- /dev/null +++ b/macosx/plugins/DFXVideo/English.lproj/NetSfPeopsSoftGPUConfig.nib/info.nib @@ -0,0 +1,16 @@ + + + + + IBDocumentLocation + 19 23 561 249 0 0 1024 746 + IBFramework Version + 446.1 + IBOpenObjects + + 5 + + IBSystem Version + 8P2137 + + diff --git a/macosx/plugins/DFXVideo/English.lproj/NetSfPeopsSoftGPUConfig.nib/keyedobjects.nib b/macosx/plugins/DFXVideo/English.lproj/NetSfPeopsSoftGPUConfig.nib/keyedobjects.nib new file mode 100644 index 0000000..2125a2b Binary files /dev/null and b/macosx/plugins/DFXVideo/English.lproj/NetSfPeopsSoftGPUConfig.nib/keyedobjects.nib differ diff --git a/macosx/plugins/DFXVideo/Info.plist b/macosx/plugins/DFXVideo/Info.plist new file mode 100644 index 0000000..8113024 --- /dev/null +++ b/macosx/plugins/DFXVideo/Info.plist @@ -0,0 +1,20 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + PeopsSoftGL + CFBundleIdentifier + net.sf.peops.SoftGpuGLPlugin + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + PsxP + CFBundleSignature + PSGl + CFBundleVersion + 1.16 + + diff --git a/macosx/plugins/DFXVideo/NetSfPeopsSoftGPUInterface.nib/classes.nib b/macosx/plugins/DFXVideo/NetSfPeopsSoftGPUInterface.nib/classes.nib new file mode 100644 index 0000000..78bbc4f --- /dev/null +++ b/macosx/plugins/DFXVideo/NetSfPeopsSoftGPUInterface.nib/classes.nib @@ -0,0 +1,22 @@ +{ + IBClasses = ( + {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, + { + CLASS = NetSfPeopsSoftGPUPluginGLView; + LANGUAGE = ObjC; + SUPERCLASS = NSOpenGLView; + }, + { + CLASS = NetSfPeopsSoftGPUPluginWindow; + LANGUAGE = ObjC; + SUPERCLASS = NSWindow; + }, + { + CLASS = NetSfPeopsSoftGPUPluginWindowController; + LANGUAGE = ObjC; + OUTLETS = {glView = NSOpenGLView; }; + SUPERCLASS = NSWindowController; + } + ); + IBVersion = 1; +} \ No newline at end of file diff --git a/macosx/plugins/DFXVideo/NetSfPeopsSoftGPUInterface.nib/info.nib b/macosx/plugins/DFXVideo/NetSfPeopsSoftGPUInterface.nib/info.nib new file mode 100644 index 0000000..f4ba252 --- /dev/null +++ b/macosx/plugins/DFXVideo/NetSfPeopsSoftGPUInterface.nib/info.nib @@ -0,0 +1,16 @@ + + + + + IBDocumentLocation + 99 26 409 240 0 0 1024 746 + IBFramework Version + 364.0 + IBOpenObjects + + 5 + + IBSystem Version + 7S215 + + diff --git a/macosx/plugins/DFXVideo/NetSfPeopsSoftGPUInterface.nib/keyedobjects.nib b/macosx/plugins/DFXVideo/NetSfPeopsSoftGPUInterface.nib/keyedobjects.nib new file mode 100644 index 0000000..fb88d8d Binary files /dev/null and b/macosx/plugins/DFXVideo/NetSfPeopsSoftGPUInterface.nib/keyedobjects.nib differ diff --git a/macosx/plugins/DFXVideo/PeopsSoftGPU.xcodeproj/project.pbxproj b/macosx/plugins/DFXVideo/PeopsSoftGPU.xcodeproj/project.pbxproj new file mode 100644 index 0000000..9657f8c --- /dev/null +++ b/macosx/plugins/DFXVideo/PeopsSoftGPU.xcodeproj/project.pbxproj @@ -0,0 +1,416 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 42; + objects = { + +/* Begin PBXBuildFile section */ + 2B038C07069183300082466B /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 2B038C05069183300082466B /* InfoPlist.strings */; }; + 2B038D2306918AA80082466B /* Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 2B038D2206918AA80082466B /* Info.plist */; }; + 2B143C79078A0C6700AF745A /* PluginWindow.h in Headers */ = {isa = PBXBuildFile; fileRef = 2B957EAE0635DFE400543905 /* PluginWindow.h */; }; + 2B57868206BE7B3700BBA288 /* ExtendedKeys.h in Headers */ = {isa = PBXBuildFile; fileRef = 2B57868106BE7B3700BBA288 /* ExtendedKeys.h */; }; + 2B957EB10635DFE400543905 /* PluginWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = 2B957EAF0635DFE400543905 /* PluginWindow.m */; }; + 2B959DC106342C22000F2A2D /* drawgl.m in Sources */ = {isa = PBXBuildFile; fileRef = 2B3E5D64062B2CC1001D796E /* drawgl.m */; }; + 2B959DC406342C23000F2A2D /* PluginGLView.h in Headers */ = {isa = PBXBuildFile; fileRef = 2BAF4FC90632967A00DB9A16 /* PluginGLView.h */; }; + 2B959DCD06342C24000F2A2D /* PluginGLView.m in Sources */ = {isa = PBXBuildFile; fileRef = 2BAF4FCA0632967A00DB9A16 /* PluginGLView.m */; }; + 2B959DD006342C25000F2A2D /* PluginWindowController.h in Headers */ = {isa = PBXBuildFile; fileRef = 2B3E5DF0062B36FB001D796E /* PluginWindowController.h */; }; + 2B959DD506342C25000F2A2D /* PluginWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2B3E5DF1062B36FB001D796E /* PluginWindowController.m */; }; + 2B959DE106342C31000F2A2D /* NetSfPeopsSoftGPUInterface.nib in Resources */ = {isa = PBXBuildFile; fileRef = 2B3E5DED062B36A0001D796E /* NetSfPeopsSoftGPUInterface.nib */; }; + 2B959E4406342D32000F2A2D /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2B959E4306342D32000F2A2D /* OpenGL.framework */; }; + 2BB260A80777462E00F6854C /* PluginConfigController.h in Headers */ = {isa = PBXBuildFile; fileRef = 2BB260A60777462E00F6854C /* PluginConfigController.h */; }; + 2BB260A90777462E00F6854C /* PluginConfigController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2BB260A70777462E00F6854C /* PluginConfigController.m */; }; + 2BD2E769077AF53E00657C69 /* Credits.rtf in Resources */ = {isa = PBXBuildFile; fileRef = 2BD2E767077AF53E00657C69 /* Credits.rtf */; }; + 2BD2E829077AFC2C00657C69 /* NetSfPeopsSoftGPUConfig.nib in Resources */ = {isa = PBXBuildFile; fileRef = 2BD2E828077AFC2C00657C69 /* NetSfPeopsSoftGPUConfig.nib */; }; + 2BD7C777076E1FAB000F05ED /* GLUT.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2B51949E06B3D2D200744730 /* GLUT.framework */; }; + 71E9EC06109F24E700E98D1D /* fps.c in Sources */ = {isa = PBXBuildFile; fileRef = 71E9EBF4109F24E600E98D1D /* fps.c */; }; + 71E9EC08109F24E700E98D1D /* gpu.c in Sources */ = {isa = PBXBuildFile; fileRef = 71E9EBF6109F24E600E98D1D /* gpu.c */; }; + 71E9EC0B109F24E700E98D1D /* key.c in Sources */ = {isa = PBXBuildFile; fileRef = 71E9EBF9109F24E600E98D1D /* key.c */; }; + 71E9EC0D109F24E700E98D1D /* menu.c in Sources */ = {isa = PBXBuildFile; fileRef = 71E9EBFB109F24E600E98D1D /* menu.c */; }; + 71E9EC0F109F24E700E98D1D /* prim.c in Sources */ = {isa = PBXBuildFile; fileRef = 71E9EBFD109F24E700E98D1D /* prim.c */; }; + 71E9EC11109F24E700E98D1D /* soft.c in Sources */ = {isa = PBXBuildFile; fileRef = 71E9EBFF109F24E700E98D1D /* soft.c */; }; + 71E9EC14109F24E700E98D1D /* zn.c in Sources */ = {isa = PBXBuildFile; fileRef = 71E9EC02109F24E700E98D1D /* zn.c */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 2B038C06069183300082466B /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = ""; }; + 2B038D2206918AA80082466B /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = Info.plist; sourceTree = ""; }; + 2B371FBB0773859200B1DC0B /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/NetSfPeopsSoftGPUConfig.nib; sourceTree = ""; }; + 2B3E5D64062B2CC1001D796E /* drawgl.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = drawgl.m; path = macsrc/drawgl.m; sourceTree = SOURCE_ROOT; }; + 2B3E5DED062B36A0001D796E /* NetSfPeopsSoftGPUInterface.nib */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; path = NetSfPeopsSoftGPUInterface.nib; sourceTree = ""; }; + 2B3E5DF0062B36FB001D796E /* PluginWindowController.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = PluginWindowController.h; path = macsrc/PluginWindowController.h; sourceTree = SOURCE_ROOT; }; + 2B3E5DF1062B36FB001D796E /* PluginWindowController.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = PluginWindowController.m; path = macsrc/PluginWindowController.m; sourceTree = SOURCE_ROOT; }; + 2B51949E06B3D2D200744730 /* GLUT.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GLUT.framework; path = /System/Library/Frameworks/GLUT.framework; sourceTree = ""; }; + 2B57868106BE7B3700BBA288 /* ExtendedKeys.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = ExtendedKeys.h; path = macsrc/ExtendedKeys.h; sourceTree = SOURCE_ROOT; }; + 2B957EAE0635DFE400543905 /* PluginWindow.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = PluginWindow.h; path = macsrc/PluginWindow.h; sourceTree = SOURCE_ROOT; }; + 2B957EAF0635DFE400543905 /* PluginWindow.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = PluginWindow.m; path = macsrc/PluginWindow.m; sourceTree = SOURCE_ROOT; }; + 2B959E4306342D32000F2A2D /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = /System/Library/Frameworks/OpenGL.framework; sourceTree = ""; }; + 2BAF4FC90632967A00DB9A16 /* PluginGLView.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = PluginGLView.h; path = macsrc/PluginGLView.h; sourceTree = SOURCE_ROOT; }; + 2BAF4FCA0632967A00DB9A16 /* PluginGLView.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = PluginGLView.m; path = macsrc/PluginGLView.m; sourceTree = SOURCE_ROOT; }; + 2BAF50930632BB1A00DB9A16 /* PeopsSoftGL.psxplugin */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = PeopsSoftGL.psxplugin; sourceTree = BUILT_PRODUCTS_DIR; }; + 2BB260A60777462E00F6854C /* PluginConfigController.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = PluginConfigController.h; path = macsrc/PluginConfigController.h; sourceTree = SOURCE_ROOT; }; + 2BB260A70777462E00F6854C /* PluginConfigController.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = PluginConfigController.m; path = macsrc/PluginConfigController.m; sourceTree = SOURCE_ROOT; }; + 2BD2E768077AF53E00657C69 /* English */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = English; path = English.lproj/Credits.rtf; sourceTree = ""; }; + 71E9EBF1109F24E600E98D1D /* cfg.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = cfg.h; path = ../../../plugins/dfxvideo/cfg.h; sourceTree = SOURCE_ROOT; }; + 71E9EBF2109F24E600E98D1D /* draw.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = draw.h; path = ../../../plugins/dfxvideo/draw.h; sourceTree = SOURCE_ROOT; }; + 71E9EBF3109F24E600E98D1D /* externals.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = externals.h; path = ../../../plugins/dfxvideo/externals.h; sourceTree = SOURCE_ROOT; }; + 71E9EBF4109F24E600E98D1D /* fps.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = fps.c; path = ../../../plugins/dfxvideo/fps.c; sourceTree = SOURCE_ROOT; }; + 71E9EBF5109F24E600E98D1D /* fps.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = fps.h; path = ../../../plugins/dfxvideo/fps.h; sourceTree = SOURCE_ROOT; }; + 71E9EBF6109F24E600E98D1D /* gpu.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = gpu.c; path = ../../../plugins/dfxvideo/gpu.c; sourceTree = SOURCE_ROOT; }; + 71E9EBF7109F24E600E98D1D /* gpu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = gpu.h; path = ../../../plugins/dfxvideo/gpu.h; sourceTree = SOURCE_ROOT; }; + 71E9EBF8109F24E600E98D1D /* interp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = interp.h; path = ../../../plugins/dfxvideo/interp.h; sourceTree = SOURCE_ROOT; }; + 71E9EBF9109F24E600E98D1D /* key.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = key.c; path = ../../../plugins/dfxvideo/key.c; sourceTree = SOURCE_ROOT; }; + 71E9EBFA109F24E600E98D1D /* key.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = key.h; path = ../../../plugins/dfxvideo/key.h; sourceTree = SOURCE_ROOT; }; + 71E9EBFB109F24E600E98D1D /* menu.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = menu.c; path = ../../../plugins/dfxvideo/menu.c; sourceTree = SOURCE_ROOT; }; + 71E9EBFC109F24E700E98D1D /* menu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = menu.h; path = ../../../plugins/dfxvideo/menu.h; sourceTree = SOURCE_ROOT; }; + 71E9EBFD109F24E700E98D1D /* prim.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = prim.c; path = ../../../plugins/dfxvideo/prim.c; sourceTree = SOURCE_ROOT; }; + 71E9EBFE109F24E700E98D1D /* prim.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = prim.h; path = ../../../plugins/dfxvideo/prim.h; sourceTree = SOURCE_ROOT; }; + 71E9EBFF109F24E700E98D1D /* soft.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = soft.c; path = ../../../plugins/dfxvideo/soft.c; sourceTree = SOURCE_ROOT; }; + 71E9EC00109F24E700E98D1D /* soft.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = soft.h; path = ../../../plugins/dfxvideo/soft.h; sourceTree = SOURCE_ROOT; }; + 71E9EC01109F24E700E98D1D /* swap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = swap.h; path = ../../../plugins/dfxvideo/swap.h; sourceTree = SOURCE_ROOT; }; + 71E9EC02109F24E700E98D1D /* zn.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zn.c; path = ../../../plugins/dfxvideo/zn.c; sourceTree = SOURCE_ROOT; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 2BAF50910632BB1A00DB9A16 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 2B959E4406342D32000F2A2D /* OpenGL.framework in Frameworks */, + 2BD7C777076E1FAB000F05ED /* GLUT.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 2B3E59FF062AAC1A001D796E = { + isa = PBXGroup; + children = ( + 71E9EBF0109F24B600E98D1D /* src */, + 2BD2E2F40779F50B00657C69 /* macsrc */, + 2BD2E818077AFB9F00657C69 /* English.lproj */, + 2B3E5DED062B36A0001D796E /* NetSfPeopsSoftGPUInterface.nib */, + 2B038D2206918AA80082466B /* Info.plist */, + 2B3E5A0B062AAC34001D796E /* Frameworks */, + 2B3E5A46062AACF3001D796E /* Products */, + ); + sourceTree = ""; + }; + 2B3E5A0B062AAC34001D796E /* Frameworks */ = { + isa = PBXGroup; + children = ( + 2B959E4306342D32000F2A2D /* OpenGL.framework */, + 2B51949E06B3D2D200744730 /* GLUT.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + 2B3E5A46062AACF3001D796E /* Products */ = { + isa = PBXGroup; + children = ( + 2BAF50930632BB1A00DB9A16 /* PeopsSoftGL.psxplugin */, + ); + name = Products; + sourceTree = ""; + }; + 2BD2E2F40779F50B00657C69 /* macsrc */ = { + isa = PBXGroup; + children = ( + 2BB260A60777462E00F6854C /* PluginConfigController.h */, + 2BB260A70777462E00F6854C /* PluginConfigController.m */, + 2B3E5DF0062B36FB001D796E /* PluginWindowController.h */, + 2B3E5DF1062B36FB001D796E /* PluginWindowController.m */, + 2B957EAE0635DFE400543905 /* PluginWindow.h */, + 2B957EAF0635DFE400543905 /* PluginWindow.m */, + 2BAF4FC90632967A00DB9A16 /* PluginGLView.h */, + 2BAF4FCA0632967A00DB9A16 /* PluginGLView.m */, + 2B3E5D64062B2CC1001D796E /* drawgl.m */, + 2B57868106BE7B3700BBA288 /* ExtendedKeys.h */, + ); + name = macsrc; + sourceTree = ""; + }; + 2BD2E818077AFB9F00657C69 /* English.lproj */ = { + isa = PBXGroup; + children = ( + 2BD2E828077AFC2C00657C69 /* NetSfPeopsSoftGPUConfig.nib */, + 2BD2E767077AF53E00657C69 /* Credits.rtf */, + 2B038C05069183300082466B /* InfoPlist.strings */, + ); + name = English.lproj; + sourceTree = ""; + }; + 71E9EBF0109F24B600E98D1D /* src */ = { + isa = PBXGroup; + children = ( + 71E9EBF1109F24E600E98D1D /* cfg.h */, + 71E9EBF2109F24E600E98D1D /* draw.h */, + 71E9EBF3109F24E600E98D1D /* externals.h */, + 71E9EBF4109F24E600E98D1D /* fps.c */, + 71E9EBF5109F24E600E98D1D /* fps.h */, + 71E9EBF6109F24E600E98D1D /* gpu.c */, + 71E9EBF7109F24E600E98D1D /* gpu.h */, + 71E9EBF8109F24E600E98D1D /* interp.h */, + 71E9EBF9109F24E600E98D1D /* key.c */, + 71E9EBFA109F24E600E98D1D /* key.h */, + 71E9EBFB109F24E600E98D1D /* menu.c */, + 71E9EBFC109F24E700E98D1D /* menu.h */, + 71E9EBFD109F24E700E98D1D /* prim.c */, + 71E9EBFE109F24E700E98D1D /* prim.h */, + 71E9EBFF109F24E700E98D1D /* soft.c */, + 71E9EC00109F24E700E98D1D /* soft.h */, + 71E9EC01109F24E700E98D1D /* swap.h */, + 71E9EC02109F24E700E98D1D /* zn.c */, + ); + name = src; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXHeadersBuildPhase section */ + 2BAF508E0632BB1A00DB9A16 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 2B959DC406342C23000F2A2D /* PluginGLView.h in Headers */, + 2B959DD006342C25000F2A2D /* PluginWindowController.h in Headers */, + 2B57868206BE7B3700BBA288 /* ExtendedKeys.h in Headers */, + 2BB260A80777462E00F6854C /* PluginConfigController.h in Headers */, + 2B143C79078A0C6700AF745A /* PluginWindow.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + +/* Begin PBXNativeTarget section */ + 2BAF50920632BB1A00DB9A16 /* gpuPeopsSoftGL */ = { + isa = PBXNativeTarget; + buildConfigurationList = 7170842C0FDFD328004F3EB4 /* Build configuration list for PBXNativeTarget "gpuPeopsSoftGL" */; + buildPhases = ( + 2BAF508E0632BB1A00DB9A16 /* Headers */, + 2BAF508F0632BB1A00DB9A16 /* Resources */, + 2BAF50900632BB1A00DB9A16 /* Sources */, + 2BAF50910632BB1A00DB9A16 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = gpuPeopsSoftGL; + productName = gpuPeopsSoftGL; + productReference = 2BAF50930632BB1A00DB9A16 /* PeopsSoftGL.psxplugin */; + productType = "com.apple.product-type.bundle"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 2B3E5A03062AAC1A001D796E /* Project object */ = { + isa = PBXProject; + buildConfigurationList = 717084310FDFD328004F3EB4 /* Build configuration list for PBXProject "PeopsSoftGPU" */; + hasScannedForEncodings = 1; + mainGroup = 2B3E59FF062AAC1A001D796E; + productRefGroup = 2B3E5A46062AACF3001D796E /* Products */; + projectDirPath = ""; + targets = ( + 2BAF50920632BB1A00DB9A16 /* gpuPeopsSoftGL */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 2BAF508F0632BB1A00DB9A16 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 2B959DE106342C31000F2A2D /* NetSfPeopsSoftGPUInterface.nib in Resources */, + 2B038C07069183300082466B /* InfoPlist.strings in Resources */, + 2B038D2306918AA80082466B /* Info.plist in Resources */, + 2BD2E829077AFC2C00657C69 /* NetSfPeopsSoftGPUConfig.nib in Resources */, + 2BD2E769077AF53E00657C69 /* Credits.rtf in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 2BAF50900632BB1A00DB9A16 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 2B959DC106342C22000F2A2D /* drawgl.m in Sources */, + 2B959DCD06342C24000F2A2D /* PluginGLView.m in Sources */, + 2B959DD506342C25000F2A2D /* PluginWindowController.m in Sources */, + 2B957EB10635DFE400543905 /* PluginWindow.m in Sources */, + 2BB260A90777462E00F6854C /* PluginConfigController.m in Sources */, + 71E9EC06109F24E700E98D1D /* fps.c in Sources */, + 71E9EC08109F24E700E98D1D /* gpu.c in Sources */, + 71E9EC0B109F24E700E98D1D /* key.c in Sources */, + 71E9EC0D109F24E700E98D1D /* menu.c in Sources */, + 71E9EC0F109F24E700E98D1D /* prim.c in Sources */, + 71E9EC11109F24E700E98D1D /* soft.c in Sources */, + 71E9EC14109F24E700E98D1D /* zn.c in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 2B038C05069183300082466B /* InfoPlist.strings */ = { + isa = PBXVariantGroup; + children = ( + 2B038C06069183300082466B /* English */, + ); + name = InfoPlist.strings; + sourceTree = ""; + }; + 2BD2E767077AF53E00657C69 /* Credits.rtf */ = { + isa = PBXVariantGroup; + children = ( + 2BD2E768077AF53E00657C69 /* English */, + ); + name = Credits.rtf; + sourceTree = ""; + }; + 2BD2E828077AFC2C00657C69 /* NetSfPeopsSoftGPUConfig.nib */ = { + isa = PBXVariantGroup; + children = ( + 2B371FBB0773859200B1DC0B /* English */, + ); + name = NetSfPeopsSoftGPUConfig.nib; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 7170842D0FDFD328004F3EB4 /* Development */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = NO; + DEBUGGING_SYMBOLS = YES; + GCC_DYNAMIC_NO_PIC = NO; + GCC_GENERATE_DEBUGGING_SYMBOLS = YES; + GCC_MODEL_TUNING = ""; + GCC_OPTIMIZATION_LEVEL = 1; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = ""; + GCC_PREPROCESSOR_DEFINITIONS = ( + _MACGL, + _DARWIN, + ); + GCC_WARN_FOUR_CHARACTER_CONSTANTS = NO; + GCC_WARN_UNKNOWN_PRAGMAS = NO; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "$(USER_LIBRARY_DIR)/Playstation Emulator Plugins"; + LIBRARY_STYLE = BUNDLE; + OPTIMIZATION_CFLAGS = "-finline-functions -finline-limit=1600 -fomit-frame-pointer -fno-exceptions -funroll-loops -falign-loops=16 -ffast-math"; + OTHER_CFLAGS = "-finline-functions"; + OTHER_LDFLAGS = ( + "-framework", + Foundation, + "-framework", + AppKit, + ); + OTHER_REZFLAGS = ""; + PRODUCT_NAME = PeopsSoftGL; + SECTORDER_FLAGS = ""; + SYMROOT = ../../build; + WARNING_CFLAGS = ( + "-Wmost", + "-Wno-four-char-constants", + "-Wno-unknown-pragmas", + ); + WRAPPER_EXTENSION = psxplugin; + }; + name = Development; + }; + 7170842E0FDFD328004F3EB4 /* Deployment */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = YES; + DEBUGGING_SYMBOLS = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_FIX_AND_CONTINUE = NO; + GCC_GENERATE_DEBUGGING_SYMBOLS = NO; + GCC_MODEL_TUNING = ""; + GCC_OPTIMIZATION_LEVEL = 3; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = ""; + GCC_PREPROCESSOR_DEFINITIONS = ( + _MACGL, + _DARWIN, + ); + GCC_WARN_FOUR_CHARACTER_CONSTANTS = NO; + GCC_WARN_UNKNOWN_PRAGMAS = NO; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "$(USER_LIBRARY_DIR)/Playstation Emulator Plugins"; + LIBRARY_STYLE = BUNDLE; + OPTIMIZATION_CFLAGS = "-finline-functions -finline-limit=1600 -fomit-frame-pointer -fno-exceptions -funroll-loops -falign-loops=16 -ffast-math"; + OTHER_LDFLAGS = ( + "-framework", + Foundation, + "-framework", + AppKit, + ); + OTHER_REZFLAGS = ""; + PRODUCT_NAME = PeopsSoftGL; + SECTORDER_FLAGS = ""; + SYMROOT = ../../build; + WARNING_CFLAGS = ( + "-Wmost", + "-Wno-four-char-constants", + "-Wno-unknown-pragmas", + ); + WRAPPER_EXTENSION = psxplugin; + ZERO_LINK = NO; + }; + name = Deployment; + }; + 717084320FDFD328004F3EB4 /* Development */ = { + isa = XCBuildConfiguration; + buildSettings = { + GCC_MODEL_TUNING = ""; + HEADER_SEARCH_PATHS = ( + ../../../plugins/dfxvideo, + ../../../libpcsxcore, + ); + }; + name = Development; + }; + 717084330FDFD328004F3EB4 /* Deployment */ = { + isa = XCBuildConfiguration; + buildSettings = { + GCC_MODEL_TUNING = ""; + HEADER_SEARCH_PATHS = ( + ../../../plugins/dfxvideo, + ../../../libpcsxcore, + ); + }; + name = Deployment; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 7170842C0FDFD328004F3EB4 /* Build configuration list for PBXNativeTarget "gpuPeopsSoftGL" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 7170842D0FDFD328004F3EB4 /* Development */, + 7170842E0FDFD328004F3EB4 /* Deployment */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Development; + }; + 717084310FDFD328004F3EB4 /* Build configuration list for PBXProject "PeopsSoftGPU" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 717084320FDFD328004F3EB4 /* Development */, + 717084330FDFD328004F3EB4 /* Deployment */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Development; + }; +/* End XCConfigurationList section */ + }; + rootObject = 2B3E5A03062AAC1A001D796E /* Project object */; +} diff --git a/macosx/plugins/DFXVideo/macsrc/ExtendedKeys.h b/macosx/plugins/DFXVideo/macsrc/ExtendedKeys.h new file mode 100644 index 0000000..1b6475b --- /dev/null +++ b/macosx/plugins/DFXVideo/macsrc/ExtendedKeys.h @@ -0,0 +1,23 @@ + +#ifndef __EXTENDED_KEYS_H__ +#define __EXTENDED_KEYS_H__ + +enum { + PSX_FREEZE_KEY = 0xFFBE/*XK_F1*/, + PSX_NEXT_FREEZE_SLOT_KEY = 0xFFBF/*XK_F2*/, + PSX_DEFROST_KEY = 0xFFC0/*XK_F3*/, + PSX_SHOW_FREEZE_PIC_KEY = 0xFFC1/*XK_F4*/, + PSX_SIO_ALWAYS_ON_KEY = 0xFFC2/*XK_F5*/, + PSX_BW_MDEC_KEY = 0xFFC3/*XK_F6*/, + PSX_XA_AUDIO_ON_KEY = 0xFFC4/*XK_F7*/, + PSX_SNAPSHOT_KEY = 0xFFC5/*XK_F8*/, + PSX_OPEN_SHELL_KEY = 0xFFC6/*XK_F9*/, + PSX_CLOSE_SHELL_KEY = 0xFFC7/*XK_F10*/, + + PSX_STOP_KEY = 0xFF1B/*XK_Escape*/, + + GPU_FULLSCREEN_KEY = 0x0100, + GPU_FPS_DISPLAY_KEY = 0xFFFF/*XK_Delete*/ +}; + +#endif //__EXTENDED_KEYS_H__ diff --git a/macosx/plugins/DFXVideo/macsrc/PluginConfigController.h b/macosx/plugins/DFXVideo/macsrc/PluginConfigController.h new file mode 100644 index 0000000..0e73441 --- /dev/null +++ b/macosx/plugins/DFXVideo/macsrc/PluginConfigController.h @@ -0,0 +1,26 @@ +/* NetSfPeopsSoftGPUPluginConfigController */ + +#define PluginConfigController NetSfPeopsSoftGPUPluginConfigController + +#import + +@interface PluginConfigController : NSWindowController +{ + IBOutlet NSControl *autoFullScreen; + IBOutlet NSPopUpButton *ditherMode; + IBOutlet NSControl *fpsCounter; + IBOutlet NSControl *frameSkipping; + IBOutlet NSControl *hackEnable; + IBOutlet NSView *hacksView; + IBOutlet NSControl *vSync; + + NSMutableDictionary *keyValues; +} +- (IBAction)cancel:(id)sender; +- (IBAction)ok:(id)sender; +- (IBAction)reset:(id)sender; +- (IBAction)hackToggle:(id)sender; + +- (void)loadValues; + +@end diff --git a/macosx/plugins/DFXVideo/macsrc/PluginConfigController.m b/macosx/plugins/DFXVideo/macsrc/PluginConfigController.m new file mode 100644 index 0000000..2d3e667 --- /dev/null +++ b/macosx/plugins/DFXVideo/macsrc/PluginConfigController.m @@ -0,0 +1,216 @@ +#import "PluginConfigController.h" +#include "gpu.h" +#include "cfg.h" +#include "menu.h" +#include "externals.h" + +#define APP_ID @"net.sf.peops.SoftGpuGLPlugin" +#define PrefsKey APP_ID @" Settings" + +static PluginConfigController *windowController; +char * pConfigFile=NULL; + +void AboutDlgProc() +{ + // Get parent application instance + NSApplication *app = [NSApplication sharedApplication]; + NSBundle *bundle = [NSBundle bundleWithIdentifier:APP_ID]; + + // Get Credits.rtf + NSString *path = [bundle pathForResource:@"Credits" ofType:@"rtf"]; + NSAttributedString *credits; + if (path) { + credits = [[[NSAttributedString alloc] initWithPath: path + documentAttributes:NULL] autorelease]; + } else { + credits = [[[NSAttributedString alloc] initWithString:@""] autorelease]; + } + + // Get Application Icon + NSImage *icon = [[NSWorkspace sharedWorkspace] iconForFile:[bundle bundlePath]]; + NSSize size = NSMakeSize(64, 64); + [icon setSize:size]; + + [app orderFrontStandardAboutPanelWithOptions:[NSDictionary dictionaryWithObjectsAndKeys: + [bundle objectForInfoDictionaryKey:@"CFBundleName"], @"ApplicationName", + icon, @"ApplicationIcon", + [bundle objectForInfoDictionaryKey:@"CFBundleShortVersionString"], @"ApplicationVersion", + [bundle objectForInfoDictionaryKey:@"CFBundleVersion"], @"Version", + [bundle objectForInfoDictionaryKey:@"NSHumanReadableCopyright"], @"Copyright", + credits, @"Credits", + nil]]; +} + + +void SoftDlgProc() +{ + NSWindow *window; + + if (windowController == nil) { + windowController = [[PluginConfigController alloc] initWithWindowNibName:@"NetSfPeopsSoftGPUConfig"]; + } + window = [windowController window]; + + /* load values */ + [windowController loadValues]; + + [window center]; + [window makeKeyAndOrderFront:nil]; +} + +void ReadConfig(void) +{ + NSDictionary *keyValues; + NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; + [defaults registerDefaults:[NSDictionary dictionaryWithObjectsAndKeys: + [[NSMutableDictionary alloc] initWithObjectsAndKeys: + [NSNumber numberWithBool:NO], @"FPS Counter", + [NSNumber numberWithBool:NO], @"Auto Full Screen", + [NSNumber numberWithBool:NO], @"Frame Skipping", + [NSNumber numberWithBool:YES], @"Frame Limit", + [NSNumber numberWithBool:NO], @"VSync", + [NSNumber numberWithBool:NO], @"Enable Hacks", + [NSNumber numberWithInt:1], @"Dither Mode", + [NSNumber numberWithLong:0], @"Hacks", + nil], PrefsKey, + nil]]; + + keyValues = [defaults dictionaryForKey:PrefsKey]; + + iShowFPS = [[keyValues objectForKey:@"FPS Counter"] boolValue]; + iWindowMode = [[keyValues objectForKey:@"Auto Full Screen"] boolValue] ? 0 : 1; + UseFrameSkip = [[keyValues objectForKey:@"Frame Skipping"] boolValue]; + UseFrameLimit = [[keyValues objectForKey:@"Frame Limit"] boolValue]; + //??? = [[keyValues objectForKey:@"VSync"] boolValue]; + iUseFixes = [[keyValues objectForKey:@"Enable Hacks"] boolValue]; + + iUseDither = [[keyValues objectForKey:@"Dither Mode"] intValue]; + dwCfgFixes = [[keyValues objectForKey:@"Hacks"] longValue]; + + iResX = 640; + iResY = 480; + iUseNoStretchBlt = 1; + + fFrameRate = 60; + iFrameLimit = 2; + + if (iShowFPS) + ulKeybits|=KEY_SHOWFPS; + else + ulKeybits&=~KEY_SHOWFPS; + + // additional checks + if(!iColDepth) iColDepth=32; + if(iUseFixes) dwActFixes=dwCfgFixes; + else dwActFixes=0; + SetFixes(); + + if(iFrameLimit==2) SetAutoFrameCap(); + bSkipNextFrame = FALSE; + + szDispBuf[0]=0; + BuildDispMenu(0); +} + +@implementation PluginConfigController + +- (IBAction)cancel:(id)sender +{ + [self close]; +} + +- (IBAction)ok:(id)sender +{ + NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; + + NSMutableDictionary *writeDic = [NSMutableDictionary dictionaryWithDictionary:keyValues]; + [writeDic setObject:[NSNumber numberWithInt:[fpsCounter intValue]] forKey:@"FPS Counter"]; + [writeDic setObject:[NSNumber numberWithInt:[autoFullScreen intValue]] forKey:@"Auto Full Screen"]; + [writeDic setObject:[NSNumber numberWithInt:[frameSkipping intValue]] forKey:@"Frame Skipping"]; + //[writeDic setObject:[NSNumber numberWithInt:[frameLimit intValue]] forKey:@"Frame Limit"]; + [writeDic setObject:[NSNumber numberWithInt:[vSync intValue]] forKey:@"VSync"]; + [writeDic setObject:[NSNumber numberWithInt:[hackEnable intValue]] forKey:@"Enable Hacks"]; + + [writeDic setObject:[NSNumber numberWithInt:[ditherMode indexOfSelectedItem]] forKey:@"Dither Mode"]; + + unsigned long hackValues = 0; + int i; + NSArray *views = [hacksView subviews]; + for (i=0; i<[views count]; i++) { + NSView *control = [views objectAtIndex:i]; + if ([control isKindOfClass:[NSButton class]]) { + hackValues |= [(NSControl *)control intValue] << ([control tag] - 1); + } + } + + [writeDic setObject:[NSNumber numberWithLong:hackValues] forKey:@"Hacks"]; + + // write to defaults + [defaults setObject:writeDic forKey:PrefsKey]; + [defaults synchronize]; + + // and set global values accordingly + ReadConfig(); + + [self close]; +} + +- (IBAction)reset:(id)sender +{ + NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; + [defaults removeObjectForKey:PrefsKey]; + [self loadValues]; +} + +- (IBAction)hackToggle:(id)sender +{ + BOOL enable = [sender intValue] ? YES : NO; + int i; + NSArray *views = [hacksView subviews]; + + for (i=0; i<[views count]; i++) { + NSView *control = [views objectAtIndex:i]; + if ([control isKindOfClass:[NSButton class]]) { + [(NSControl *)control setEnabled:enable]; + } + } +} + +- (void)loadValues +{ + NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; + + ReadConfig(); + + /* load from preferences */ + [keyValues release]; + keyValues = [[defaults dictionaryForKey:PrefsKey] retain]; + + [fpsCounter setIntValue:[[keyValues objectForKey:@"FPS Counter"] intValue]]; + [autoFullScreen setIntValue:[[keyValues objectForKey:@"Auto Full Screen"] intValue]]; + [frameSkipping setIntValue:[[keyValues objectForKey:@"Frame Skipping"] intValue]]; + [vSync setIntValue:[[keyValues objectForKey:@"VSync"] intValue]]; + [hackEnable setIntValue:[[keyValues objectForKey:@"Enable Hacks"] intValue]]; + + [ditherMode selectItemAtIndex:[[keyValues objectForKey:@"Dither Mode"] intValue]]; + + unsigned long hackValues = [[keyValues objectForKey:@"Hacks"] longValue]; + + int i; + NSArray *views = [hacksView subviews]; + for (i=0; i<[views count]; i++) { + NSView *control = [views objectAtIndex:i]; + if ([control isKindOfClass:[NSButton class]]) { + [(NSControl *)control setIntValue:(hackValues >> ([control tag] - 1)) & 1]; + } + } + + [self hackToggle:hackEnable]; +} + +- (void)awakeFromNib +{ + hacksView = [[hacksView subviews] objectAtIndex:0]; +} + +@end diff --git a/macosx/plugins/DFXVideo/macsrc/PluginGLView.h b/macosx/plugins/DFXVideo/macsrc/PluginGLView.h new file mode 100644 index 0000000..fea3b89 --- /dev/null +++ b/macosx/plugins/DFXVideo/macsrc/PluginGLView.h @@ -0,0 +1,63 @@ +/*************************************************************************** + PluginGLView.h + PeopsSoftGPU + + Created by Gil Pedersen on Sun April 18 2004. + Copyright (c) 2004 Gil Pedersen. + ***************************************************************************/ + +/*************************************************************************** + * * + * This program 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. See also the license.txt file for * + * additional informations. * + * * + ***************************************************************************/ + +#define PluginGLView NetSfPeopsSoftGPUPluginGLView + +#import +#import +#include + +#define IMAGE_COUNT 2 + +@interface PluginGLView : NSOpenGLView +{ + GLubyte *image_base; + GLubyte *image[IMAGE_COUNT]; + + GLint buffers; + //GLint frame_rate; + + GLenum texture_hint; + GLboolean rect_texture; + GLboolean client_storage; + GLboolean texture_range; + + struct timeval cycle_time; + + NSLock *glLock; + BOOL noDisplay; + BOOL drawBG; + + int image_width; + int image_height; + int image_width2; + int image_height2; + int image_depth; + int image_type; + float image_tx; + float image_ty; + int whichImage; + int isFullscreen; +} + +- (void)renderScreen; +- (void)swapBuffer; +- (void)clearBuffer:(BOOL)display; +- (void)loadTextures: (GLboolean)first; + +@end diff --git a/macosx/plugins/DFXVideo/macsrc/PluginGLView.m b/macosx/plugins/DFXVideo/macsrc/PluginGLView.m new file mode 100644 index 0000000..96b05ff --- /dev/null +++ b/macosx/plugins/DFXVideo/macsrc/PluginGLView.m @@ -0,0 +1,692 @@ +/*************************************************************************** + PluginGLView.m + PeopsSoftGPU + + Created by Gil Pedersen on Sun April 18 2004. + Copyright (c) 2004 Gil Pedersen. + ***************************************************************************/ + +/*************************************************************************** + * * + * This program 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. See also the license.txt file for * + * additional informations. * + * * + ***************************************************************************/ + +#import +#import +#import +#import +#import +#import "PluginGLView.h" +#include "externals.h" +#undef BOOL +#include "gpu.h" +#include "swap.h" + +#include +extern time_t tStart; + +static int mylog2(int val) +{ + int i; + for (i=1; i<31; i++) + if (val <= (1 << i)) + return (1 << i); + + return -1; +} + +#if 0 +void BlitScreen16NS(unsigned char * surf,long x,long y) +{ + unsigned long lu; + unsigned short row,column; + unsigned short dx=PreviousPSXDisplay.Range.x1>>1; + unsigned short dy=PreviousPSXDisplay.DisplayMode.y; + unsigned short LineOffset,SurfOffset; + long lPitch=image_width<<1; + + if(PreviousPSXDisplay.Range.y0) // centering needed? + { + surf+=PreviousPSXDisplay.Range.y0*lPitch; + dy-=PreviousPSXDisplay.Range.y0; + } + + { + unsigned long * SRCPtr = (unsigned long *)(psxVuw + (y<<10) + x); + unsigned long * DSTPtr = ((unsigned long *)surf)+(PreviousPSXDisplay.Range.x0>>1); + + LineOffset = 512 - dx; + SurfOffset = (lPitch>>2) - dx; + + for(column=0;column>10)&0x1f001f); + } + SRCPtr += LineOffset; + DSTPtr += SurfOffset; + } + } +} +#endif + +@implementation PluginGLView + +//- (id)initWithFrame:(NSRect)frameRect +- (id) initWithCoder: (NSCoder *) coder +{ + const GLubyte * strExt; + + if ((self = [super initWithCoder:coder]) == nil) + return nil; + + glLock = [[NSLock alloc] init]; + if (nil == glLock) { + [self release]; + return nil; + } + + // Init pixel format attribs + NSOpenGLPixelFormatAttribute attrs[] = + { + NSOpenGLPFAAccelerated, + NSOpenGLPFANoRecovery, + NSOpenGLPFADoubleBuffer, + 0 + }; + + // Get pixel format from OpenGL + NSOpenGLPixelFormat* pixFmt = [[NSOpenGLPixelFormat alloc] initWithAttributes:attrs]; + if (!pixFmt) + { + NSLog(@"No Accelerated OpenGL pixel format found\n"); + + NSOpenGLPixelFormatAttribute attrs2[] = + { + NSOpenGLPFANoRecovery, + 0 + }; + + // Get pixel format from OpenGL + pixFmt = [[NSOpenGLPixelFormat alloc] initWithAttributes:attrs2]; + if (!pixFmt) { + NSLog(@"No OpenGL pixel format found!\n"); + + [self release]; + return nil; + } + } + + [self setPixelFormat:[pixFmt autorelease]]; + + /* + long swapInterval = 1 ; + [[self openGLContext] + setValues:&swapInterval + forParameter:NSOpenGLCPSwapInterval]; + */ + [glLock lock]; + [[self openGLContext] makeCurrentContext]; + + // Init object members + strExt = glGetString (GL_EXTENSIONS); + texture_range = gluCheckExtension ((const unsigned char *)"GL_APPLE_texture_range", strExt) ? GL_TRUE : GL_FALSE; + texture_hint = GL_STORAGE_SHARED_APPLE ; + client_storage = gluCheckExtension ((const unsigned char *)"GL_APPLE_client_storage", strExt) ? GL_TRUE : GL_FALSE; + rect_texture = gluCheckExtension((const unsigned char *)"GL_EXT_texture_rectangle", strExt) ? GL_TRUE : GL_FALSE; + + // Setup some basic OpenGL stuff + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); + glColor4f(1.0f, 1.0f, 1.0f, 1.0f); + glClearColor(0.0f, 0.0f, 0.0f, 1.0f); + glClear(GL_COLOR_BUFFER_BIT); + + [NSOpenGLContext clearCurrentContext]; + [glLock unlock]; + + image_width = 1024; + image_height = 512; + image_depth = 16; + + image_type = GL_UNSIGNED_SHORT_1_5_5_5_REV; + image_base = (GLubyte *) calloc(((IMAGE_COUNT * image_width * image_height) / 3) * 4, image_depth >> 3); + if (image_base == nil) { + [self release]; + return nil; + } + + // Create and load textures for the first time + [self loadTextures:GL_TRUE]; + + // Init fps timer + //gettimeofday(&cycle_time, NULL); + + drawBG = YES; + + // Call for a redisplay + noDisplay = YES; + PSXDisplay.Disabled = 1; + [self setNeedsDisplay:true]; + + return self; +} + +- (void)dealloc +{ + int i; + + [glLock lock]; + + [[self openGLContext] makeCurrentContext]; + for(i = 0; i < IMAGE_COUNT; i++) + { + GLuint dt = i+1; + glDeleteTextures(1, &dt); + } + if(texture_range) glTextureRangeAPPLE(GL_TEXTURE_RECTANGLE_EXT, IMAGE_COUNT * image_width * image_height * (image_depth >> 3), image_base); + + [NSOpenGLContext clearCurrentContext]; + [glLock unlock]; + [glLock release]; + + if (image_base) + free(image_base); + + [super dealloc]; +} + +- (BOOL)isOpaque +{ + return YES; +} + +- (BOOL)acceptsFirstResponder +{ + return NO; +} + +- (void)drawRect:(NSRect)aRect +{ + // Check if an update has occured to the buffer + if ([self lockFocusIfCanDraw]) { + + // Make this context current + if (drawBG) { + [[NSColor blackColor] setFill]; + [NSBezierPath fillRect:[self visibleRect]]; + } + + //glFinish() ; + // Swap buffer to screen + //[[self openGLContext] flushBuffer]; + + [self unlockFocus]; + } +} + +#if 0 +- (void)update // moved or resized +{ + NSRect rect; + + [super update]; + + [[self openGLContext] makeCurrentContext]; + [[self openGLContext] update]; + + rect = [self bounds]; + + glViewport(0, 0, (int) rect.size.width, (int) rect.size.height); + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + + //[self setNeedsDisplay:true]; +} +#endif + +- (void)reshape // scrolled, moved or resized +{ + [glLock lock]; + + NSOpenGLContext *oglContext = [self openGLContext]; + NSRect rect; + + [super reshape]; + + [oglContext makeCurrentContext]; + [oglContext update]; + + rect = [[oglContext view] bounds]; + + glViewport(0, 0, (int) rect.size.width, (int) rect.size.height); + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + + drawBG = YES; + + [NSOpenGLContext clearCurrentContext]; + +// [self setNeedsDisplay:true]; + + [self renderScreen]; + [glLock unlock]; +} + +- (void)renderScreen +{ + int bufferIndex = whichImage; + + if (1/*[glLock tryLock]*/) { + // Make this context current + [[self openGLContext] makeCurrentContext]; + if (PSXDisplay.Disabled) { + glClear(GL_COLOR_BUFFER_BIT); + } else { + // Bind, update and draw new image + if(rect_texture) + { + glBindTexture(GL_TEXTURE_RECTANGLE_EXT, bufferIndex+1); + + glTexSubImage2D(GL_TEXTURE_RECTANGLE_EXT, 0, 0, 0, image_width, image_height, GL_BGRA, image_type, image[bufferIndex]); + glBegin(GL_QUADS); + glTexCoord2f(0.0f, 0.0f); + glVertex2f(-1.0f, 1.0f); + + glTexCoord2f(0.0f, image_height); + glVertex2f(-1.0f, -1.0f); + + glTexCoord2f(image_width, image_height); + glVertex2f(1.0f, -1.0f); + + glTexCoord2f(image_width, 0.0f); + glVertex2f(1.0f, 1.0f); + glEnd(); + } + else + { + glBindTexture(GL_TEXTURE_2D, whichImage+1); + + glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, image_width2, image_height2, GL_BGRA, image_type, image[bufferIndex]); + glBegin(GL_QUADS); + glTexCoord2f(0.0f, 0.0f); + glVertex2f(-1.0f, 1.0f); + + glTexCoord2f(0.0f, image_ty); + glVertex2f(-1.0f, -1.0f); + + glTexCoord2f(image_tx, image_ty); + glVertex2f(1.0f, -1.0f); + + glTexCoord2f(image_tx, 0.0f); + glVertex2f(1.0f, 1.0f); + glEnd(); + } + } + + // FPS Display + if(ulKeybits&KEY_SHOWFPS) + { + int len, i; + if(szDebugText[0] && ((time(NULL) - tStart) < 2)) + { + strncpy(szDispBuf, szDebugText, 63); + } + else + { + szDebugText[0]=0; + if (szMenuBuf) { + strncat(szDispBuf, szMenuBuf, 63 - strlen(szDispBuf)); + } + } + + NSRect rect = [[[self openGLContext] view] bounds]; + len = (int) strlen(szDispBuf); + + glMatrixMode(GL_PROJECTION); + glPushMatrix(); + + gluOrtho2D(0.0, rect.size.width, 0.0, rect.size.height); + glDisable(rect_texture ? GL_TEXTURE_RECTANGLE_EXT : GL_TEXTURE_2D); + + glColor4f(0.0, 0.0, 0.0, 0.5); + glRasterPos2f(3.0, rect.size.height - 14.0); + for (i = 0; i < len; i++) { + glutBitmapCharacter(GLUT_BITMAP_HELVETICA_12, szDispBuf[i]); + } + + glColor3f(1.0, 1.0, 1.0); + glRasterPos2f(2.0, rect.size.height - 13.0); + for (i = 0; i < len; i++) { + glutBitmapCharacter(GLUT_BITMAP_HELVETICA_12, szDispBuf[i]); + } + + + glEnable(rect_texture ? GL_TEXTURE_RECTANGLE_EXT : GL_TEXTURE_2D); + glPopMatrix(); + } + + [[self openGLContext] flushBuffer]; + [NSOpenGLContext clearCurrentContext]; + //[glLock unlock]; + } +} + +- (void)loadTextures:(GLboolean)first +{ + GLint i; + + //[glLock lock]; + [[self openGLContext] makeCurrentContext]; + + /* + printf("Range.x0=%i\n" + "Range.x1=%i\n" + "Range.y0=%i\n" + "Range.y1=%i\n", + PreviousPSXDisplay.Range.x0, + PreviousPSXDisplay.Range.x1, + PreviousPSXDisplay.Range.y0, + PreviousPSXDisplay.Range.y1); + + printf("DisplayMode.x=%d\n" + "DisplayMode.y=%d\n", + PreviousPSXDisplay.DisplayMode.x, + PreviousPSXDisplay.DisplayMode.y); + + printf("DisplayPosition.x=%i\n" + "DisplayPosition.y=%i\n", + PreviousPSXDisplay.DisplayPosition.x, + PreviousPSXDisplay.DisplayPosition.y); + + printf("DisplayEnd.x=%i\n" + "DisplayEnd.y=%i\n", + PreviousPSXDisplay.DisplayEnd.x, + PreviousPSXDisplay.DisplayEnd.y); + + printf("Double=%i\n" + "Height=%i\n", + PreviousPSXDisplay.Double, + PreviousPSXDisplay.Height); + + printf("Disabled=%i\n", PreviousPSXDisplay.Disabled); + */ + + image_width = PreviousPSXDisplay.Range.x1; + image_height = PreviousPSXDisplay.DisplayMode.y; + if (PSXDisplay.RGB24) { + image_depth = 32; + image_type = GL_UNSIGNED_INT_8_8_8_8_REV; + } else { + image_depth = 16; + image_type = GL_UNSIGNED_SHORT_1_5_5_5_REV; + //image_width >>= 1; + } + + if (image_width * image_height * (image_depth >> 3) > ((1024*512*2)/3)*4) + printf("Fatal error: desired dimension are too large! (%ix%i %ibpp)\n", + image_width, image_height, image_depth); + + for(i = 0; i < IMAGE_COUNT; i++) + image[i] = image_base + i * image_width * image_height * (image_depth >> 3); + + if(rect_texture) + { + image_width2 = image_width; + image_height2 = image_height; + image_tx = (float)image_width; + image_ty = (float)image_height; + + if(texture_range) glTextureRangeAPPLE(GL_TEXTURE_RECTANGLE_EXT, IMAGE_COUNT * image_width * image_height * (image_depth >> 3), image_base); + else glTextureRangeAPPLE(GL_TEXTURE_RECTANGLE_EXT, 0, NULL); + + for(i = 0; i < IMAGE_COUNT; i++) + { + if(!first) + { + GLuint dt = i+1; + glDeleteTextures(1, &dt); + } + + glDisable(GL_TEXTURE_2D); + glEnable(GL_TEXTURE_RECTANGLE_EXT); + glBindTexture(GL_TEXTURE_RECTANGLE_EXT, i+1); + + glTexParameteri(GL_TEXTURE_RECTANGLE_EXT, GL_TEXTURE_STORAGE_HINT_APPLE , texture_hint); + glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, client_storage); + glTexParameteri(GL_TEXTURE_RECTANGLE_EXT, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_RECTANGLE_EXT, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_RECTANGLE_EXT, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_RECTANGLE_EXT, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); + + glTexImage2D(GL_TEXTURE_RECTANGLE_EXT, 0, GL_RGBA, image_width, + image_height, 0, GL_BGRA, image_type, image[i]); + } + } + else + { + image_width2 = mylog2(image_width); + image_height2 = mylog2(image_height); + image_tx = (float)image_width/(float)image_width2; + image_ty = (float)image_height/(float)image_height2; + + glTextureRangeAPPLE(GL_TEXTURE_RECTANGLE_EXT, 0, NULL); + if(texture_range) glTextureRangeAPPLE(GL_TEXTURE_2D, IMAGE_COUNT * image_width2 * image_height2 * (image_depth >> 3), image_base); + else glTextureRangeAPPLE(GL_TEXTURE_2D, 0, NULL); + + for(i = 0; i < IMAGE_COUNT; i++) + { + if(!first) + { + GLuint dt = i+1; + glDeleteTextures(1, &dt); + } + + glDisable(GL_TEXTURE_RECTANGLE_EXT); + glEnable(GL_TEXTURE_2D); + glBindTexture(GL_TEXTURE_2D, i+1); + + //if(texture_range) glTextureRangeAPPLE(GL_TEXTURE_2D, IMAGE_COUNT * image_width2 * image_height2 * (image_depth >> 3), image_base); + //else glTextureRangeAPPLE(GL_TEXTURE_2D, 0, NULL); + + glTexParameteri(GL_TEXTURE_RECTANGLE_EXT, GL_TEXTURE_STORAGE_HINT_APPLE , texture_hint); + glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, client_storage); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); + + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, image_width2, + image_height2, 0, GL_BGRA, image_type, image[i]); + } + } + + [NSOpenGLContext clearCurrentContext]; + //[glLock unlock]; +} + +- (void)swapBuffer +{ + unsigned char * surf; + long x = PSXDisplay.DisplayPosition.x; + long y = PSXDisplay.DisplayPosition.y; + unsigned long lu; + unsigned short row,column; + unsigned short dx=(unsigned short)PSXDisplay.DisplayEnd.x;//PreviousPSXDisplay.Range.x1; + unsigned short dy=(unsigned short)PSXDisplay.DisplayEnd.y;//PreviousPSXDisplay.DisplayMode.y; + long lPitch; + + //printf("y=%i",PSXDisplay.DisplayPosition.y); + + if ([glLock tryLock]) { + // make sure the texture area is ready to be written to + glFinishObjectAPPLE(GL_TEXTURE, 2-whichImage); + + if ((image_width != PreviousPSXDisplay.Range.x1) || + (image_height != PreviousPSXDisplay.DisplayMode.y) || + ((PSXDisplay.RGB24 ? 32 : 16) != image_depth)) { + [self loadTextures:NO]; + } + + surf = image[1-whichImage]; + lPitch=image_width2<<(image_depth >> 4); + + if(PreviousPSXDisplay.Range.y0) // centering needed? + { + surf+=PreviousPSXDisplay.Range.y0*lPitch; + dy-=PreviousPSXDisplay.Range.y0; + } + + if(PSXDisplay.RGB24) + { + unsigned char * pD;unsigned int startxy; + + surf+=PreviousPSXDisplay.Range.x0<<2; + + for(column=0;column>24)&0xff)<<16)|(((lu1>>16)&0xff)<<8)|(((lu1>>8)&0xff)); + *(dst+1)= + (((lu1>>0)&0xff)<<16)|(((lu2>>24)&0xff)<<8)|(((lu2>>16)&0xff)); + *(dst+2)= + (((lu2>>8)&0xff)<<16)|(((lu2>>0)&0xff)<<8)|(((lu3>>24)&0xff)); + *(dst+3)= + (((lu3>>16)&0xff)<<16)|(((lu3>>8)&0xff)<<8)|(((lu3>>0)&0xff)); +#else + *(dst)= + (((lu1>>0)&0xff)<<16)|(((lu1>>8)&0xff)<<8)|(((lu1>>16)&0xff)); + *(dst+1)= + (((lu1>>24)&0xff)<<16)|(((lu2>>0)&0xff)<<8)|(((lu2>>8)&0xff)); + *(dst+2)= + (((lu2>>16)&0xff)<<16)|(((lu2>>24)&0xff)<<8)|(((lu3>>0)&0xff)); + *(dst+3)= + (((lu3>>8)&0xff)<<16)|(((lu3>>16)&0xff)<<8)|(((lu3>>24)&0xff)); +#endif + pD+=12; + } + + //for(;row> 1); + + dx >>= 1; + + LineOffset = 512 - dx; + SurfOffset = (lPitch >> 2) - dx; + + for(column=0;column> 10) & 0x1f001f); + } + SRCPtr += LineOffset; + DSTPtr += SurfOffset; + } + } + + // Swap image buffer + whichImage = 1 - whichImage; + + [self renderScreen]; + [glLock unlock]; + } +} + +- (void)clearBuffer:(BOOL)display +{ + if (display == NO) { + //[[self openGLContext] makeCurrentContext]; + //glClear(GL_COLOR_BUFFER_BIT); + //[self loadTextures:NO]; + } else { + noDisplay = YES; +// [self setNeedsDisplay:true]; + } +} +/* +- (void)mouseDown:(NSEvent *)theEvent +{ + PluginWindowController *controller = [[self window] windowController]; + + static unsigned long lastTime = 0; + unsigned long time; + + time = TickCount(); + + if (lastTime != 0) { + if (time - lastTime > GetDblTime()) { + if (isFullscreen) { + [[self openGLContext] clearDrawable]; + } else { + [[self openGLContext] setFullScreen]; + } + isFullscreen = 1-isFullscreen; + lastTime = 0; + return; + } + } + + lastTime = time; +}*/ + +@end diff --git a/macosx/plugins/DFXVideo/macsrc/PluginWindow.h b/macosx/plugins/DFXVideo/macsrc/PluginWindow.h new file mode 100644 index 0000000..38a8dfa --- /dev/null +++ b/macosx/plugins/DFXVideo/macsrc/PluginWindow.h @@ -0,0 +1,24 @@ +/*************************************************************************** + PluginWindow.h + PeopsSoftGPU + + Created by Gil Pedersen on Wed April 21 2004. + Copyright (c) 2004 Gil Pedersen. + ***************************************************************************/ + +/*************************************************************************** + * * + * This program 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. See also the license.txt file for * + * additional informations. * + * * + ***************************************************************************/ + +#import + +@interface NetSfPeopsSoftGPUPluginWindow : NSWindow +{ +} +@end diff --git a/macosx/plugins/DFXVideo/macsrc/PluginWindow.m b/macosx/plugins/DFXVideo/macsrc/PluginWindow.m new file mode 100644 index 0000000..ef4737f --- /dev/null +++ b/macosx/plugins/DFXVideo/macsrc/PluginWindow.m @@ -0,0 +1,46 @@ +/*************************************************************************** + PluginWindow.m + PeopsSoftGPU + + Created by Gil Pedersen on Wed April 21 2004. + Copyright (c) 2004 Gil Pedersen. + ***************************************************************************/ + +/*************************************************************************** + * * + * This program 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. See also the license.txt file for * + * additional informations. * + * * + ***************************************************************************/ + +#import "PluginWindow.h" + +@implementation NetSfPeopsSoftGPUPluginWindow +/* +- (BOOL)windowShouldClose:(id)sender +{ + [[NSNotificationCenter defaultCenter] postNotificationName:@"emuWindowDidClose" object:self]; + + return YES; +}*/ + +- (void)sendEvent:(NSEvent *)theEvent +{ + int type = [theEvent type]; + if (type == NSKeyDown || type == NSKeyUp) { + if (type == NSKeyDown && [theEvent keyCode] == 53 /* escape */) { + // reroute to menu event + [[NSApp mainMenu] performKeyEquivalent:theEvent]; + } + + // ignore all key Events + return; + } + + [super sendEvent:theEvent]; +} + +@end diff --git a/macosx/plugins/DFXVideo/macsrc/PluginWindowController.h b/macosx/plugins/DFXVideo/macsrc/PluginWindowController.h new file mode 100644 index 0000000..ff9af25 --- /dev/null +++ b/macosx/plugins/DFXVideo/macsrc/PluginWindowController.h @@ -0,0 +1,41 @@ +/*************************************************************************** + PluginWindowController.h + PeopsSoftGPU + + Created by Gil Pedersen on Mon April 11 2004. + Copyright (c) 2004 Gil Pedersen. + ***************************************************************************/ + +/*************************************************************************** + * * + * This program 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. See also the license.txt file for * + * additional informations. * + * * + ***************************************************************************/ + +#define PluginWindowController NetSfPeopsSoftGPUPluginWindowController + +#import +#import "PluginGLView.h" + +@class PluginWindowController; + +extern NSWindow *gameWindow; +extern PluginWindowController *gameController; + +@interface PluginWindowController : NSWindowController +{ + IBOutlet NSOpenGLView *glView; + + NSWindow *fullWindow; +} + ++ (id)openGameView; +- (PluginGLView *)getOpenGLView; +- (BOOL)fullscreen; +- (void)setFullscreen:(BOOL)flag; + +@end diff --git a/macosx/plugins/DFXVideo/macsrc/PluginWindowController.m b/macosx/plugins/DFXVideo/macsrc/PluginWindowController.m new file mode 100644 index 0000000..48262e5 --- /dev/null +++ b/macosx/plugins/DFXVideo/macsrc/PluginWindowController.m @@ -0,0 +1,227 @@ +/*************************************************************************** + PluginWindowController.m + PeopsSoftGPU + + Created by Gil Pedersen on Tue April 12 2004. + Copyright (c) 2004 Gil Pedersen. + ***************************************************************************/ + +/*************************************************************************** + * * + * This program 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. See also the license.txt file for * + * additional informations. * + * * + ***************************************************************************/ + +#import "PluginWindowController.h" +#import "PluginWindow.h" +#import "Carbon/Carbon.h" +#include "externals.h" +#undef BOOL + +NSWindow *gameWindow; +PluginWindowController *gameController; +NSRect windowFrame; + +@implementation PluginWindowController + ++ (id)openGameView +{ + if (gameWindow == nil) { + if (gameController == nil) { + gameController = [[PluginWindowController alloc] initWithWindowNibName:@"NetSfPeopsSoftGPUInterface"]; + } + gameWindow = [gameController window]; + } + + if (windowFrame.size.width != 0) { + [gameWindow setFrame:windowFrame display:NO]; + } else { + [gameWindow center]; + } + + [gameWindow makeKeyAndOrderFront:nil]; + [gameController showWindow:nil]; + + CGDirectDisplayID display = (CGDirectDisplayID)[[[[gameWindow screen] deviceDescription] objectForKey:@"NSScreenNumber"] longValue]; + if (CGDisplayIsCaptured(display)) { + [gameController setFullscreen:YES]; + } + + return gameController; +} + +- (PluginGLView *)getOpenGLView +{ + return (PluginGLView *)glView; +} + +- (void)dealloc +{ + if (fullWindow) { + [fullWindow orderOut:self]; + [fullWindow autorelease]; + fullWindow = nil; + } + + windowFrame = [[self window] frame]; + + [super dealloc]; +} + +// forget keyDownEvents +- (void)keyDown:(NSEvent *)theEvent +{ + // Not required any more +} + +- (void)mouseDown:(NSEvent *)theEvent +{ + if ([self fullscreen]) { + [self setFullscreen:NO]; + } +} + +- (BOOL)fullscreen +{ + return (fullWindow!=nil); +} + +- (void)setFullscreen:(BOOL)flag +{ + NSWindow *window = [self window]; + NSScreen *screen = [window screen]; + CGDirectDisplayID display = (CGDirectDisplayID)[[[screen deviceDescription] objectForKey:@"NSScreenNumber"] longValue]; + + NSDisableScreenUpdates(); + + if (flag) { + if (!CGDisplayIsCaptured(display)) { + CGDisplayCapture(display); + + CGDisplayCount count = 10; + CGDirectDisplayID displays[10]; + CGGetActiveDisplayList(10, displays, &count); + if (count == 1) { + CGDisplayHideCursor(display); + CGAssociateMouseAndMouseCursorPosition(NO); + } + + //[window orderOut:self]; + } + + int width = CGDisplayPixelsWide(display); + int height = CGDisplayPixelsHigh(display); + + // assume square pixel ratio on the monitor + if ((width*3)/4 < height) { + height = (width*3)/4; + } else { + width = (height*4)/3; + } + + fullWindow = [[NSWindow alloc] initWithContentRect:NSMakeRect((CGDisplayPixelsWide(display)-width)/2, + (CGDisplayPixelsHigh(display)-height)/2, + width, height) + styleMask:NSBorderlessWindowMask + backing:NSBackingStoreRetained + defer:NO + screen:screen]; + + //[[glView openGLContext] setFullScreen]; + [[glView openGLContext] setView:[fullWindow contentView]]; + [glView reshape]; + //[[glView openGLContext] update]; + //[fullWindow setContentView:glView]; + + [fullWindow setBackgroundColor:[NSColor blackColor]]; + [fullWindow setHasShadow:NO]; + [fullWindow setDelegate:self]; + + [fullWindow setLevel:CGShieldingWindowLevel()]; + [fullWindow makeKeyAndOrderFront:self]; + + [[self window] makeKeyAndOrderFront:self]; + } else { + CGDisplayRelease(display); + //CGReleaseAllDisplays(); + + CGAssociateMouseAndMouseCursorPosition(YES); + CGDisplayShowCursor(display); + + if (fullWindow) { + [fullWindow orderOut:self]; + [fullWindow autorelease]; + fullWindow = nil; + + [[glView openGLContext] setView:glView]; + [glView reshape]; + //[window setContentView:glView]; + } + + [[self window] makeKeyAndOrderFront:self]; + } + + NSEnableScreenUpdates(); +} + +- (BOOL)windowShouldZoom:(NSWindow *)sender toFrame:(NSRect)newFrame +{ + [self setFullscreen:YES]; + + return NO; +} + +- (NSSize)windowWillResize:(NSWindow *)sender toSize:(NSSize)proposedFrameSize +{ + if (!(([sender resizeFlags] & NSShiftKeyMask) == NSShiftKeyMask)) { + NSRect oldSize = [sender frame]; + NSRect viewSize = [glView frame]; + + float xDiff = NSWidth(oldSize) - NSWidth(viewSize); + float yDiff = NSHeight(oldSize) - NSHeight(viewSize); + + //if ((proposedFrameSize.height / proposedFrameSize.width) < (3.0/4.0)) + // proposedFrameSize.height = ((proposedFrameSize.width - xDiff) * 3.0) / 4.0 + yDiff; + //else + proposedFrameSize.width = ((proposedFrameSize.height - yDiff) * 4.0) / 3.0 + xDiff; + } + + return proposedFrameSize; +} + +- (void)windowWillMiniaturize:(NSNotification *)aNotification +{ + [[NSNotificationCenter defaultCenter] postNotificationName:@"emuWindowWantPause" object:self]; +} + +- (void)windowDidDeminiaturize:(NSNotification *)aNotification +{ + [[NSNotificationCenter defaultCenter] postNotificationName:@"emuWindowWantResume" object:self]; +} + +//- (void)windowDidBecomeMain:(NSNotification *)aNotification +/*- (void)windowDidBecomeKey:(NSNotification *)aNotification +{ + if (iWindowMode==0) { + [self setFullscreen:YES]; + } +}*/ + +- (BOOL)windowShouldClose:(id)sender +{ + if (fullWindow) { + return NO; + } + [[NSNotificationCenter defaultCenter] postNotificationName:@"emuWindowDidClose" object:self]; + [gameController autorelease]; + gameController = nil; + gameWindow = nil; + + return YES; +} + +@end diff --git a/macosx/plugins/DFXVideo/macsrc/drawgl.m b/macosx/plugins/DFXVideo/macsrc/drawgl.m new file mode 100644 index 0000000..17e7647 --- /dev/null +++ b/macosx/plugins/DFXVideo/macsrc/drawgl.m @@ -0,0 +1,181 @@ +/*************************************************************************** + drawgl.m + PeopsSoftGPU + + Created by Gil Pedersen on Sun April 18 2004. + Copyright (c) 2004 Gil Pedersen. + ***************************************************************************/ + +/*************************************************************************** + * * + * This program 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. See also the license.txt file for * + * additional informations. * + * * + ***************************************************************************/ + +#import "PluginWindowController.h" +#import "PluginGLView.h" +#include "ExtendedKeys.h" +#include "externals.h" +#include "draw.h" +#include "gpu.h" +#include "menu.h" + +//////////////////////////////////////////////////////////////////////////////////// +// misc globals +//////////////////////////////////////////////////////////////////////////////////// + +int iResX; +int iResY; +long lLowerpart; +BOOL bIsFirstFrame = TRUE; +BOOL bCheckMask=FALSE; +unsigned short sSetMask=0; +unsigned long lSetMask=0; +int iDesktopCol=16; +int iShowFPS=0; +int iWinSize; +int iUseScanLines=0; +int iUseNoStretchBlt=0; +int iFastFwd=0; +int iDebugMode=0; +int iFVDisplay=0; +PSXPoint_t ptCursorPoint[8]; +unsigned short usCursorActive=0; +char * Xpixels; +char * pCaptionText; + +//static PluginWindowController *windowController; +static PluginGLView *glView; + +//////////////////////////////////////////////////////////////////////// + +void DoBufferSwap(void) // SWAP BUFFERS +{ +#if 1 + [glView swapBuffer]; +#else + static long long lastTickCount = -1; + static int skipCount = 0; + long long microTickCount; + long deltaTime; + + Microseconds((struct UnsignedWide *)µTickCount); + deltaTime = (long)(microTickCount - lastTickCount); + if (deltaTime <= (PSXDisplay.PAL ? 1000000/50 : 100000000 / 5994) || + skipCount >= 3) { + skipCount = 0; + [glView swapBuffer]; + } else { + skipCount++; + } + NSLog(@"count: %i", deltaTime); + lastTickCount = microTickCount; +#endif +} + + +//////////////////////////////////////////////////////////////////////// + +void DoClearScreenBuffer(void) // CLEAR DX BUFFER +{ + // clear the screen, and DON'T flush it + [glView clearBuffer:NO]; +} + + +//////////////////////////////////////////////////////////////////////// + +void DoClearFrontBuffer(void) // CLEAR DX BUFFER +{ + // clear the screen, and flush it + [glView clearBuffer:YES]; +} + +//////////////////////////////////////////////////////////////////////// + +unsigned long ulInitDisplay(void) // OPEN GAME WINDOW +{ + bUsingTWin=FALSE; + + InitMenu(); + + bIsFirstFrame = FALSE; + + if(iShowFPS) + { + //iShowFPS=0; + ulKeybits|=KEY_SHOWFPS; + szDispBuf[0]=0; + BuildDispMenu(0); + } + + PluginWindowController *windowController = [PluginWindowController openGameView]; + glView = [windowController getOpenGLView]; + + [[windowController window] setTitle:[NSString stringWithCString:pCaptionText]]; + + return (unsigned long)[windowController window]; +} + + +//////////////////////////////////////////////////////////////////////// + +void CloseDisplay(void) +{ + if (gameController) { + [gameController close]; + [gameController release]; + gameController = nil; + gameWindow = nil; + } +} + + +//////////////////////////////////////////////////////////////////////// + +void CreatePic(unsigned char * pMem) +{ +} + + +/////////////////////////////////////////////////////////////////////////////////////// + +void DestroyPic(void) +{ +} + + +/////////////////////////////////////////////////////////////////////////////////////// + +void DisplayPic(void) +{ +} + + +/////////////////////////////////////////////////////////////////////////////////////// + +void ShowGpuPic(void) +{ + // this is the default implementation... +} + +/////////////////////////////////////////////////////////////////////////////////////// + +void ShowTextGpuPic(void) +{ + // this is the default implementation... +} + + +void HandleKey(int keycode) +{ + switch (keycode) { + case GPU_FULLSCREEN_KEY: + [gameController setFullscreen:![gameController fullscreen]]; + break; + } +} -- cgit v1.2.3