2015-02-28 01:51:53 +00:00
|
|
|
//request from emulation core to load non-volatile media folder
|
|
|
|
auto Program::loadRequest(unsigned id, string name, string type) -> void {
|
Update to v094r22 release.
byuu says:
I fixed the hiro layout enable bug, so when you go to assign joypad
input, the window disables itself so your input doesn't mess with the
controls.
I added "reset" to the hotkeys, in case you feel like clearing all of
them at once.
I added device selection support and the ability to disable audio
synchronization (run > 60fps) to the ruby/OSS driver. This is exposed in
tomoko's configuration file.
I added checks to stringify so that assigning null char* strings to
nall::string won't cause crashes anymore (technically the crash was in
strlen(), which doesn't check for null strings, but whatever ... I'll do
the check myself.)
I hooked up BrowserDialog::folderSelect() to loading slotted media for
now. Tested it by loading a Game Boy game successfully through the Super
Game Boy. Definitely want to write a custom window for this though, that
looks more like the library dialog.
Remaining issues:
- finish slotted cart loader (SGB, BSX, ST)
- add DIP switch selection window (NSS) [I may end up punting this one
to v096]
- add more configuration panels (video, audio, timing)
2015-05-25 12:23:49 +00:00
|
|
|
string location = BrowserDialog()
|
|
|
|
.setTitle({"Load ", name})
|
2015-06-15 22:26:47 +00:00
|
|
|
.setPath({config->library.location, name})
|
Update to v094r22 release.
byuu says:
I fixed the hiro layout enable bug, so when you go to assign joypad
input, the window disables itself so your input doesn't mess with the
controls.
I added "reset" to the hotkeys, in case you feel like clearing all of
them at once.
I added device selection support and the ability to disable audio
synchronization (run > 60fps) to the ruby/OSS driver. This is exposed in
tomoko's configuration file.
I added checks to stringify so that assigning null char* strings to
nall::string won't cause crashes anymore (technically the crash was in
strlen(), which doesn't check for null strings, but whatever ... I'll do
the check myself.)
I hooked up BrowserDialog::folderSelect() to loading slotted media for
now. Tested it by loading a Game Boy game successfully through the Super
Game Boy. Definitely want to write a custom window for this though, that
looks more like the library dialog.
Remaining issues:
- finish slotted cart loader (SGB, BSX, ST)
- add DIP switch selection window (NSS) [I may end up punting this one
to v096]
- add more configuration panels (video, audio, timing)
2015-05-25 12:23:49 +00:00
|
|
|
.setFilters({string{name, "|*.", type}})
|
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
|
|
|
.openFolder();
|
Update to v094r22 release.
byuu says:
I fixed the hiro layout enable bug, so when you go to assign joypad
input, the window disables itself so your input doesn't mess with the
controls.
I added "reset" to the hotkeys, in case you feel like clearing all of
them at once.
I added device selection support and the ability to disable audio
synchronization (run > 60fps) to the ruby/OSS driver. This is exposed in
tomoko's configuration file.
I added checks to stringify so that assigning null char* strings to
nall::string won't cause crashes anymore (technically the crash was in
strlen(), which doesn't check for null strings, but whatever ... I'll do
the check myself.)
I hooked up BrowserDialog::folderSelect() to loading slotted media for
now. Tested it by loading a Game Boy game successfully through the Super
Game Boy. Definitely want to write a custom window for this though, that
looks more like the library dialog.
Remaining issues:
- finish slotted cart loader (SGB, BSX, ST)
- add DIP switch selection window (NSS) [I may end up punting this one
to v096]
- add more configuration panels (video, audio, timing)
2015-05-25 12:23:49 +00:00
|
|
|
if(!directory::exists(location)) return;
|
|
|
|
|
|
|
|
mediaPaths(id) = location;
|
|
|
|
folderPaths.append(location);
|
|
|
|
emulator->load(id);
|
2015-02-28 01:51:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//request from emulation core to load non-volatile media file
|
|
|
|
auto Program::loadRequest(unsigned id, string path) -> void {
|
2015-04-21 11:51:57 +00:00
|
|
|
string location = {mediaPaths(emulator->group(id)), path};
|
2015-02-28 01:51:53 +00:00
|
|
|
if(!file::exists(location)) return;
|
|
|
|
mmapstream stream{location};
|
2015-04-21 11:51:57 +00:00
|
|
|
return emulator->load(id, stream);
|
2015-02-28 01:51:53 +00:00
|
|
|
}
|
|
|
|
|
2015-03-02 09:13:28 +00:00
|
|
|
//request from emulation core to save non-volatile media file
|
2015-02-28 01:51:53 +00:00
|
|
|
auto Program::saveRequest(unsigned id, string path) -> void {
|
2015-04-21 11:51:57 +00:00
|
|
|
string location = {mediaPaths(emulator->group(id)), path};
|
2015-03-02 09:13:28 +00:00
|
|
|
filestream stream{location, file::mode::write};
|
2015-04-21 11:51:57 +00:00
|
|
|
return emulator->save(id, stream);
|
2015-02-28 01:51:53 +00:00
|
|
|
}
|
|
|
|
|
2015-06-15 22:26:47 +00:00
|
|
|
auto Program::videoColor(unsigned source, uint16 a, uint16 r, uint16 g, uint16 b) -> uint32 {
|
|
|
|
if(config->video.saturation != 100) {
|
|
|
|
uint16 grayscale = uclamp<16>((r + g + b) / 3);
|
|
|
|
double saturation = config->video.saturation * 0.01;
|
|
|
|
double inverse = max(0.0, 1.0 - saturation);
|
|
|
|
r = uclamp<16>(r * saturation + grayscale * inverse);
|
|
|
|
g = uclamp<16>(g * saturation + grayscale * inverse);
|
|
|
|
b = uclamp<16>(b * saturation + grayscale * inverse);
|
|
|
|
}
|
|
|
|
|
|
|
|
if(config->video.gamma != 100) {
|
|
|
|
double exponent = config->video.gamma * 0.01;
|
|
|
|
double reciprocal = 1.0 / 32767.0;
|
|
|
|
r = r > 32767 ? r : 32767 * pow(r * reciprocal, exponent);
|
|
|
|
g = g > 32767 ? g : 32767 * pow(g * reciprocal, exponent);
|
|
|
|
b = b > 32767 ? b : 32767 * pow(b * reciprocal, exponent);
|
|
|
|
}
|
|
|
|
|
|
|
|
if(config->video.luminance != 100) {
|
|
|
|
double luminance = config->video.luminance * 0.01;
|
|
|
|
r = r * luminance;
|
|
|
|
g = g * luminance;
|
|
|
|
b = b * luminance;
|
|
|
|
}
|
|
|
|
|
|
|
|
a >>= 8;
|
|
|
|
r >>= 8;
|
|
|
|
g >>= 8;
|
|
|
|
b >>= 8;
|
|
|
|
return a << 24 | r << 16 | g << 8 | b << 0;
|
2015-02-28 01:51:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
auto Program::videoRefresh(const uint32* palette, const uint32* data, unsigned pitch, unsigned width, unsigned height) -> void {
|
|
|
|
uint32* output;
|
|
|
|
unsigned length;
|
|
|
|
|
|
|
|
if(video.lock(output, length, width, height)) {
|
|
|
|
pitch >>= 2, length >>= 2;
|
|
|
|
|
|
|
|
for(auto y : range(height)) {
|
|
|
|
const uint32* sp = data + y * pitch;
|
|
|
|
uint32* dp = output + y * length;
|
|
|
|
for(auto x : range(width)) {
|
|
|
|
*dp++ = palette[*sp++];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-06-15 22:26:47 +00:00
|
|
|
if(emulator->information.overscan && config->video.overscan.mask) {
|
|
|
|
unsigned h = config->video.overscan.horizontal;
|
|
|
|
unsigned v = config->video.overscan.vertical;
|
2015-04-21 11:58:59 +00:00
|
|
|
|
|
|
|
if(h) for(auto y : range(height)) {
|
|
|
|
memory::fill(output + y * length, 4 * h);
|
|
|
|
memory::fill(output + y * length + (width - h), 4 * h);
|
|
|
|
}
|
|
|
|
|
|
|
|
if(v) for(auto y : range(v)) {
|
|
|
|
memory::fill(output + y * length, 4 * width);
|
|
|
|
memory::fill(output + (height - 1 - y) * length, 4 * width);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-02-28 01:51:53 +00:00
|
|
|
video.unlock();
|
|
|
|
video.refresh();
|
|
|
|
}
|
|
|
|
|
|
|
|
static unsigned frameCounter = 0;
|
|
|
|
static time_t previous, current;
|
|
|
|
frameCounter++;
|
|
|
|
|
|
|
|
time(¤t);
|
|
|
|
if(current != previous) {
|
|
|
|
previous = current;
|
2015-04-13 11:16:33 +00:00
|
|
|
statusText = {"FPS: ", frameCounter};
|
2015-02-28 01:51:53 +00:00
|
|
|
frameCounter = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
auto Program::audioSample(int16 lsample, int16 rsample) -> void {
|
|
|
|
signed samples[] = {lsample, rsample};
|
|
|
|
dsp.sample(samples);
|
|
|
|
while(dsp.pending()) {
|
|
|
|
dsp.read(samples);
|
|
|
|
audio.sample(samples[0], samples[1]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
auto Program::inputPoll(unsigned port, unsigned device, unsigned input) -> int16 {
|
2015-03-03 10:14:49 +00:00
|
|
|
if(presentation->focused()) {
|
2015-04-21 11:51:57 +00:00
|
|
|
auto guid = emulator->port[port].device[device].input[input].guid;
|
2015-03-03 10:14:49 +00:00
|
|
|
auto mapping = (InputMapping*)guid;
|
|
|
|
if(mapping) return mapping->poll();
|
|
|
|
}
|
2015-03-02 09:13:28 +00:00
|
|
|
return 0;
|
2015-02-28 01:51:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
auto Program::inputRumble(unsigned port, unsigned device, unsigned input, bool enable) -> void {
|
|
|
|
}
|
|
|
|
|
|
|
|
auto Program::dipSettings(const Markup::Node& node) -> unsigned {
|
|
|
|
}
|
|
|
|
|
|
|
|
auto Program::path(unsigned group) -> string {
|
|
|
|
return mediaPaths(group);
|
|
|
|
}
|
|
|
|
|
|
|
|
auto Program::notify(string text) -> void {
|
|
|
|
}
|