ZSNES on Intel Mac, further progress
Moderator: ZSNES Mods
-
- ZSNES Developer
- Posts: 6747
- Joined: Tue Dec 28, 2004 6:47 am
-
- Rookie
- Posts: 11
- Joined: Mon Jun 19, 2006 10:05 am
would someone be so kind as to compile and post the latest working osx zsnes binary? that last one which was posted did not work.
EDIT: Nevermind, I just realized that by "xcode project" hector chu meant to get the zsnes osx binary from his site... wow, this runs SO MUCH quicker than bsnes.. great job guys!
EDIT: Nevermind, I just realized that by "xcode project" hector chu meant to get the zsnes osx binary from his site... wow, this runs SO MUCH quicker than bsnes.. great job guys!
-
- Rookie
- Posts: 11
- Joined: Mon Jun 19, 2006 10:05 am
Hey polyh3dron, great to see it working on your end and that you're having fun. The secondary display option seems to be much requested but I don't have any idea what code would be required - I'm quite new to Mac development and I'm not very familiar with ZSNES' code. It might be possible through SDL. I think that if it was implemented on the Windows/Linux side, that it would be automatically available on the Mac.
-
- ZSNES Developer
- Posts: 3904
- Joined: Tue Jul 27, 2004 10:54 pm
- Location: Solar powered park bench
- Contact:
Can someone tell me how latest SVN is working?
It should detect OGL now, and I commited most of hector's patches with some bug fixes on top of that which I hope work.
It should detect OGL now, and I commited most of hector's patches with some bug fixes on top of that which I hope work.
May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it.
_____________
Insane Coding
_____________
Insane Coding
Hi Nach, looked over the commits. I don't think the OpenGL library can be found through AC_CHECK_LIB as the library file lies within the OpenGL.framework. When linking with OpenGL you need the -framework OpenGL flag. This is what I meant when I said that fitting Mac OS X OpenGL support into the configure.in was kind of messy. I think that we should assume that Mac OS X has the OpenGL.framework (as it comes with it), and skip the AC_CHECK_LIB for OpenGL. Then add -D__OPENGL__ to CFLAGS, NFLAGS and PSRFLAGS and add -framework OpenGL to LDFLAGS. Also need to add GL_DRAW="\$(WINDIR)/gl_draw.o" as well.
I forgot to mention that I had tried the combination SDL_DOUBLEBUF | SDL_HWSURFACE with no luck, just a black screen again in fullscreen 640x480, and the filters not working properly in the fullscreen modes that do work. Another thing is that double buffering doesn't seem to be supported on the Mac. I get some screen tearing due to the video not being in vsync.
I forgot to mention that I had tried the combination SDL_DOUBLEBUF | SDL_HWSURFACE with no luck, just a black screen again in fullscreen 640x480, and the filters not working properly in the fullscreen modes that do work. Another thing is that double buffering doesn't seem to be supported on the Mac. I get some screen tearing due to the video not being in vsync.
-
- ZSNES Developer
- Posts: 3904
- Joined: Tue Jul 27, 2004 10:54 pm
- Location: Solar powered park bench
- Contact:
Okay, I believe I fixed it, let me know.
May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it.
_____________
Insane Coding
_____________
Insane Coding
-
- Rookie
- Posts: 11
- Joined: Mon Jun 19, 2006 10:05 am
-
- ZSNES Developer
- Posts: 6747
- Joined: Tue Dec 28, 2004 6:47 am
SDL port does not have a vsync option at all... Here's a thread that might be helpful in explaining it...
http://board.zsnes.com/phpBB2/viewtopic ... =sdl+vsync
http://board.zsnes.com/phpBB2/viewtopic ... =sdl+vsync
Continuing [url=http://slickproductions.org/forum/index.php?board=13.0]FF4[/url] Research...
Hi polyh3dron, unfortunately for now I don't think double buffering is working so as you've found we're going out of vsync and getting tearing. I will have a look at this later.
Nach, your changes were very good. Just one small thing, currently the test deciding whether to run the OpenGL check is:
Unfortunately the != operator tests for an exact string match, so this will evaluate to true even on Mac. So, since we've already decided we've found OpenGL on darwin, we can change the test to:
So, if we're on Darwin the left hand side evaluates to xyes, so the test will be false. If we're not on Darwin, the left hand side is just x, so the test will be true and the OpenGL detection will proceed as expected.
Now, things are almost perfect. One more patch that I would like to see go in is:
The SDL_thread.h header can be removed because sdllink.c includes gblhdr.h, which includes sdl.h. sdl.h already includes SDL_thread.h. This would be nice to get in as it would reduce my current patchset to just gblhdr.h.
Nach, your changes were very good. Just one small thing, currently the test deciding whether to run the OpenGL check is:
Code: Select all
if test x$target != *-*-darwin*; then
Code: Select all
if test x$found_opengl != xyes; then
Now, things are almost perfect. One more patch that I would like to see go in is:
Code: Select all
Index: linux/sdllink.c
===================================================================
--- linux/sdllink.c (revision 3305)
+++ linux/sdllink.c (working copy)
@@ -22,8 +22,6 @@
#include "sw_draw.h"
#include "gl_draw.h"
-#include <SDL_thread.h>
-
#include <sys/time.h>
#include <time.h>
#include <dirent.h>
A possible fix for getting Vsync working in OpenGL is:
I will test this when I get home.
Helpful link: http://lists.trolltech.com/qt-interest/ ... 311-0.html
Code: Select all
GLint swapInt = 1;
aglSetInteger(aglContext, AGL_SWAP_INTERVAL, &swapInt);
Helpful link: http://lists.trolltech.com/qt-interest/ ... 311-0.html
Last edited by hector on Tue Jun 20, 2006 5:02 pm, edited 1 time in total.
-
- ZSNES Developer
- Posts: 3904
- Joined: Tue Jul 27, 2004 10:54 pm
- Location: Solar powered park bench
- Contact:
Okay great.
Thanks for all your help hector, and you too BRPXQZME, couldn't have done it without you guys.
Thanks for all your help hector, and you too BRPXQZME, couldn't have done it without you guys.
May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it.
_____________
Insane Coding
_____________
Insane Coding
That's ok for AGL framework for Carbon.hector wrote:A possible fix for getting Vsync working in OpenGL is:I will test this when I get home.Code: Select all
GLint swapInt = 1; aglSetInteger(aglContext, AGL_SWAP_INTERVAL, &swapInt);
For Windows, at least, you can check the extensions list (glGetString(GL_EXTENSIONS)) for "WGL_EXT_swap_control", then retrieve its function pointer with wglGetProcAddress( "wglSwapIntervalEXT" ). The function pointer should be declared as APIENTRY, with a single int parameter.
There's an equivalent glXGetProcAddress and XGL_EXT_swap_control under Linux, but it seems NVidia implements it while ATI doesn't. Hmm...
There's also a library to simplify handling extensions, but that's probably a little overboard just for one extension.
There's an equivalent glXGetProcAddress and XGL_EXT_swap_control under Linux, but it seems NVidia implements it while ATI doesn't. Hmm...
There's also a library to simplify handling extensions, but that's probably a little overboard just for one extension.
Code: Select all
Index: linux/gl_draw.c
===================================================================
--- linux/gl_draw.c (revision 3313)
+++ linux/gl_draw.c (working copy)
@@ -80,6 +80,7 @@
}
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
+ SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, 1);
glvidbuffer = (unsigned short *) malloc(512 * 512 * sizeof(short));
gl_clearwin();
-
- ZSNES Developer
- Posts: 3904
- Joined: Tue Jul 27, 2004 10:54 pm
- Location: Solar powered park bench
- Contact:
Well, I like the idea, but what about people not using 1.2.10?hector wrote:Makes Vsync work under Mac OS X. According to http://www.libsdl.org/release/changes.html , this new flag was added only recently. I think that this should also make Vsync work under Linux wherever it doesn't work. Anyway since it's such a small change and won't likely impact anything I think it should be submitted straight away.Code: Select all
Index: linux/gl_draw.c =================================================================== --- linux/gl_draw.c (revision 3313) +++ linux/gl_draw.c (working copy) @@ -80,6 +80,7 @@ } SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); + SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, 1); glvidbuffer = (unsigned short *) malloc(512 * 512 * sizeof(short)); gl_clearwin();
May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it.
_____________
Insane Coding
_____________
Insane Coding
This is a tough question. On the one hand, we should take advantage of features available in newer SDL versions, but at the same time we should avoid breaking people's builds because they haven't upgraded their SDL yet. One course of action would be to force everyone to use 1.2.10, and see what people's complaints are if any. Otherwise it could be a long time before this kind of change will be able to be submitted.
There are only about 8 active Zsnes developers, so I wonder what SDL version they are using. If they are all using the latest SDL anyway, then there really isn't any problem.
If you do decide to submit my change, then remember to change the minimum required SDL version in configure.in to 1.2.10.
There are only about 8 active Zsnes developers, so I wonder what SDL version they are using. If they are all using the latest SDL anyway, then there really isn't any problem.
If you do decide to submit my change, then remember to change the minimum required SDL version in configure.in to 1.2.10.
-
- ZSNES Developer
- Posts: 3904
- Joined: Tue Jul 27, 2004 10:54 pm
- Location: Solar powered park bench
- Contact:
Thank you peanut gallery.
May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it.
_____________
Insane Coding
_____________
Insane Coding