Update to v094r23 release.
byuu says:
The library window is gone, and replaced with
hiro::BrowserWindow::openFolder(). This gives navigation capabilities to
game loading, and it also completes our slotted cart selection code. As
an added bonus, it's less code this way, too.
I also set the window size to consistent sizes between all emulated
systems, so that switching between SFC and GB don't cause the window
size to keep changing, and so that the scaling size is consistent (eg at
normal scale, GB @ 3x is closer to SNES @ 2x.) This means black borders
in GB/GBA mode, but it doesn't look that bad, and it's not like many
people ever use these modes anyway.
Finally, added the placeholder tabs for video, audio and timing. I don't
intend to add the timing calculator code to v095 (it might be better as
a separate tool), but I'll add the ability to set video/audio rates, at
least.
Glitch 1: despite selecting the first item in the BrowserDialog list, if
you press enter when the window appears, it doesn't activate the item
until you press an arrow key first.
Glitch 2: in Game Boy mode, if you set the 4x window size, it's not
honoring the full requested height because the viewport is smaller than
the window. 8+ years of trying to get GTK+ and Qt to simply set the god
damned window size I ask for, and I still can't get them to do it
reliably.
Remaining issues:
- finish configuration panels (video, audio, timing)
- fix ruby driver compilation on Windows
- add DIP switch selection window (NSS) [I may end up punting this one
to v096]
2015-05-30 11:39:09 +00:00
|
|
|
auto OpenGLProgram::bind(OpenGL* instance, const Markup::Node& node, const string& pathname) -> void {
|
2013-04-09 13:31:46 +00:00
|
|
|
filter = glrFilter(node["filter"].text());
|
|
|
|
wrap = glrWrap(node["wrap"].text());
|
|
|
|
modulo = glrModulo(node["modulo"].integer());
|
|
|
|
|
|
|
|
string w = node["width"].text(), h = node["height"].text();
|
2015-07-14 09:32:43 +00:00
|
|
|
if(w.endsWith("%")) relativeWidth = real(w.rtrim("%", 1L)) / 100.0;
|
2015-11-14 00:52:51 +00:00
|
|
|
else absoluteWidth = w.natural();
|
2015-07-14 09:32:43 +00:00
|
|
|
if(h.endsWith("%")) relativeHeight = real(h.rtrim("%", 1L)) / 100.0;
|
2015-11-14 00:52:51 +00:00
|
|
|
else absoluteHeight = h.natural();
|
2013-04-09 13:31:46 +00:00
|
|
|
|
|
|
|
format = glrFormat(node["format"].text());
|
|
|
|
|
|
|
|
program = glCreateProgram();
|
|
|
|
glGenFramebuffers(1, &framebuffer);
|
|
|
|
|
|
|
|
if(file::exists({pathname, node["vertex"].text()})) {
|
2013-04-14 08:52:47 +00:00
|
|
|
string source = file::read({pathname, node["vertex"].text()});
|
Update to v093r02 release.
byuu says:
Changelog:
- nall: fixed major memory leak in string class
- ruby: video shaders support #define-based settings now
- phoenix/GTK+: support > 256x256 icons for window / task bar / alt-tab
- sfc: remove random/ and config/, merge into system/
- ethos: delete higan.png (48x48), replace with higan512.png (512x512)
as new higan.png
- ethos: default gamma to 100% (no color adjustment)
- ethos: use "Video Shaders/Display Emulation/" instead of "Video
Shaders/Emulation/"
- use g++ instead of g++-4.7 (g++ -v must be >= 4.7)
- use -std=c++11 instead of -std=gnu++11
- applied a few patches from Debian upstream to make their packaging job
easier
So because colors are normalized in GLSL, I won't be able to offer video
shaders absolute color literals. We will have to perform basic color
conversion inside the core.
As such, the current plan is to create some sort of Emulator::Settings
interface. With that, I'll connect an option for color correction, which
will be on by default. For FC/SFC, that will mean gamma correction
(darker / stronger colors), and for GB/GBC/GBA, it will mean simulating
the weird brightness levels of the displays. I am undecided on whether
to use pea soup green for the GB or not. By not doing so, it'll be
easier for the display emulation shader to do it.
2013-11-09 11:45:54 +00:00
|
|
|
parse(instance, source);
|
2013-04-09 13:31:46 +00:00
|
|
|
vertex = glrCreateShader(program, GL_VERTEX_SHADER, source);
|
|
|
|
} else {
|
|
|
|
vertex = glrCreateShader(program, GL_VERTEX_SHADER, OpenGLVertexShader);
|
|
|
|
}
|
|
|
|
|
|
|
|
if(file::exists({pathname, node["geometry"].text()})) {
|
2013-04-14 08:52:47 +00:00
|
|
|
string source = file::read({pathname, node["geometry"].text()});
|
Update to v093r02 release.
byuu says:
Changelog:
- nall: fixed major memory leak in string class
- ruby: video shaders support #define-based settings now
- phoenix/GTK+: support > 256x256 icons for window / task bar / alt-tab
- sfc: remove random/ and config/, merge into system/
- ethos: delete higan.png (48x48), replace with higan512.png (512x512)
as new higan.png
- ethos: default gamma to 100% (no color adjustment)
- ethos: use "Video Shaders/Display Emulation/" instead of "Video
Shaders/Emulation/"
- use g++ instead of g++-4.7 (g++ -v must be >= 4.7)
- use -std=c++11 instead of -std=gnu++11
- applied a few patches from Debian upstream to make their packaging job
easier
So because colors are normalized in GLSL, I won't be able to offer video
shaders absolute color literals. We will have to perform basic color
conversion inside the core.
As such, the current plan is to create some sort of Emulator::Settings
interface. With that, I'll connect an option for color correction, which
will be on by default. For FC/SFC, that will mean gamma correction
(darker / stronger colors), and for GB/GBC/GBA, it will mean simulating
the weird brightness levels of the displays. I am undecided on whether
to use pea soup green for the GB or not. By not doing so, it'll be
easier for the display emulation shader to do it.
2013-11-09 11:45:54 +00:00
|
|
|
parse(instance, source);
|
2013-04-09 13:31:46 +00:00
|
|
|
geometry = glrCreateShader(program, GL_GEOMETRY_SHADER, source);
|
|
|
|
} else {
|
|
|
|
//geometry shaders, when attached, must pass all vertex output through to the fragment shaders
|
|
|
|
//geometry = glrCreateShader(program, GL_GEOMETRY_SHADER, OpenGLGeometryShader);
|
|
|
|
}
|
|
|
|
|
|
|
|
if(file::exists({pathname, node["fragment"].text()})) {
|
2013-04-14 08:52:47 +00:00
|
|
|
string source = file::read({pathname, node["fragment"].text()});
|
Update to v093r02 release.
byuu says:
Changelog:
- nall: fixed major memory leak in string class
- ruby: video shaders support #define-based settings now
- phoenix/GTK+: support > 256x256 icons for window / task bar / alt-tab
- sfc: remove random/ and config/, merge into system/
- ethos: delete higan.png (48x48), replace with higan512.png (512x512)
as new higan.png
- ethos: default gamma to 100% (no color adjustment)
- ethos: use "Video Shaders/Display Emulation/" instead of "Video
Shaders/Emulation/"
- use g++ instead of g++-4.7 (g++ -v must be >= 4.7)
- use -std=c++11 instead of -std=gnu++11
- applied a few patches from Debian upstream to make their packaging job
easier
So because colors are normalized in GLSL, I won't be able to offer video
shaders absolute color literals. We will have to perform basic color
conversion inside the core.
As such, the current plan is to create some sort of Emulator::Settings
interface. With that, I'll connect an option for color correction, which
will be on by default. For FC/SFC, that will mean gamma correction
(darker / stronger colors), and for GB/GBC/GBA, it will mean simulating
the weird brightness levels of the displays. I am undecided on whether
to use pea soup green for the GB or not. By not doing so, it'll be
easier for the display emulation shader to do it.
2013-11-09 11:45:54 +00:00
|
|
|
parse(instance, source);
|
2013-04-09 13:31:46 +00:00
|
|
|
fragment = glrCreateShader(program, GL_FRAGMENT_SHADER, source);
|
|
|
|
} else {
|
|
|
|
fragment = glrCreateShader(program, GL_FRAGMENT_SHADER, OpenGLFragmentShader);
|
|
|
|
}
|
|
|
|
|
2013-05-02 11:25:45 +00:00
|
|
|
for(auto& leaf : node.find("pixmap")) {
|
2013-04-09 13:31:46 +00:00
|
|
|
nall::image image({pathname, leaf.text()});
|
2015-06-18 10:48:53 +00:00
|
|
|
image.transform();
|
2013-04-09 13:31:46 +00:00
|
|
|
if(image.empty()) continue;
|
|
|
|
|
|
|
|
GLuint texture;
|
|
|
|
glGenTextures(1, &texture);
|
|
|
|
|
2013-04-14 08:52:47 +00:00
|
|
|
unsigned n = pixmaps.size();
|
|
|
|
pixmaps(n).texture = texture;
|
2015-06-18 10:48:53 +00:00
|
|
|
pixmaps(n).width = image.width();
|
|
|
|
pixmaps(n).height = image.height();
|
2013-04-14 08:52:47 +00:00
|
|
|
pixmaps(n).format = format;
|
|
|
|
pixmaps(n).filter = filter;
|
|
|
|
pixmaps(n).wrap = wrap;
|
Update to v094r17 release.
byuu says:
This updates higan to use the new Markup::Node changes. This is a really
big change, and one slight typo anywhere could break certain classes of
games from playing.
I don't have ananke hooked up again yet, so I don't have the ability to
test this much. If anyone with some v094 game folders wouldn't mind
testing, I'd help out a great deal.
I'm most concerned about testing one of each SNES special chip game.
Most notably, systems like the SA-1, HitachiDSP and NEC-DSP were using
the fancier lookups, eg node["rom[0]/name"], which I had to convert to
a rather ugly node["rom"].at(0)["name"], which I'm fairly confident
won't work. I'm going to blame that on the fumes from the shelves I just
stained >.> Might work with node.find("rom[0]/name")(0) though ...? But
so ugly ... ugh.
That aside, this WIP adds the accuracy-PPU inlining, so the accuracy
profile should run around 7.5% faster than before.
2015-05-02 13:05:46 +00:00
|
|
|
if(leaf["format"]) pixmaps(n).format = glrFormat(leaf["format"].text());
|
|
|
|
if(leaf["filter"]) pixmaps(n).filter = glrFilter(leaf["filter"].text());
|
|
|
|
if(leaf["wrap"]) pixmaps(n).wrap = glrWrap(leaf["wrap"].text());
|
2013-04-09 13:31:46 +00:00
|
|
|
|
2015-06-18 10:48:53 +00:00
|
|
|
unsigned w = glrSize(image.width()), h = glrSize(image.height());
|
2013-05-02 11:25:45 +00:00
|
|
|
uint32_t* buffer = new uint32_t[w * h]();
|
2013-04-09 13:31:46 +00:00
|
|
|
glBindTexture(GL_TEXTURE_2D, texture);
|
2014-01-05 09:59:17 +00:00
|
|
|
glTexImage2D(GL_TEXTURE_2D, 0, pixmaps(n).format, w, h, 0, pixmaps(n).getFormat(), pixmaps(n).getType(), buffer);
|
2015-06-18 10:48:53 +00:00
|
|
|
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, image.width(), image.height(), getFormat(), getType(), image.data());
|
2013-04-09 13:31:46 +00:00
|
|
|
delete[] buffer;
|
|
|
|
}
|
|
|
|
|
2013-04-14 08:52:47 +00:00
|
|
|
OpenGLSurface::allocate();
|
2013-04-09 13:31:46 +00:00
|
|
|
glrLinkProgram(program);
|
|
|
|
}
|
|
|
|
|
Update to v093r02 release.
byuu says:
Changelog:
- nall: fixed major memory leak in string class
- ruby: video shaders support #define-based settings now
- phoenix/GTK+: support > 256x256 icons for window / task bar / alt-tab
- sfc: remove random/ and config/, merge into system/
- ethos: delete higan.png (48x48), replace with higan512.png (512x512)
as new higan.png
- ethos: default gamma to 100% (no color adjustment)
- ethos: use "Video Shaders/Display Emulation/" instead of "Video
Shaders/Emulation/"
- use g++ instead of g++-4.7 (g++ -v must be >= 4.7)
- use -std=c++11 instead of -std=gnu++11
- applied a few patches from Debian upstream to make their packaging job
easier
So because colors are normalized in GLSL, I won't be able to offer video
shaders absolute color literals. We will have to perform basic color
conversion inside the core.
As such, the current plan is to create some sort of Emulator::Settings
interface. With that, I'll connect an option for color correction, which
will be on by default. For FC/SFC, that will mean gamma correction
(darker / stronger colors), and for GB/GBC/GBA, it will mean simulating
the weird brightness levels of the displays. I am undecided on whether
to use pea soup green for the GB or not. By not doing so, it'll be
easier for the display emulation shader to do it.
2013-11-09 11:45:54 +00:00
|
|
|
//apply manifest settings to shader source #in tags
|
Update to v094r23 release.
byuu says:
The library window is gone, and replaced with
hiro::BrowserWindow::openFolder(). This gives navigation capabilities to
game loading, and it also completes our slotted cart selection code. As
an added bonus, it's less code this way, too.
I also set the window size to consistent sizes between all emulated
systems, so that switching between SFC and GB don't cause the window
size to keep changing, and so that the scaling size is consistent (eg at
normal scale, GB @ 3x is closer to SNES @ 2x.) This means black borders
in GB/GBA mode, but it doesn't look that bad, and it's not like many
people ever use these modes anyway.
Finally, added the placeholder tabs for video, audio and timing. I don't
intend to add the timing calculator code to v095 (it might be better as
a separate tool), but I'll add the ability to set video/audio rates, at
least.
Glitch 1: despite selecting the first item in the BrowserDialog list, if
you press enter when the window appears, it doesn't activate the item
until you press an arrow key first.
Glitch 2: in Game Boy mode, if you set the 4x window size, it's not
honoring the full requested height because the viewport is smaller than
the window. 8+ years of trying to get GTK+ and Qt to simply set the god
damned window size I ask for, and I still can't get them to do it
reliably.
Remaining issues:
- finish configuration panels (video, audio, timing)
- fix ruby driver compilation on Windows
- add DIP switch selection window (NSS) [I may end up punting this one
to v096]
2015-05-30 11:39:09 +00:00
|
|
|
auto OpenGLProgram::parse(OpenGL* instance, string& source) -> void {
|
Update to v093r02 release.
byuu says:
Changelog:
- nall: fixed major memory leak in string class
- ruby: video shaders support #define-based settings now
- phoenix/GTK+: support > 256x256 icons for window / task bar / alt-tab
- sfc: remove random/ and config/, merge into system/
- ethos: delete higan.png (48x48), replace with higan512.png (512x512)
as new higan.png
- ethos: default gamma to 100% (no color adjustment)
- ethos: use "Video Shaders/Display Emulation/" instead of "Video
Shaders/Emulation/"
- use g++ instead of g++-4.7 (g++ -v must be >= 4.7)
- use -std=c++11 instead of -std=gnu++11
- applied a few patches from Debian upstream to make their packaging job
easier
So because colors are normalized in GLSL, I won't be able to offer video
shaders absolute color literals. We will have to perform basic color
conversion inside the core.
As such, the current plan is to create some sort of Emulator::Settings
interface. With that, I'll connect an option for color correction, which
will be on by default. For FC/SFC, that will mean gamma correction
(darker / stronger colors), and for GB/GBC/GBA, it will mean simulating
the weird brightness levels of the displays. I am undecided on whether
to use pea soup green for the GB or not. By not doing so, it'll be
easier for the display emulation shader to do it.
2013-11-09 11:45:54 +00:00
|
|
|
lstring lines = source.split("\n");
|
|
|
|
for(auto& line : lines) {
|
|
|
|
string s = line;
|
|
|
|
if(auto position = s.find("//")) s.resize(position()); //strip comments
|
|
|
|
s.strip(); //remove extraneous whitespace
|
|
|
|
if(s.match("#in ?*")) {
|
2015-07-14 09:32:43 +00:00
|
|
|
s.ltrim("#in ", 1L).strip();
|
Update to v093r02 release.
byuu says:
Changelog:
- nall: fixed major memory leak in string class
- ruby: video shaders support #define-based settings now
- phoenix/GTK+: support > 256x256 icons for window / task bar / alt-tab
- sfc: remove random/ and config/, merge into system/
- ethos: delete higan.png (48x48), replace with higan512.png (512x512)
as new higan.png
- ethos: default gamma to 100% (no color adjustment)
- ethos: use "Video Shaders/Display Emulation/" instead of "Video
Shaders/Emulation/"
- use g++ instead of g++-4.7 (g++ -v must be >= 4.7)
- use -std=c++11 instead of -std=gnu++11
- applied a few patches from Debian upstream to make their packaging job
easier
So because colors are normalized in GLSL, I won't be able to offer video
shaders absolute color literals. We will have to perform basic color
conversion inside the core.
As such, the current plan is to create some sort of Emulator::Settings
interface. With that, I'll connect an option for color correction, which
will be on by default. For FC/SFC, that will mean gamma correction
(darker / stronger colors), and for GB/GBC/GBA, it will mean simulating
the weird brightness levels of the displays. I am undecided on whether
to use pea soup green for the GB or not. By not doing so, it'll be
easier for the display emulation shader to do it.
2013-11-09 11:45:54 +00:00
|
|
|
if(auto setting = instance->settings.find({s})) {
|
|
|
|
line = {"#define ", setting().name, " ", setting().value};
|
|
|
|
} else {
|
|
|
|
line.reset(); //undefined variable (test in source with #ifdef)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
source = lines.merge("\n");
|
|
|
|
}
|
|
|
|
|
Update to v094r23 release.
byuu says:
The library window is gone, and replaced with
hiro::BrowserWindow::openFolder(). This gives navigation capabilities to
game loading, and it also completes our slotted cart selection code. As
an added bonus, it's less code this way, too.
I also set the window size to consistent sizes between all emulated
systems, so that switching between SFC and GB don't cause the window
size to keep changing, and so that the scaling size is consistent (eg at
normal scale, GB @ 3x is closer to SNES @ 2x.) This means black borders
in GB/GBA mode, but it doesn't look that bad, and it's not like many
people ever use these modes anyway.
Finally, added the placeholder tabs for video, audio and timing. I don't
intend to add the timing calculator code to v095 (it might be better as
a separate tool), but I'll add the ability to set video/audio rates, at
least.
Glitch 1: despite selecting the first item in the BrowserDialog list, if
you press enter when the window appears, it doesn't activate the item
until you press an arrow key first.
Glitch 2: in Game Boy mode, if you set the 4x window size, it's not
honoring the full requested height because the viewport is smaller than
the window. 8+ years of trying to get GTK+ and Qt to simply set the god
damned window size I ask for, and I still can't get them to do it
reliably.
Remaining issues:
- finish configuration panels (video, audio, timing)
- fix ruby driver compilation on Windows
- add DIP switch selection window (NSS) [I may end up punting this one
to v096]
2015-05-30 11:39:09 +00:00
|
|
|
auto OpenGLProgram::release() -> void {
|
2013-04-09 13:31:46 +00:00
|
|
|
OpenGLSurface::release();
|
2013-05-02 11:25:45 +00:00
|
|
|
for(auto& pixmap : pixmaps) glDeleteTextures(1, &pixmap.texture);
|
2013-04-14 08:52:47 +00:00
|
|
|
pixmaps.reset();
|
2013-04-09 13:31:46 +00:00
|
|
|
|
|
|
|
width = 0;
|
|
|
|
height = 0;
|
|
|
|
format = GL_RGBA8;
|
|
|
|
filter = GL_LINEAR;
|
|
|
|
wrap = GL_CLAMP_TO_BORDER;
|
|
|
|
phase = 0;
|
|
|
|
modulo = 0;
|
|
|
|
absoluteWidth = 0;
|
|
|
|
absoluteHeight = 0;
|
|
|
|
relativeWidth = 0;
|
|
|
|
relativeHeight = 0;
|
|
|
|
}
|