Merge branch 'master' into medusa

This commit is contained in:
Vicki Pfau 2017-04-26 12:19:58 -07:00
commit cdf46fb987
6 changed files with 301 additions and 247 deletions

View File

@ -14,6 +14,8 @@ CXX_GUARD_START
#include <sys/time.h>
#if defined(__FreeBSD__) || defined(__OpenBSD__)
#include <pthread_np.h>
#elif defined(__HAIKU__)
#include <OS.h>
#endif
#define THREAD_ENTRY void*
@ -88,6 +90,9 @@ static inline int ThreadSetName(const char* name) {
#elif defined(__FreeBSD__) || defined(__OpenBSD__)
pthread_set_name_np(pthread_self(), name);
return 0;
#elif defined(__HAIKU__)
rename_thread(find_thread(NULL), name);
return 0;
#elif !defined(BUILD_PANDORA) // Pandora's glibc is too old
return pthread_setname_np(pthread_self(), name);
#else

View File

@ -0,0 +1,34 @@
varying vec2 texCoord;
uniform sampler2D tex;
uniform vec2 texSize;
uniform float darken_screen;
const float target_gamma = 2.2;
const float display_gamma = 2.5;
const float sat = 1.0;
const float lum = 0.99;
const float contrast = 1.0;
const vec3 bl = vec3(0.0, 0.0, 0.0);
const vec3 r = vec3(0.84, 0.09, 0.15);
const vec3 g = vec3(0.18, 0.67, 0.10);
const vec3 b = vec3(0.0, 0.26, 0.73);
void main() {
vec4 screen = pow(texture2D(tex, texCoord), vec4(target_gamma + darken_screen)).rgba;
vec4 avglum = vec4(0.5);
screen = mix(screen, avglum, (1.0 - contrast));
mat4 color = mat4( r.r, r.g, r.b, 0.0,
g.r, g.g, g.b, 0.0,
b.r, b.g, b.b, 0.0,
bl.r, bl.g, bl.b, 1.0);
mat4 adjust = mat4( (1.0 - sat) * 0.3086 + sat, (1.0 - sat) * 0.3086, (1.0 - sat) * 0.3086, 1.0,
(1.0 - sat) * 0.6094, (1.0 - sat) * 0.6094 + sat, (1.0 - sat) * 0.6094, 1.0,
(1.0 - sat) * 0.0820, (1.0 - sat) * 0.0820, (1.0 - sat) * 0.0820 + sat, 1.0,
0.0, 0.0, 0.0, 1.0);
color *= adjust;
screen = clamp(screen * lum, 0.0, 1.0);
screen = color * screen;
gl_FragColor = pow(screen, vec4(1.0 / display_gamma + (darken_screen * 0.125)));
}

View File

@ -0,0 +1,14 @@
[shader]
name=GBA Color
author=Pokefan531 and hunterk
description=Modifies the color output to simulate the GBA LCD characteristics.
passes=1
[pass.0]
fragmentShader=gba-color.fs
blend=1
[pass.0.uniform.darken_screen]
type=float
default=0.5
readableName=Darken Screen

File diff suppressed because it is too large Load Diff

View File

@ -147,7 +147,7 @@ const char* _vdeName(struct VDirEntry* vde) {
static enum VFSType _vdeType(struct VDirEntry* vde) {
struct VDirEntryDE* vdede = (struct VDirEntryDE*) vde;
#ifndef WIN32
#if !defined(WIN32) && !defined(__HAIKU__)
if (vdede->ent->d_type == DT_DIR) {
return VFS_DIRECTORY;
}

View File

@ -166,7 +166,11 @@ static bool _vfdSync(struct VFile* vf, const void* buffer, size_t size) {
UNUSED(size);
struct VFileFD* vfd = (struct VFileFD*) vf;
#ifndef _WIN32
#ifdef __HAIKU__
futimens(vfd->fd, NULL);
#else
futimes(vfd->fd, NULL);
#endif
if (buffer && size) {
return msync(buffer, size, MS_SYNC) == 0;
}