Update to v094r25 release.

byuu says:

Windows port should run mostly well now, although exiting fullscreen
breaks the application in a really bizarre way. (clicking on the window
makes it sink to background rather than come to the foreground o_O)

I also need to add the doModalChange => audio.clear() thing for the
accursed menu stuttering with DirectSound.

I also finished porting all of the ruby drivers over to the newer API
changes from nall.

Since I can't compile the Linux or OS X drivers, I have no idea if there
are any typos that will result in compilation errors. If so, please let
me know where they're at and I'll try and fix them. If they're simple,
please try and fix them on your end to test further if you can.

I'm hopeful the udev crash will be gone now that nall::string checks for
null char* values passed to its stringify function. Of course, it's
a problem it's getting a null value in the first place, so it may not
work at all.

If you can compile on Linux (or by some miracle, OS X), please test each
video/audio/input driver if you don't mind, to make sure there's no
"compiles okay but still typos exist" bugs.
This commit is contained in:
Tim Allen
2015-06-16 08:16:43 +10:00
parent f0c17ffc0d
commit bb3c69a30d
75 changed files with 1017 additions and 906 deletions

View File

@@ -1,7 +1,7 @@
#include "opengl/opengl.hpp"
namespace ruby {
class pVideoCGL;
struct pVideoCGL;
}
@interface RubyVideoCGL : NSOpenGLView {
@@ -20,11 +20,15 @@ struct pVideoCGL : OpenGL {
struct {
NSView* handle = nullptr;
bool synchronize = false;
unsigned filter = 0;
unsigned filter = Video::FilterNearest;
string shader;
} settings;
bool cap(const string& name) {
~pVideoCGL() {
term();
}
auto cap(const string& name) -> bool {
if(name == Video::Handle) return true;
if(name == Video::Synchronize) return true;
if(name == Video::Filter) return true;
@@ -32,22 +36,22 @@ struct pVideoCGL : OpenGL {
return false;
}
any get(const string& name) {
auto get(const string& name) -> any {
if(name == Video::Handle) return (uintptr_t)settings.handle;
if(name == Video::Synchronize) return settings.synchronize;
if(name == Video::Filter) return settings.filter;
return false;
return {};
}
bool set(const string& name, const any& value) {
if(name == Video::Handle) {
settings.handle = (NSView*)any_cast<uintptr_t>(value);
auto set(const string& name, const any& value) -> bool {
if(name == Video::Handle && value.is<uintptr_t>()) {
settings.handle = (NSView*)value.get<uintptr_t>();
return true;
}
if(name == Video::Synchronize) {
if(settings.synchronize != any_cast<bool>(value)) {
settings.synchronize = any_cast<bool>(value);
if(name == Video::Synchronize && value.is<bool>()) {
if(settings.synchronize != value.get<bool>()) {
settings.synchronize = value.get<bool>();
if(view) {
@autoreleasepool {
@@ -60,34 +64,34 @@ struct pVideoCGL : OpenGL {
return true;
}
if(name == Video::Filter) {
settings.filter = any_cast<unsigned>(value);
if(settings.shader.empty()) OpenGL::filter = settings.filter ? GL_LINEAR : GL_NEAREST;
if(name == Video::Filter && value.is<unsigned>()) {
settings.filter = value.get<unsigned>();
if(!settings.shader) OpenGL::filter = settings.filter ? GL_LINEAR : GL_NEAREST;
return true;
}
if(name == Video::Shader) {
settings.shader = any_cast<const char*>(value);
if(name == Video::Shader && value.is<string>()) {
settings.shader = value.get<string>();
@autoreleasepool {
[[view openGLContext] makeCurrentContext];
}
OpenGL::shader(settings.shader);
if(settings.shader.empty()) OpenGL::filter = settings.filter ? GL_LINEAR : GL_NEAREST;
if(!settings.shader) OpenGL::filter = settings.filter ? GL_LINEAR : GL_NEAREST;
return true;
}
return false;
}
bool lock(uint32_t*& data, unsigned& pitch, unsigned width, unsigned height) {
auto lock(uint32_t*& data, unsigned& pitch, unsigned width, unsigned height) -> bool {
OpenGL::size(width, height);
return OpenGL::lock(data, pitch);
}
void unlock() {
auto unlock() -> void {
}
void clear() {
auto clear() -> void {
@autoreleasepool {
[view lockFocus];
OpenGL::clear();
@@ -96,7 +100,7 @@ struct pVideoCGL : OpenGL {
}
}
void refresh() {
auto refresh() -> void {
@autoreleasepool {
if([view lockFocusIfCanDraw]) {
auto area = [view frame];
@@ -108,7 +112,7 @@ struct pVideoCGL : OpenGL {
}
}
bool init() {
auto init() -> bool {
term();
@autoreleasepool {
@@ -146,7 +150,7 @@ struct pVideoCGL : OpenGL {
return true;
}
void term() {
auto term() -> void {
OpenGL::term();
@autoreleasepool {
@@ -155,10 +159,6 @@ struct pVideoCGL : OpenGL {
view = nil;
}
}
~pVideoCGL() {
term();
}
};
DeclareVideo(CGL)