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;
|
2015-03-02 09:13:28 +00:00
|
|
|
directory::create({configpath(), "tomoko/"});
|
2015-02-28 01:51:53 +00:00
|
|
|
Application::onMain({&Program::main, this});
|
2015-06-20 05:44:05 +00:00
|
|
|
Application::Windows::onModalChange([](bool modal) { if(modal && audio) audio->clear(); });
|
2015-02-28 01:51:53 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
updateVideoFilter();
|
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 {
|
|
|
|
auto location = argument;
|
|
|
|
if(file::exists(location)) location = dirname(location);
|
|
|
|
if(directory::exists(location)) loadMedia(location);
|
|
|
|
}
|
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();
|
|
|
|
|
2015-04-21 11:51:57 +00:00
|
|
|
if(!emulator || !emulator->loaded() || pause) {
|
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
|
|
|
}
|