Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates from upstream #32

Merged
merged 39 commits into from
Jan 27, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
a38beac
Qt: Customizable paths for save games, save states, screenshots and p…
endrift Jan 15, 2016
c83e4e7
Qt: Added button for breaking into the GDB debugger
endrift Jan 16, 2016
7cf067a
OpenGL: Add simple desaturation filter to default shader
endrift Jan 16, 2016
c62ff00
OpenGL: Make all buffers expected to be the right width
endrift Jan 16, 2016
1dceadb
OpenGL: Remove lingering reference to glPixelStorei
endrift Jan 16, 2016
7e6f9f2
ARM7: Fix typo that invoked undefined behavior
endrift Jan 16, 2016
3fef28d
Qt: Fix remaining write to drawContext
endrift Jan 16, 2016
db6113d
Qt: Fix build with libepoxy and old versions of Qt5
endrift Jan 16, 2016
ce45f6e
Debugger: Further differentiate read and write watchpoints, fix gdb w…
endrift Jan 16, 2016
c18b9c3
Qt: Allow use of OpenGL ES 2
endrift Jan 17, 2016
05c3159
OpenGL: Attempt to fix OpenGL ES 2 rendering
endrift Jan 17, 2016
6bc609b
Qt: Fix GBAKeyEditor focus issues
endrift Jan 18, 2016
f6590de
Qt: Fix even more potential cases of the GBAKeyEditor dangling
endrift Jan 18, 2016
13dfb14
SDL: Hotplugging for joysticks. Still needs work.
endrift Jan 18, 2016
17d3436
Qt: Fix some focus crashes
endrift Jan 19, 2016
44d1dd7
GBA Context: Fix reloading directories
endrift Jan 19, 2016
0a91041
Qt: Fix window background
endrift Jan 19, 2016
6e7851f
Qt: Attempt to reduce logging overhead
endrift Jan 21, 2016
60b4a49
Qt: Pause instead of interrupting when opening a file dialog, as the …
endrift Jan 23, 2016
eaa81cb
3DS: Fix APT usage (fixes #210)
endrift Jan 23, 2016
d6bccd8
Util: Fix MutexTryLock on Windows
endrift Jan 23, 2016
380f6db
OpenGL: Add integer scaling forcing and a pixelate filter
endrift Jan 23, 2016
b5c813e
Vita: Update to latest SDK version
xerpi Jan 23, 2016
c5f4b6e
Shaders: Add xBR lv3 shader by Hyllian
endrift Jan 23, 2016
d07da07
Shaders: Minor xBR fixes
endrift Jan 23, 2016
3d996ca
Shaders: Hand-convert xBR shader to GLSL
endrift Jan 23, 2016
6fe43d1
GBA BIOS: Finish implementing RegisterRamReset
endrift Jan 24, 2016
3a134fc
GBA: Allow jumping to OAM and palette RAM
endrift Jan 24, 2016
181174c
Qt: Fix keys being mapped incorrectly when loading configuration file…
endrift Jan 24, 2016
e5f2dcb
Shaders: Use uniforms for xBR parameters
endrift Jan 24, 2016
bee854b
Platform: Dirmode is dead
endrift Jan 24, 2016
b2850af
Merge pull request #211 from xerpi/master
endrift Jan 24, 2016
15dadb8
GBA Cheats: Fix cheats setting the Action Replay version
endrift Jan 24, 2016
a53c3e0
OpenEmu: Cheat support
endrift Jan 24, 2016
e436f2a
GBA Cheats: Add GBACheatDeviceClear
endrift Jan 25, 2016
26e9e8d
GBA Cheats: Remove trailing newline
endrift Jan 25, 2016
0501944
GBA: Savestates can store currently used cheats
endrift Jan 25, 2016
6d8a34a
Qt: Unify state saving/loading flags
endrift Jan 25, 2016
5b61a50
Updates from upstream.
sergiobenrocha2 Jan 26, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ Features:
- Implemented cycle counting for sprite rendering
- Cleaner, unified settings window
- Added a setting for pausing when the emulator is not in focus
- Customizable paths for save games, save states, screenshots and patches
- Controller hotplugging
Bugfixes:
- Util: Fix PowerPC PNG read/write pixel order
- VFS: Fix VFileReadline and remove _vfdReadline
Expand All @@ -32,6 +34,8 @@ Bugfixes:
- Qt: Fix some potential crashes with the gamepad mapping
- Debugger: Fix watchpoints in gdb
- ARM7: Fix decoding of some ARM ALU instructions with shifters
- Qt: Fix keys being mapped incorrectly when loading configuration file
- GBA Cheats: Fix cheats setting the Action Replay version
Misc:
- Qt: Window size command line options are now supported
- Qt: Increase usability of key mapper
Expand Down Expand Up @@ -60,6 +64,9 @@ Misc:
- GBA RR: Add support for resets in movies
- GBA Input: Consolidate GBA_KEY_NONE and GBA_NO_MAPPING
- Debugger: Convert breakpoints and watchpoints from linked-lists to vectors
- Qt: Added button for breaking into the GDB debugger
- GBA BIOS: Finish implementing RegisterRamReset
- GBA: Allow jumping to OAM and palette RAM

0.3.2: (2015-12-16)
Bugfixes:
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ Footnotes

- OBJ window for modes 3, 4 and 5 ([Bug #5](http://mgba.io/b/5))
- Mosaic for transformed OBJs ([Bug #9](http://mgba.io/b/9))
- BIOS call RegisterRamReset is partially stubbed out ([Bug #141](http://mgba.io/b/141))

<a name="flashdetect">[2]</a> Flash memory size detection does not work in some cases. These can be configured at runtime, but filing a bug is recommended if such a case is encountered.

Expand Down
9 changes: 9 additions & 0 deletions res/shaders/pixelate.shader/manifest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[shader]
name=Pixelate
author=endrift
description=Only scale up the screen at an integer ratio
passes=1

[pass.0]
blend=1
integerScaling=1
38 changes: 38 additions & 0 deletions res/shaders/xbr.shader/manifest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
[shader]
name=xBR
author=Hyllian
description=xBR upsampling filter
passes=1

[pass.0]
integerScaling=1
vertexShader=xbr.vs
fragmentShader=xbr.fs

[pass.0.uniform.XBR_Y_WEIGHT]
type=float
default=48
readableName=Y Weight
min=0
max=100

[pass.0.uniform.XBR_EQ_THRESHOLD]
type=float
readableName=Eq Threshold
default=10.0
min=0.0
max=50.0

[pass.0.uniform.XBR_EQ_THRESHOLD2]
type=float
readableName=Eq Threshold2
default=2.0
min=0.0
max=4.0

[pass.0.uniform.XBR_LV2_COEFFICIENT]
type=float
readableName=Lv2 Coefficient
default=2.0
min=1.0
max=3.0
251 changes: 251 additions & 0 deletions res/shaders/xbr.shader/xbr.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,251 @@
/*
Hyllian's xBR-lv3 Shader

Copyright (C) 2011-2015 Hyllian - [email protected]

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.


Incorporates some of the ideas from SABR shader. Thanks to Joshua Street.
*/

uniform float XBR_Y_WEIGHT;
uniform float XBR_EQ_THRESHOLD;
uniform float XBR_EQ_THRESHOLD2;
uniform float XBR_LV2_COEFFICIENT;

const mat3 yuv = mat3(0.299, 0.587, 0.114, -0.169, -0.331, 0.499, 0.499, -0.418, -0.0813);
const vec4 delta = vec4(0.4, 0.4, 0.4, 0.4);

vec4 df(vec4 A, vec4 B)
{
return vec4(abs(A-B));
}

float c_df(vec3 c1, vec3 c2) {
vec3 df = abs(c1 - c2);
return df.r + df.g + df.b;
}

bvec4 eq(vec4 A, vec4 B)
{
return lessThan(df(A, B), vec4(XBR_EQ_THRESHOLD));
}

bvec4 eq2(vec4 A, vec4 B)
{
return lessThan(df(A, B), vec4(XBR_EQ_THRESHOLD2));
}

bvec4 and(bvec4 A, bvec4 B)
{
return bvec4(A.x && B.x, A.y && B.y, A.z && B.z, A.w && B.w);
}

bvec4 or(bvec4 A, bvec4 B)
{
return bvec4(A.x || B.x, A.y || B.y, A.z || B.z, A.w || B.w);
}

vec4 weighted_distance(vec4 a, vec4 b, vec4 c, vec4 d, vec4 e, vec4 f, vec4 g, vec4 h)
{
return (df(a,b) + df(a,c) + df(d,e) + df(d,f) + 4.0*df(g,h));
}

// GLSL shader autogenerated by cg2glsl.py.
#if __VERSION__ >= 130
#define varying in
#define COMPAT_TEXTURE texture
out vec4 FragColor;
#else
#define FragColor gl_FragColor
#define COMPAT_TEXTURE texture2D
#endif

#ifdef GL_ES
#ifdef GL_FRAGMENT_PRECISION_HIGH
precision highp float;
#else
precision mediump float;
#endif
#define COMPAT_PRECISION mediump
#else
#define COMPAT_PRECISION
#endif
uniform sampler2D tex;
varying vec2 texCoord;
varying vec4 TEX1;
varying vec4 TEX2;
varying vec4 TEX3;
varying vec4 TEX4;
varying vec4 TEX5;
varying vec4 TEX6;
varying vec4 TEX7;

const vec2 TextureSize = vec2(240.0, 160.0);

void main()
{
bvec4 edr, edr_left, edr_up, edr3_left, edr3_up, px; // px = pixel, edr = edge detection rule
bvec4 interp_restriction_lv1, interp_restriction_lv2_left, interp_restriction_lv2_up;
bvec4 interp_restriction_lv3_left, interp_restriction_lv3_up;
bvec4 nc, nc30, nc60, nc45, nc15, nc75; // new_color
vec4 fx, fx_left, fx_up, finalfx, fx3_left, fx3_up; // inequations of straight lines.
vec3 res1, res2, pix1, pix2;
float blend1, blend2;

vec2 fp = fract(texCoord * TextureSize);

vec3 A1 = COMPAT_TEXTURE(tex, TEX1.xw).rgb;
vec3 B1 = COMPAT_TEXTURE(tex, TEX1.yw).rgb;
vec3 C1 = COMPAT_TEXTURE(tex, TEX1.zw).rgb;

vec3 A = COMPAT_TEXTURE(tex, TEX2.xw).rgb;
vec3 B = COMPAT_TEXTURE(tex, TEX2.yw).rgb;
vec3 C = COMPAT_TEXTURE(tex, TEX2.zw).rgb;

vec3 D = COMPAT_TEXTURE(tex, TEX3.xw).rgb;
vec3 E = COMPAT_TEXTURE(tex, TEX3.yw).rgb;
vec3 F = COMPAT_TEXTURE(tex, TEX3.zw).rgb;

vec3 G = COMPAT_TEXTURE(tex, TEX4.xw).rgb;
vec3 H = COMPAT_TEXTURE(tex, TEX4.yw).rgb;
vec3 I = COMPAT_TEXTURE(tex, TEX4.zw).rgb;

vec3 G5 = COMPAT_TEXTURE(tex, TEX5.xw).rgb;
vec3 H5 = COMPAT_TEXTURE(tex, TEX5.yw).rgb;
vec3 I5 = COMPAT_TEXTURE(tex, TEX5.zw).rgb;

vec3 A0 = COMPAT_TEXTURE(tex, TEX6.xy).rgb;
vec3 D0 = COMPAT_TEXTURE(tex, TEX6.xz).rgb;
vec3 G0 = COMPAT_TEXTURE(tex, TEX6.xw).rgb;

vec3 C4 = COMPAT_TEXTURE(tex, TEX7.xy).rgb;
vec3 F4 = COMPAT_TEXTURE(tex, TEX7.xz).rgb;
vec3 I4 = COMPAT_TEXTURE(tex, TEX7.xw).rgb;

vec4 b = transpose(mat4x3(B, D, H, F)) * (XBR_Y_WEIGHT * yuv[0]);
vec4 c = transpose(mat4x3(C, A, G, I)) * (XBR_Y_WEIGHT * yuv[0]);
vec4 e = transpose(mat4x3(E, E, E, E)) * (XBR_Y_WEIGHT * yuv[0]);
vec4 d = b.yzwx;
vec4 f = b.wxyz;
vec4 g = c.zwxy;
vec4 h = b.zwxy;
vec4 i = c.wxyz;

vec4 i4 = transpose(mat4x3(I4, C1, A0, G5)) * (XBR_Y_WEIGHT*yuv[0]);
vec4 i5 = transpose(mat4x3(I5, C4, A1, G0)) * (XBR_Y_WEIGHT*yuv[0]);
vec4 h5 = transpose(mat4x3(H5, F4, B1, D0)) * (XBR_Y_WEIGHT*yuv[0]);
vec4 f4 = h5.yzwx;

vec4 c1 = i4.yzwx;
vec4 g0 = i5.wxyz;
vec4 b1 = h5.zwxy;
vec4 d0 = h5.wxyz;

vec4 Ao = vec4( 1.0, -1.0, -1.0, 1.0 );
vec4 Bo = vec4( 1.0, 1.0, -1.0,-1.0 );
vec4 Co = vec4( 1.5, 0.5, -0.5, 0.5 );
vec4 Ax = vec4( 1.0, -1.0, -1.0, 1.0 );
vec4 Bx = vec4( 0.5, 2.0, -0.5,-2.0 );
vec4 Cx = vec4( 1.0, 1.0, -0.5, 0.0 );
vec4 Ay = vec4( 1.0, -1.0, -1.0, 1.0 );
vec4 By = vec4( 2.0, 0.5, -2.0,-0.5 );
vec4 Cy = vec4( 2.0, 0.0, -1.0, 0.5 );

vec4 Az = vec4( 6.0, -2.0, -6.0, 2.0 );
vec4 Bz = vec4( 2.0, 6.0, -2.0, -6.0 );
vec4 Cz = vec4( 5.0, 3.0, -3.0, -1.0 );
vec4 Aw = vec4( 2.0, -6.0, -2.0, 6.0 );
vec4 Bw = vec4( 6.0, 2.0, -6.0,-2.0 );
vec4 Cw = vec4( 5.0, -1.0, -3.0, 3.0 );

fx = (Ao*fp.y+Bo*fp.x);
fx_left = (Ax*fp.y+Bx*fp.x);
fx_up = (Ay*fp.y+By*fp.x);
fx3_left= (Az*fp.y+Bz*fp.x);
fx3_up = (Aw*fp.y+Bw*fp.x);

// It uses CORNER_C if none of the others are defined.
#ifdef CORNER_A
interp_restriction_lv1 = and(notEqual(e, f), notEqual(e, h));
#elif defined(CORNER_B)
interp_restriction_lv1 = ((e!=f) && (e!=h) && ( !eq(f,b) && !eq(h,d) || eq(e,i) && !eq(f,i4) && !eq(h,i5) || eq(e,g) || eq(e,c) ) );
#elif defined(CORNER_D)
interp_restriction_lv1 = ((e!=f) && (e!=h) && ( !eq(f,b) && !eq(h,d) || eq(e,i) && !eq(f,i4) && !eq(h,i5) || eq(e,g) || eq(e,c) ) && (f!=f4 && f!=i || h!=h5 && h!=i || h!=g || f!=c || eq(b,c1) && eq(d,g0)));
#else
interp_restriction_lv1 = and(and(notEqual(e, f), notEqual(e, h)),
or(or(and(not(eq(f,b)), not(eq(f,c))),
and(not(eq(h,d)), not(eq(h,g)))),
or(and(eq(e,i), or(and(not(eq(f,f4)), not(eq(f,i4))),
and(not(eq(h,h5)), not(eq(h,i5))))),
or(eq(e,g), eq(e,c)))));
#endif

interp_restriction_lv2_left = and(notEqual(e, g), notEqual(d, g));
interp_restriction_lv2_up = and(notEqual(e, c), notEqual(b, c));
interp_restriction_lv3_left = and(eq2(g,g0), not(eq2(d0,g0)));
interp_restriction_lv3_up = and(eq2(c,c1), not(eq2(b1,c1)));

vec4 fx45 = smoothstep(Co - delta, Co + delta, fx);
vec4 fx30 = smoothstep(Cx - delta, Cx + delta, fx_left);
vec4 fx60 = smoothstep(Cy - delta, Cy + delta, fx_up);
vec4 fx15 = smoothstep(Cz - delta, Cz + delta, fx3_left);
vec4 fx75 = smoothstep(Cw - delta, Cw + delta, fx3_up);

edr = and(lessThan(weighted_distance( e, c, g, i, h5, f4, h, f), weighted_distance( h, d, i5, f, i4, b, e, i)), interp_restriction_lv1);
edr_left = and(lessThanEqual((XBR_LV2_COEFFICIENT*df(f,g)), df(h,c)), interp_restriction_lv2_left);
edr_up = and(greaterThanEqual(df(f,g), (XBR_LV2_COEFFICIENT*df(h,c))), interp_restriction_lv2_up);
edr3_left = interp_restriction_lv3_left;
edr3_up = interp_restriction_lv3_up;

nc45 = and(edr, bvec4(fx45));
nc30 = and(edr, and(edr_left, bvec4(fx30)));
nc60 = and(edr, and(edr_up, bvec4(fx60)));
nc15 = and(and(edr, edr_left), and(edr3_left, bvec4(fx15)));
nc75 = and(and(edr, edr_up), and(edr3_up, bvec4(fx75)));

px = lessThanEqual(df(e, f), df(e, h));

nc = bvec4(nc75.x || nc15.x || nc30.x || nc60.x || nc45.x, nc75.y || nc15.y || nc30.y || nc60.y || nc45.y, nc75.z || nc15.z || nc30.z || nc60.z || nc45.z, nc75.w || nc15.w || nc30.w || nc60.w || nc45.w);

vec4 final45 = vec4(nc45) * fx45;
vec4 final30 = vec4(nc30) * fx30;
vec4 final60 = vec4(nc60) * fx60;
vec4 final15 = vec4(nc15) * fx15;
vec4 final75 = vec4(nc75) * fx75;

vec4 maximo = max(max(max(final15, final75),max(final30, final60)), final45);

if (nc.x) {pix1 = px.x ? F : H; blend1 = maximo.x;}
else if (nc.y) {pix1 = px.y ? B : F; blend1 = maximo.y;}
else if (nc.z) {pix1 = px.z ? D : B; blend1 = maximo.z;}
else if (nc.w) {pix1 = px.w ? H : D; blend1 = maximo.w;}

if (nc.w) {pix2 = px.w ? H : D; blend2 = maximo.w;}
else if (nc.z) {pix2 = px.z ? D : B; blend2 = maximo.z;}
else if (nc.y) {pix2 = px.y ? B : F; blend2 = maximo.y;}
else if (nc.x) {pix2 = px.x ? F : H; blend2 = maximo.x;}

res1 = mix(E, pix1, blend1);
res2 = mix(E, pix2, blend2);
vec3 res = mix(res1, res2, step(c_df(E, res1), c_df(E, res2)));

FragColor = vec4(res, 1.0);
}
60 changes: 60 additions & 0 deletions res/shaders/xbr.shader/xbr.vs
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*
Hyllian's xBR-lv3 Shader

Copyright (C) 2011-2015 Hyllian - [email protected]

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

Incorporates some of the ideas from SABR shader. Thanks to Joshua Street.
*/

varying vec2 texCoord;
varying vec4 TEX1;
varying vec4 TEX2;
varying vec4 TEX3;
varying vec4 TEX4;
varying vec4 TEX5;
varying vec4 TEX6;
varying vec4 TEX7;
attribute vec4 position;

/* VERTEX_SHADER */
void main()
{
gl_Position = position;

vec2 ps = vec2(1.0/240.0, 1.0/160.0);
float dx = ps.x;
float dy = ps.y;

// A1 B1 C1
// A0 A B C C4
// D0 D E F F4
// G0 G H I I4
// G5 H5 I5

texCoord = (position.st + vec2(1.0, 1.0)) * vec2(0.5, 0.5);
TEX1 = texCoord.xxxy + vec4( -dx, 0, dx,-2.0*dy); // A1 B1 C1
TEX2 = texCoord.xxxy + vec4( -dx, 0, dx, -dy); // A B C
TEX3 = texCoord.xxxy + vec4( -dx, 0, dx, 0); // D E F
TEX4 = texCoord.xxxy + vec4( -dx, 0, dx, dy); // G H I
TEX5 = texCoord.xxxy + vec4( -dx, 0, dx, 2.0*dy); // G5 H5 I5
TEX6 = texCoord.xyyy + vec4(-2.0*dx,-dy, 0, dy); // A0 D0 G0
TEX7 = texCoord.xyyy + vec4( 2.0*dx,-dy, 0, dy); // C4 F4 I4
}
Loading