summaryrefslogtreecommitdiff
path: root/macosx/plugins/DFXVideo/macsrc
diff options
context:
space:
mode:
authorSND\MaddTheSane_cp <SND\MaddTheSane_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2013-10-23 21:38:13 +0000
committerSND\MaddTheSane_cp <SND\MaddTheSane_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2013-10-23 21:38:13 +0000
commit0a342e0492ee88b43f63ec3e3a17c463fad2bf09 (patch)
tree506a58f4bc50634b2fb481786b2c963007901b8e /macosx/plugins/DFXVideo/macsrc
parent0696bb38928d6652bc232055cd413579b352cc35 (diff)
downloadpcsxr-0a342e0492ee88b43f63ec3e3a17c463fad2bf09.tar.gz
Implement window size setting for PeopsSoftGL on OS X.
git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@87642 e17a0e51-4ae3-4d35-97c3-1a29b211df97
Diffstat (limited to 'macosx/plugins/DFXVideo/macsrc')
-rwxr-xr-xmacosx/plugins/DFXVideo/macsrc/PluginConfigController.h2
-rwxr-xr-xmacosx/plugins/DFXVideo/macsrc/PluginConfigController.m41
-rwxr-xr-xmacosx/plugins/DFXVideo/macsrc/PluginGLView.m34
-rwxr-xr-xmacosx/plugins/DFXVideo/macsrc/PluginWindow.h3
-rwxr-xr-xmacosx/plugins/DFXVideo/macsrc/PluginWindowController.h9
-rwxr-xr-xmacosx/plugins/DFXVideo/macsrc/PluginWindowController.m4
6 files changed, 44 insertions, 49 deletions
diff --git a/macosx/plugins/DFXVideo/macsrc/PluginConfigController.h b/macosx/plugins/DFXVideo/macsrc/PluginConfigController.h
index e5b3aac0..ea8e10ff 100755
--- a/macosx/plugins/DFXVideo/macsrc/PluginConfigController.h
+++ b/macosx/plugins/DFXVideo/macsrc/PluginConfigController.h
@@ -30,6 +30,8 @@
@property (strong) NSURL *vertexPath;
@property (strong) NSURL *fragmentPath;
+@property (weak) IBOutlet NSFormCell *displayWidth;
+@property (weak) IBOutlet NSFormCell *displayHeight;
- (IBAction)cancel:(id)sender;
- (IBAction)ok:(id)sender;
diff --git a/macosx/plugins/DFXVideo/macsrc/PluginConfigController.m b/macosx/plugins/DFXVideo/macsrc/PluginConfigController.m
index 53cf1230..f7982d36 100755
--- a/macosx/plugins/DFXVideo/macsrc/PluginConfigController.m
+++ b/macosx/plugins/DFXVideo/macsrc/PluginConfigController.m
@@ -42,6 +42,8 @@ __private_extern__ char* PLUGLOC(char* toloc);
static PluginConfigController *windowController = nil;
+#define kWindowSize @"Window Size"
+
void AboutDlgProc()
{
// Get parent application instance
@@ -136,10 +138,28 @@ void ReadConfig(void)
@"VertexShader": [[selfBundle URLForResource:@"gpuPeteOGL2" withExtension:@"slv"] bookmarkDataWithOptions:NSURLBookmarkCreationPreferFileIDResolution includingResourceValuesForKeys:nil relativeToURL:nil error:nil],
@"FragmentShader": [[selfBundle URLForResource:@"gpuPeteOGL2" withExtension:@"slf"] bookmarkDataWithOptions:NSURLBookmarkCreationPreferFileIDResolution includingResourceValuesForKeys:nil relativeToURL:nil error:nil],
@"UseShader": @NO,
- @"ShaderQuality": @4}}];
+ @"ShaderQuality": @4,
+ kWindowSize: NSStringFromSize(NSMakeSize(640, 480))}}];
keyValues = [defaults dictionaryForKey:PrefsKey];
-
+ BOOL windowSizeNeedsReset = NO;
+ if (keyValues) {
+ NSSize size = NSSizeFromString(keyValues[kWindowSize]);
+ if (!keyValues[kWindowSize]) {
+ windowSizeNeedsReset = YES;
+ } else if ([keyValues[kWindowSize] isKindOfClass:[NSNumber class]]) {
+ windowSizeNeedsReset = YES;
+ } else if (size.height == 0 || size.width == 0) {
+ windowSizeNeedsReset = YES;
+ }
+ }
+ if (windowSizeNeedsReset) {
+ NSMutableDictionary *tmpDict = [[NSMutableDictionary alloc] initWithDictionary:keyValues];
+ tmpDict[kWindowSize] = NSStringFromSize(NSMakeSize(640, 480));
+ [defaults setObject:tmpDict forKey:PrefsKey];
+ [defaults synchronize];
+ }
+
iShowFPS = [keyValues[@"FPS Counter"] boolValue];
iWindowMode = [keyValues[@"Auto Full Screen"] boolValue] ? 0 : 1;
UseFrameSkip = [keyValues[@"Frame Skipping"] boolValue];
@@ -150,8 +170,10 @@ void ReadConfig(void)
iUseDither = [keyValues[@"Dither Mode"] intValue];
dwCfgFixes = [keyValues[@"Hacks"] unsignedIntValue];
- iResX = 640;
- iResY = 480;
+ NSSize windowSize = NSSizeFromString(keyValues[kWindowSize]);
+
+ iResX = windowSize.width;
+ iResY = windowSize.height;
iUseNoStretchBlt = 1;
fFrameRate = 60;
@@ -163,7 +185,8 @@ void ReadConfig(void)
ulKeybits &= ~KEY_SHOWFPS;
// additional checks
- if(!iColDepth) iColDepth = 32;
+ if(!iColDepth)
+ iColDepth = 32;
if(iUseFixes) {
dwActFixes = dwCfgFixes;
} else {
@@ -171,7 +194,8 @@ void ReadConfig(void)
}
SetFixes();
- if(iFrameLimit == 2) SetAutoFrameCap();
+ if(iFrameLimit == 2)
+ SetAutoFrameCap();
bSkipNextFrame = FALSE;
szDispBuf[0] = 0;
@@ -212,6 +236,7 @@ void ReadConfig(void)
writeDic[@"VertexShader"] = [vertexPath bookmarkDataWithOptions:NSURLBookmarkCreationPreferFileIDResolution includingResourceValuesForKeys:nil relativeToURL:nil error:nil];
writeDic[@"FragmentShader"] = [fragmentPath bookmarkDataWithOptions:NSURLBookmarkCreationPreferFileIDResolution includingResourceValuesForKeys:nil relativeToURL:nil error:nil];
+ writeDic[kWindowSize] = NSStringFromSize(NSMakeSize(self.displayWidth.integerValue, self.displayHeight.integerValue));
// write to defaults
[defaults setObject:writeDic forKey:PrefsKey];
@@ -295,6 +320,7 @@ void ReadConfig(void)
- (void)loadValues
{
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
+ NSSize theSize;
ReadConfig();
@@ -332,6 +358,9 @@ void ReadConfig(void)
for (NSCell *control in [hacksMatrix cells]) {
[control setIntValue:(hackValues >> ([control tag] - 1)) & 1];
}
+ theSize = NSSizeFromString(keyValues[kWindowSize]);
+ [self.displayWidth setIntegerValue:theSize.width];
+ [self.displayHeight setIntegerValue:theSize.height];
[self hackToggle:hackEnable];
[self toggleShader:shaders];
diff --git a/macosx/plugins/DFXVideo/macsrc/PluginGLView.m b/macosx/plugins/DFXVideo/macsrc/PluginGLView.m
index fee2eb54..09375671 100755
--- a/macosx/plugins/DFXVideo/macsrc/PluginGLView.m
+++ b/macosx/plugins/DFXVideo/macsrc/PluginGLView.m
@@ -309,15 +309,6 @@ void BlitScreen16NS(unsigned char * surf,long x,long y)
// Make this context current
[[self openGLContext] makeCurrentContext];
- // Loads the shaders
- //shader=LoadShader(GL_VERTEX_SHADER,"/Users/alexandremathieu/vertex.c");
- //program=glCreateProgram();
- //glAttachShader(program, shader);
- //glLinkProgram(program);
- //if(program == 0){
- // printf("Program invalide bourdel\n");
- //}
-
if (PSXDisplay.Disabled) {
glClear(GL_COLOR_BUFFER_BIT);
} else {
@@ -735,31 +726,6 @@ void BlitScreen16NS(unsigned char * surf,long x,long y)
// [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;
-}*/
- (GLuint)loadShader:(GLenum)type location:(NSURL*)filename
{
diff --git a/macosx/plugins/DFXVideo/macsrc/PluginWindow.h b/macosx/plugins/DFXVideo/macsrc/PluginWindow.h
index 38a8dfa1..017579b2 100755
--- a/macosx/plugins/DFXVideo/macsrc/PluginWindow.h
+++ b/macosx/plugins/DFXVideo/macsrc/PluginWindow.h
@@ -19,6 +19,5 @@
#import <Cocoa/Cocoa.h>
@interface NetSfPeopsSoftGPUPluginWindow : NSWindow
-{
-}
+
@end
diff --git a/macosx/plugins/DFXVideo/macsrc/PluginWindowController.h b/macosx/plugins/DFXVideo/macsrc/PluginWindowController.h
index b8eccf4a..f149eb55 100755
--- a/macosx/plugins/DFXVideo/macsrc/PluginWindowController.h
+++ b/macosx/plugins/DFXVideo/macsrc/PluginWindowController.h
@@ -28,14 +28,13 @@ extern PluginWindowController *gameController;
@interface PluginWindowController : NSWindowController <NSWindowDelegate>
{
- IBOutlet NSOpenGLView *glView;
-
- NSWindow *fullWindow;
+ IBOutlet NSOpenGLView *glView;
+
+ NSWindow *fullWindow;
}
+@property BOOL fullscreen;
+ (id)openGameView;
- (PluginGLView *)openGLView;
-- (BOOL)fullscreen;
-- (void)setFullscreen:(BOOL)flag;
@end
diff --git a/macosx/plugins/DFXVideo/macsrc/PluginWindowController.m b/macosx/plugins/DFXVideo/macsrc/PluginWindowController.m
index 0ad6dd74..f0b45280 100755
--- a/macosx/plugins/DFXVideo/macsrc/PluginWindowController.m
+++ b/macosx/plugins/DFXVideo/macsrc/PluginWindowController.m
@@ -35,12 +35,12 @@ NSRect windowFrame;
}
gameWindow = [gameController window];
}
+ windowFrame = NSMakeRect(0, 0, iResX + 8, iResY + 4);
if (windowFrame.size.width != 0) {
[gameWindow setFrame:windowFrame display:NO];
- } else {
- [gameWindow center];
}
+ [gameWindow center];
[gameWindow makeKeyAndOrderFront:nil];
[gameController showWindow:nil];