2015-02-28 01:51:53 +00:00
|
|
|
//request from emulation core to load non-volatile media folder
|
Update to v094r39 release.
byuu says:
Changelog:
- SNES mid-scanline BGMODE fixes finally merged (can run
atx2.zip{mode7.smc}+mtest(2).sfc properly now)
- Makefile now discards all built-in rules and variables
- switch on bool warning disabled for GCC now as well (was already
disabled for Clang)
- when loading a game, if any required files are missing, display
a warning message box (manifest.bml, program.rom, bios.rom, etc)
- when loading a game (or a game slot), if manifest.bml is missing, it
will invoke icarus to try and generate it
- if that fails (icarus is missing or the folder is bad), you will get
a warning telling you that the manifest can't be loaded
The warning prompt on missing files work for both games and the .sys
folders and their files. For some reason, failing to load the DMG/CGB
BIOS is causing a crash before I can display the modal dialog. I have no
idea why, and the stack frame backtrace is junk.
I also can't seem to abort the failed loading process. If I call
Program::unloadMedia(), I get a nasty segfault. Again with a really
nasty stack trace. So for now, it'll just end up sitting there emulating
an empty ROM (solid black screen.) In time, I'd like to fix that too.
Lastly, I need a better method than popen for Windows. popen is kind of
ugly and flashes a console window for a brief second even if the
application launched is linked with -mwindows. Not sure if there even is
one (I need to read the stdout result, so CreateProcess may not work
unless I do something nasty like "> %tmp%/temp") I'm also using the
regular popen instead of _wpopen, so for this WIP, it won't work if your
game folder has non-English letters in the path.
2015-08-04 09:00:55 +00:00
|
|
|
auto Program::loadRequest(unsigned id, string name, string type, bool required) -> 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-11-16 08:38:05 +00:00
|
|
|
.setPath({settings["Library/Location"].text(), 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
|
Update to v094r39 release.
byuu says:
Changelog:
- SNES mid-scanline BGMODE fixes finally merged (can run
atx2.zip{mode7.smc}+mtest(2).sfc properly now)
- Makefile now discards all built-in rules and variables
- switch on bool warning disabled for GCC now as well (was already
disabled for Clang)
- when loading a game, if any required files are missing, display
a warning message box (manifest.bml, program.rom, bios.rom, etc)
- when loading a game (or a game slot), if manifest.bml is missing, it
will invoke icarus to try and generate it
- if that fails (icarus is missing or the folder is bad), you will get
a warning telling you that the manifest can't be loaded
The warning prompt on missing files work for both games and the .sys
folders and their files. For some reason, failing to load the DMG/CGB
BIOS is causing a crash before I can display the modal dialog. I have no
idea why, and the stack frame backtrace is junk.
I also can't seem to abort the failed loading process. If I call
Program::unloadMedia(), I get a nasty segfault. Again with a really
nasty stack trace. So for now, it'll just end up sitting there emulating
an empty ROM (solid black screen.) In time, I'd like to fix that too.
Lastly, I need a better method than popen for Windows. popen is kind of
ugly and flashes a console window for a brief second even if the
application launched is linked with -mwindows. Not sure if there even is
one (I need to read the stdout result, so CreateProcess may not work
unless I do something nasty like "> %tmp%/temp") I'm also using the
regular popen instead of _wpopen, so for this WIP, it won't work if your
game folder has non-English letters in the path.
2015-08-04 09:00:55 +00:00
|
|
|
auto Program::loadRequest(unsigned id, string filename, bool required) -> void {
|
|
|
|
string pathname = mediaPaths(emulator->group(id));
|
|
|
|
string location = {pathname, filename};
|
2015-11-16 08:38:05 +00:00
|
|
|
|
|
|
|
if(filename == "manifest.bml" && !pathname.find(".sys/")) {
|
|
|
|
if(!file::exists(location) || settings["Library/IgnoreManifests"].boolean()) {
|
|
|
|
string manifest;
|
|
|
|
if(auto fp = popen(string{"icarus -m \"", pathname, "\""}, "r")) {
|
|
|
|
while(true) {
|
|
|
|
auto byte = fgetc(fp);
|
|
|
|
if(byte == EOF) break;
|
|
|
|
manifest.append((char)byte);
|
|
|
|
}
|
|
|
|
pclose(fp);
|
|
|
|
}
|
|
|
|
if(manifest) {
|
|
|
|
memorystream stream{(const uint8*)manifest.data(), manifest.size()};
|
|
|
|
return emulator->load(id, stream);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Update to v094r39 release.
byuu says:
Changelog:
- SNES mid-scanline BGMODE fixes finally merged (can run
atx2.zip{mode7.smc}+mtest(2).sfc properly now)
- Makefile now discards all built-in rules and variables
- switch on bool warning disabled for GCC now as well (was already
disabled for Clang)
- when loading a game, if any required files are missing, display
a warning message box (manifest.bml, program.rom, bios.rom, etc)
- when loading a game (or a game slot), if manifest.bml is missing, it
will invoke icarus to try and generate it
- if that fails (icarus is missing or the folder is bad), you will get
a warning telling you that the manifest can't be loaded
The warning prompt on missing files work for both games and the .sys
folders and their files. For some reason, failing to load the DMG/CGB
BIOS is causing a crash before I can display the modal dialog. I have no
idea why, and the stack frame backtrace is junk.
I also can't seem to abort the failed loading process. If I call
Program::unloadMedia(), I get a nasty segfault. Again with a really
nasty stack trace. So for now, it'll just end up sitting there emulating
an empty ROM (solid black screen.) In time, I'd like to fix that too.
Lastly, I need a better method than popen for Windows. popen is kind of
ugly and flashes a console window for a brief second even if the
application launched is linked with -mwindows. Not sure if there even is
one (I need to read the stdout result, so CreateProcess may not work
unless I do something nasty like "> %tmp%/temp") I'm also using the
regular popen instead of _wpopen, so for this WIP, it won't work if your
game folder has non-English letters in the path.
2015-08-04 09:00:55 +00:00
|
|
|
if(file::exists(location)) {
|
|
|
|
mmapstream stream{location};
|
|
|
|
return emulator->load(id, stream);
|
|
|
|
}
|
2015-11-16 08:38:05 +00:00
|
|
|
|
Update to v094r39 release.
byuu says:
Changelog:
- SNES mid-scanline BGMODE fixes finally merged (can run
atx2.zip{mode7.smc}+mtest(2).sfc properly now)
- Makefile now discards all built-in rules and variables
- switch on bool warning disabled for GCC now as well (was already
disabled for Clang)
- when loading a game, if any required files are missing, display
a warning message box (manifest.bml, program.rom, bios.rom, etc)
- when loading a game (or a game slot), if manifest.bml is missing, it
will invoke icarus to try and generate it
- if that fails (icarus is missing or the folder is bad), you will get
a warning telling you that the manifest can't be loaded
The warning prompt on missing files work for both games and the .sys
folders and their files. For some reason, failing to load the DMG/CGB
BIOS is causing a crash before I can display the modal dialog. I have no
idea why, and the stack frame backtrace is junk.
I also can't seem to abort the failed loading process. If I call
Program::unloadMedia(), I get a nasty segfault. Again with a really
nasty stack trace. So for now, it'll just end up sitting there emulating
an empty ROM (solid black screen.) In time, I'd like to fix that too.
Lastly, I need a better method than popen for Windows. popen is kind of
ugly and flashes a console window for a brief second even if the
application launched is linked with -mwindows. Not sure if there even is
one (I need to read the stdout result, so CreateProcess may not work
unless I do something nasty like "> %tmp%/temp") I'm also using the
regular popen instead of _wpopen, so for this WIP, it won't work if your
game folder has non-English letters in the path.
2015-08-04 09:00:55 +00:00
|
|
|
if(required) MessageDialog().setTitle("higan").setText({
|
2015-09-28 11:56:46 +00:00
|
|
|
"Missing required file: ", nall::filename(location), "\n\n",
|
|
|
|
"From location:\n", nall::pathname(location)
|
Update to v094r39 release.
byuu says:
Changelog:
- SNES mid-scanline BGMODE fixes finally merged (can run
atx2.zip{mode7.smc}+mtest(2).sfc properly now)
- Makefile now discards all built-in rules and variables
- switch on bool warning disabled for GCC now as well (was already
disabled for Clang)
- when loading a game, if any required files are missing, display
a warning message box (manifest.bml, program.rom, bios.rom, etc)
- when loading a game (or a game slot), if manifest.bml is missing, it
will invoke icarus to try and generate it
- if that fails (icarus is missing or the folder is bad), you will get
a warning telling you that the manifest can't be loaded
The warning prompt on missing files work for both games and the .sys
folders and their files. For some reason, failing to load the DMG/CGB
BIOS is causing a crash before I can display the modal dialog. I have no
idea why, and the stack frame backtrace is junk.
I also can't seem to abort the failed loading process. If I call
Program::unloadMedia(), I get a nasty segfault. Again with a really
nasty stack trace. So for now, it'll just end up sitting there emulating
an empty ROM (solid black screen.) In time, I'd like to fix that too.
Lastly, I need a better method than popen for Windows. popen is kind of
ugly and flashes a console window for a brief second even if the
application launched is linked with -mwindows. Not sure if there even is
one (I need to read the stdout result, so CreateProcess may not work
unless I do something nasty like "> %tmp%/temp") I'm also using the
regular popen instead of _wpopen, so for this WIP, it won't work if your
game folder has non-English letters in the path.
2015-08-04 09:00:55 +00:00
|
|
|
}).error();
|
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
|
Update to v094r39 release.
byuu says:
Changelog:
- SNES mid-scanline BGMODE fixes finally merged (can run
atx2.zip{mode7.smc}+mtest(2).sfc properly now)
- Makefile now discards all built-in rules and variables
- switch on bool warning disabled for GCC now as well (was already
disabled for Clang)
- when loading a game, if any required files are missing, display
a warning message box (manifest.bml, program.rom, bios.rom, etc)
- when loading a game (or a game slot), if manifest.bml is missing, it
will invoke icarus to try and generate it
- if that fails (icarus is missing or the folder is bad), you will get
a warning telling you that the manifest can't be loaded
The warning prompt on missing files work for both games and the .sys
folders and their files. For some reason, failing to load the DMG/CGB
BIOS is causing a crash before I can display the modal dialog. I have no
idea why, and the stack frame backtrace is junk.
I also can't seem to abort the failed loading process. If I call
Program::unloadMedia(), I get a nasty segfault. Again with a really
nasty stack trace. So for now, it'll just end up sitting there emulating
an empty ROM (solid black screen.) In time, I'd like to fix that too.
Lastly, I need a better method than popen for Windows. popen is kind of
ugly and flashes a console window for a brief second even if the
application launched is linked with -mwindows. Not sure if there even is
one (I need to read the stdout result, so CreateProcess may not work
unless I do something nasty like "> %tmp%/temp") I'm also using the
regular popen instead of _wpopen, so for this WIP, it won't work if your
game folder has non-English letters in the path.
2015-08-04 09:00:55 +00:00
|
|
|
auto Program::saveRequest(unsigned id, string filename) -> void {
|
|
|
|
string pathname = mediaPaths(emulator->group(id));
|
|
|
|
string location = {pathname, filename};
|
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 {
|
2015-11-16 08:38:05 +00:00
|
|
|
if(settings["Video/Saturation"].natural() != 100) {
|
2015-06-15 22:26:47 +00:00
|
|
|
uint16 grayscale = uclamp<16>((r + g + b) / 3);
|
2015-11-16 08:38:05 +00:00
|
|
|
double saturation = settings["Video/Saturation"].natural() * 0.01;
|
2015-06-15 22:26:47 +00:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2015-11-16 08:38:05 +00:00
|
|
|
if(settings["Video/Gamma"].natural() != 100) {
|
|
|
|
double exponent = settings["Video/Gamma"].natural() * 0.01;
|
2015-06-15 22:26:47 +00:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2015-11-16 08:38:05 +00:00
|
|
|
if(settings["Video/Luminance"].natural() != 100) {
|
|
|
|
double luminance = settings["Video/Luminance"].natural() * 0.01;
|
2015-06-15 22:26:47 +00:00
|
|
|
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;
|
|
|
|
|
2015-06-20 05:44:05 +00:00
|
|
|
if(video->lock(output, length, width, height)) {
|
2015-02-28 01:51:53 +00:00
|
|
|
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-11-16 08:38:05 +00:00
|
|
|
if(emulator->information.overscan && settings["Video/Overscan/Mask"].boolean()) {
|
|
|
|
auto h = settings["Video/Overscan/Horizontal"].natural();
|
|
|
|
auto v = settings["Video/Overscan/Vertical"].natural();
|
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-06-20 05:44:05 +00:00
|
|
|
video->unlock();
|
|
|
|
video->refresh();
|
2015-02-28 01:51:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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);
|
2015-06-20 05:44:05 +00:00
|
|
|
audio->sample(samples[0], samples[1]);
|
2015-02-28 01:51:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
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 {
|
2015-08-24 09:42:11 +00:00
|
|
|
if(presentation->focused() || !enable) {
|
|
|
|
auto guid = emulator->port[port].device[device].input[input].guid;
|
|
|
|
auto mapping = (InputMapping*)guid;
|
|
|
|
if(mapping) return mapping->rumble(enable);
|
|
|
|
}
|
2015-02-28 01:51:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
auto Program::dipSettings(const Markup::Node& node) -> unsigned {
|
|
|
|
}
|
|
|
|
|
|
|
|
auto Program::path(unsigned group) -> string {
|
|
|
|
return mediaPaths(group);
|
|
|
|
}
|
|
|
|
|
|
|
|
auto Program::notify(string text) -> void {
|
|
|
|
}
|