2015-02-28 01:51:53 +00:00
|
|
|
#include "../tomoko.hpp"
|
|
|
|
#include <fc/interface/interface.hpp>
|
|
|
|
#include <sfc/interface/interface.hpp>
|
|
|
|
#include <gb/interface/interface.hpp>
|
|
|
|
#include <gba/interface/interface.hpp>
|
|
|
|
#include "interface.cpp"
|
|
|
|
#include "media.cpp"
|
2015-04-13 11:16:33 +00:00
|
|
|
#include "state.cpp"
|
Update to v094r13 release.
byuu says:
This version polishes up the input dialogue (reset, erase, disable
button when item not focused, split device ID from mapping name), adds
color emulation toggle, and add dummy menu items for remaining features
(to be filled in later.)
Also, it now compiles cleanly on Windows with GTK.
I didn't test with TDM-GCC-32, because for god knows what reason, the
32-bit version ships with headers from Windows 95 OSR2 only. So I built
with TDM-GCC-64 with arch=x86.
And uh, apparently, moving or resizing a window causes a Visual C++
runtime exception in the GTK+ DLLs. This doesn't happen with trance or
renshuu built with TDM-GCC-32. So, yeah, like I said, don't use -m32.
2015-03-07 10:21:47 +00:00
|
|
|
#include "utility.cpp"
|
2015-02-28 01:51:53 +00:00
|
|
|
Program* program = nullptr;
|
|
|
|
|
2015-08-21 10:56:39 +00:00
|
|
|
Program::Program(lstring args) {
|
2015-02-28 01:51:53 +00:00
|
|
|
program = this;
|
2016-01-15 10:28:51 +00:00
|
|
|
directory::create({localpath(), "higan/"});
|
2015-02-28 01:51:53 +00:00
|
|
|
Application::onMain({&Program::main, this});
|
|
|
|
|
|
|
|
emulators.append(new Famicom::Interface);
|
|
|
|
emulators.append(new SuperFamicom::Interface);
|
|
|
|
emulators.append(new GameBoy::Interface);
|
|
|
|
emulators.append(new GameBoyAdvance::Interface);
|
|
|
|
for(auto& emulator : emulators) emulator->bind = this;
|
|
|
|
|
2015-03-02 09:13:28 +00:00
|
|
|
new InputManager;
|
|
|
|
new SettingsManager;
|
2015-04-21 11:51:57 +00:00
|
|
|
new CheatDatabase;
|
|
|
|
new ToolsManager;
|
2015-02-28 01:51:53 +00:00
|
|
|
new Presentation;
|
|
|
|
|
|
|
|
presentation->setVisible();
|
|
|
|
|
2015-11-16 08:38:05 +00:00
|
|
|
video = Video::create(settings["Video/Driver"].text());
|
2015-06-20 05:44:05 +00:00
|
|
|
video->set(Video::Handle, presentation->viewport.handle());
|
2015-11-16 08:38:05 +00:00
|
|
|
video->set(Video::Synchronize, settings["Video/Synchronize"].boolean());
|
2015-06-20 05:44:05 +00:00
|
|
|
if(!video->init()) {
|
|
|
|
delete video;
|
|
|
|
video = Video::create("None");
|
|
|
|
}
|
2015-02-28 01:51:53 +00:00
|
|
|
|
2015-11-16 08:38:05 +00:00
|
|
|
audio = Audio::create(settings["Audio/Driver"].text());
|
|
|
|
audio->set(Audio::Device, settings["Audio/Device"].text());
|
2015-06-20 05:44:05 +00:00
|
|
|
audio->set(Audio::Handle, presentation->viewport.handle());
|
2015-11-16 08:38:05 +00:00
|
|
|
audio->set(Audio::Synchronize, settings["Audio/Synchronize"].boolean());
|
2015-06-20 05:44:05 +00:00
|
|
|
audio->set(Audio::Frequency, 96000u);
|
|
|
|
audio->set(Audio::Latency, 80u);
|
|
|
|
if(!audio->init()) {
|
|
|
|
delete audio;
|
|
|
|
audio = Audio::create("None");
|
|
|
|
}
|
2015-02-28 01:51:53 +00:00
|
|
|
|
2015-11-16 08:38:05 +00:00
|
|
|
input = Input::create(settings["Input/Driver"].text());
|
2015-06-20 05:44:05 +00:00
|
|
|
input->set(Input::Handle, presentation->viewport.handle());
|
|
|
|
input->onChange({&InputManager::onChange, inputManager});
|
|
|
|
if(!input->init()) {
|
|
|
|
delete input;
|
|
|
|
input = Input::create("None");
|
|
|
|
}
|
2015-02-28 01:51:53 +00:00
|
|
|
|
|
|
|
dsp.setPrecision(16);
|
|
|
|
dsp.setBalance(0.0);
|
|
|
|
dsp.setFrequency(32040);
|
|
|
|
dsp.setResampler(DSP::ResampleEngine::Sinc);
|
|
|
|
dsp.setResamplerFrequency(96000);
|
|
|
|
|
2015-03-03 10:14:49 +00:00
|
|
|
presentation->drawSplashScreen();
|
Update to v094r13 release.
byuu says:
This version polishes up the input dialogue (reset, erase, disable
button when item not focused, split device ID from mapping name), adds
color emulation toggle, and add dummy menu items for remaining features
(to be filled in later.)
Also, it now compiles cleanly on Windows with GTK.
I didn't test with TDM-GCC-32, because for god knows what reason, the
32-bit version ships with headers from Windows 95 OSR2 only. So I built
with TDM-GCC-64 with arch=x86.
And uh, apparently, moving or resizing a window causes a Visual C++
runtime exception in the GTK+ DLLs. This doesn't happen with trance or
renshuu built with TDM-GCC-32. So, yeah, like I said, don't use -m32.
2015-03-07 10:21:47 +00:00
|
|
|
|
2016-01-15 10:28:51 +00:00
|
|
|
updateVideoShader();
|
2015-11-16 08:38:05 +00:00
|
|
|
updateAudioVolume();
|
2015-08-21 10:56:39 +00:00
|
|
|
|
Update to v094r43 release.
byuu says:
Updated to compile with all of the new hiro changes. My next step is to
write up hiro API documentation, and move the API from alpha (constantly
changing) to beta (rarely changing), in preparation for the first stable
release (backward-compatible changes only.)
Added "--fullscreen" command-line option. I like this over
a configuration file option. Lets you use the emulator in both modes
without having to modify the config file each time.
Also enhanced the command-line game loading. You can now use any of
these methods:
higan /path/to/game-folder.sfc
higan /path/to/game-folder.sfc/
higan /path/to/game-folder.sfc/program.rom
The idea is to support launchers that insist on loading files only.
Technically, the file can be any name (manifest.bml also works); the
only criteria is that the file actually exists and is a file, and not
a directory. This is a requirement to support the first version (a
directory lacking the trailing / identifier), because I don't want my
nall::string class to query the file system to determine if the string
is an actual existing file or directory for its pathname() / dirname()
functions.
Anyway, every game folder I've made so far has program.rom, and that's
very unlikely to change, so this should be fine.
Now, of course, if you drop a regular "game.sfc" file on the emulator,
it won't even try to load it, unless it's in a folder that ends in .fc,
.sfc, etc. In which case, it'll bail out immediately by being unable to
produce a manifest for what is obviously not really a game folder.
2015-08-30 02:08:26 +00:00
|
|
|
args.takeFirst(); //ignore program location in argument parsing
|
|
|
|
for(auto& argument : args) {
|
|
|
|
if(argument == "--fullscreen") {
|
|
|
|
presentation->toggleFullScreen();
|
|
|
|
} else {
|
Update to v096r07 release.
byuu says:
Changelog:
- configuration files are now stored in localpath() instead of configpath()
- Video gamma/saturation/luminance sliders are gone now, sorry
- added Video Filter->Blur Emulation [1]
- added Video Filter->Scanline Emulation [2]
- improvements to GBA audio emulation (fixes Minish Cap) [Jonas Quinn]
[1] For the Famicom, this does nothing. For the Super Famicom, this
performs horizontal blending for proper pseudo-hires translucency. For
the Game Boy, Game Boy Color, and Game Boy Advance, this performs
interframe blending (each frame is the average of the current and
previous frame), which is important for things like the GBVideoPlayer.
[2] Right now, this only applies to the Super Famicom, but it'll come to
the Famicom in the future. For the Super Famicom, this option doesn't
just add scanlines, it simulates the phosphor decay that's visible in
interlace mode. If you observe an interlaced game like RPM Racing on
a real SNES, you'll notice that even on perfectly still screens, the
image appears to shake. This option emulates that effect.
Note 1: the buffering right now is a little sub-optimal, so there will
be a slight speed hit with this new support. Since the core is now
generating native ARGB8888 colors, it might as well call out to the
interface to lock/unlock/refresh the video, that way it can render
directly to the screen. Although ... that might not be such a hot idea,
since the GBx interframe blending reads from the target buffer, and that
tends to be a catastrophic option for performance.
Note 2: the balanced and performance profiles for the SNES are
completely busted again. This WIP took 6 1/2 hours, and I'm exhausted.
Very much not looking forward to working on those, since those two have
all kinds of fucked up speedup tricks for non-interlaced and/or
non-hires video modes.
Note 3: if you're on Windows and you saved your system folders somewhere
else, now'd be a good time to move them to %localappdata%/higan
2016-01-15 10:06:51 +00:00
|
|
|
load(argument);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
auto Program::load(string location) -> void {
|
|
|
|
if(directory::exists(location)) {
|
|
|
|
loadMedia(location);
|
|
|
|
} else if(file::exists(location)) {
|
|
|
|
//special handling to allow importing the Game Boy Advance BIOS
|
|
|
|
if(file::size(location) == 16384 && file::sha256(location).beginsWith("fd2547724b505f48")) {
|
|
|
|
auto target = locate({localpath(), "higan/"}, "Game Boy Advance.sys/");
|
|
|
|
if(file::copy(location, {target, "bios.rom"})) {
|
|
|
|
MessageDialog().setTitle(Emulator::Name).setText("Game Boy Advance BIOS imported successfully!").information();
|
Update to v096r06 release.
byuu says:
This WIP finally achieves the vision I've had for icarus.
I also fixed a mapping issue with Cx4 that, oddly enough, only caused
the "2" from the Mega Man X2 title screen to disappear.
[Editor's note - "the vision for icarus" was described in a separate,
public forum post: http://board.byuu.org/phpbb3/viewtopic.php?p=20584
Quoting for posterity:
icarus is now a full-fledged part of higan, and will be bundled with
each higan WIP as well. This will ensure that in the future, the
exact version of icarus you need to run higan will be included right
along with it. As of this WIP, physical manifest files are now truly
and entirely optional.
From now on, you can associate your ROM image files with higan's
main binary, or drop them directly on top of it, to load and play
your games.
Furthermore, there are two new menu options that appear under the
library menu when icarus is present:
- "Load ROM File ..." => gives you a single-file selection dialog to
import (and if possible) run the game
- "Import ROM Files ..." => gives you a multi-file import dialog
with checkboxes to pull in multiple games at once
Finally, as before, icarus can generate manifest.bml files for
folders that lack them.
For people who like the game folder and library system, nothing's
changed. Keep using higan as you have been.
For people who hate it, you can now use higan like your classic
emulators. Treat the "Library->{System Name}" entries as your
"favorites" list: the games you actually play. Treat the
"Library->Load ROM" as your standard open file dialog in other
emulators. And finally, treat "Advanced->Game Library" as your save
data path for cheat codes, save states, save RAM, etc.
]
2016-01-13 10:47:45 +00:00
|
|
|
}
|
Update to v096r07 release.
byuu says:
Changelog:
- configuration files are now stored in localpath() instead of configpath()
- Video gamma/saturation/luminance sliders are gone now, sorry
- added Video Filter->Blur Emulation [1]
- added Video Filter->Scanline Emulation [2]
- improvements to GBA audio emulation (fixes Minish Cap) [Jonas Quinn]
[1] For the Famicom, this does nothing. For the Super Famicom, this
performs horizontal blending for proper pseudo-hires translucency. For
the Game Boy, Game Boy Color, and Game Boy Advance, this performs
interframe blending (each frame is the average of the current and
previous frame), which is important for things like the GBVideoPlayer.
[2] Right now, this only applies to the Super Famicom, but it'll come to
the Famicom in the future. For the Super Famicom, this option doesn't
just add scanlines, it simulates the phosphor decay that's visible in
interlace mode. If you observe an interlaced game like RPM Racing on
a real SNES, you'll notice that even on perfectly still screens, the
image appears to shake. This option emulates that effect.
Note 1: the buffering right now is a little sub-optimal, so there will
be a slight speed hit with this new support. Since the core is now
generating native ARGB8888 colors, it might as well call out to the
interface to lock/unlock/refresh the video, that way it can render
directly to the screen. Although ... that might not be such a hot idea,
since the GBx interframe blending reads from the target buffer, and that
tends to be a catastrophic option for performance.
Note 2: the balanced and performance profiles for the SNES are
completely busted again. This WIP took 6 1/2 hours, and I'm exhausted.
Very much not looking forward to working on those, since those two have
all kinds of fucked up speedup tricks for non-interlaced and/or
non-hires video modes.
Note 3: if you're on Windows and you saved your system folders somewhere
else, now'd be a good time to move them to %localappdata%/higan
2016-01-15 10:06:51 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
//ask icarus to import the game; and play it upon success
|
|
|
|
if(auto result = execute("icarus", "--import", location)) {
|
|
|
|
loadMedia(result.strip());
|
Update to v094r43 release.
byuu says:
Updated to compile with all of the new hiro changes. My next step is to
write up hiro API documentation, and move the API from alpha (constantly
changing) to beta (rarely changing), in preparation for the first stable
release (backward-compatible changes only.)
Added "--fullscreen" command-line option. I like this over
a configuration file option. Lets you use the emulator in both modes
without having to modify the config file each time.
Also enhanced the command-line game loading. You can now use any of
these methods:
higan /path/to/game-folder.sfc
higan /path/to/game-folder.sfc/
higan /path/to/game-folder.sfc/program.rom
The idea is to support launchers that insist on loading files only.
Technically, the file can be any name (manifest.bml also works); the
only criteria is that the file actually exists and is a file, and not
a directory. This is a requirement to support the first version (a
directory lacking the trailing / identifier), because I don't want my
nall::string class to query the file system to determine if the string
is an actual existing file or directory for its pathname() / dirname()
functions.
Anyway, every game folder I've made so far has program.rom, and that's
very unlikely to change, so this should be fine.
Now, of course, if you drop a regular "game.sfc" file on the emulator,
it won't even try to load it, unless it's in a folder that ends in .fc,
.sfc, etc. In which case, it'll bail out immediately by being unable to
produce a manifest for what is obviously not really a game folder.
2015-08-30 02:08:26 +00:00
|
|
|
}
|
2015-08-21 10:56:39 +00:00
|
|
|
}
|
2015-02-28 01:51:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
auto Program::main() -> void {
|
2015-04-13 11:16:33 +00:00
|
|
|
updateStatusText();
|
2015-03-02 09:13:28 +00:00
|
|
|
inputManager->poll();
|
|
|
|
|
2016-01-15 10:28:51 +00:00
|
|
|
if(!emulator || !emulator->loaded() || pause || (!presentation->focused() && settings["Input/FocusLoss/Pause"].boolean())) {
|
2015-06-20 05:44:05 +00:00
|
|
|
audio->clear();
|
2015-02-28 01:51:53 +00:00
|
|
|
usleep(20 * 1000);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2015-04-21 11:51:57 +00:00
|
|
|
emulator->run();
|
2015-02-28 01:51:53 +00:00
|
|
|
}
|
|
|
|
|
2015-03-02 09:13:28 +00:00
|
|
|
auto Program::quit() -> void {
|
|
|
|
unloadMedia();
|
2015-11-16 08:38:05 +00:00
|
|
|
settings.quit();
|
2015-03-02 09:13:28 +00:00
|
|
|
inputManager->quit();
|
2015-06-20 05:44:05 +00:00
|
|
|
delete video;
|
|
|
|
delete audio;
|
|
|
|
delete input;
|
2015-03-03 10:14:49 +00:00
|
|
|
Application::quit();
|
2015-03-02 09:13:28 +00:00
|
|
|
}
|