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;
|
|
|
|
|
|
|
|
Program::Program() {
|
|
|
|
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});
|
|
|
|
|
|
|
|
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-03 10:14:49 +00:00
|
|
|
new ConfigurationManager;
|
2015-03-02 09:13:28 +00:00
|
|
|
new InputManager;
|
2015-02-28 01:51:53 +00:00
|
|
|
new LibraryManager;
|
2015-03-02 09:13:28 +00:00
|
|
|
new SettingsManager;
|
2015-02-28 01:51:53 +00:00
|
|
|
new Presentation;
|
|
|
|
|
|
|
|
presentation->setVisible();
|
|
|
|
|
2015-03-03 10:14:49 +00:00
|
|
|
video.driver(config().video.driver);
|
2015-02-28 01:51:53 +00:00
|
|
|
video.set(Video::Handle, presentation->viewport.handle());
|
2015-03-03 10:14:49 +00:00
|
|
|
video.set(Video::Synchronize, config().video.synchronize);
|
2015-02-28 01:51:53 +00:00
|
|
|
if(!video.init()) { video.driver("None"); video.init(); }
|
|
|
|
|
2015-03-03 10:14:49 +00:00
|
|
|
audio.driver(config().audio.driver);
|
2015-02-28 01:51:53 +00:00
|
|
|
audio.set(Audio::Handle, presentation->viewport.handle());
|
2015-03-03 10:14:49 +00:00
|
|
|
audio.set(Audio::Synchronize, config().audio.synchronize);
|
2015-02-28 01:51:53 +00:00
|
|
|
audio.set(Audio::Frequency, 96000u);
|
|
|
|
audio.set(Audio::Latency, 80u);
|
|
|
|
if(!audio.init()) { audio.driver("None"); audio.init(); }
|
|
|
|
|
2015-03-03 10:14:49 +00:00
|
|
|
input.driver(config().input.driver);
|
2015-02-28 01:51:53 +00:00
|
|
|
input.set(Input::Handle, presentation->viewport.handle());
|
|
|
|
if(!input.init()) { input.driver("None"); input.init(); }
|
|
|
|
|
|
|
|
dsp.setPrecision(16);
|
|
|
|
dsp.setBalance(0.0);
|
2015-03-03 10:14:49 +00:00
|
|
|
dsp.setVolume(config().audio.mute ? 0.0 : 1.0);
|
2015-02-28 01:51:53 +00:00
|
|
|
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-02-28 01:51:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
auto Program::emulator() -> Emulator::Interface& {
|
2015-04-13 11:16:33 +00:00
|
|
|
if(!activeEmulator) throw;
|
2015-02-28 01:51:53 +00:00
|
|
|
return *activeEmulator;
|
|
|
|
}
|
|
|
|
|
|
|
|
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-13 11:16:33 +00:00
|
|
|
if(!activeEmulator || emulator().loaded() == false) {
|
2015-02-28 01:51:53 +00:00
|
|
|
audio.clear();
|
|
|
|
usleep(20 * 1000);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
emulator().run();
|
|
|
|
}
|
|
|
|
|
2015-03-02 09:13:28 +00:00
|
|
|
auto Program::quit() -> void {
|
|
|
|
unloadMedia();
|
2015-03-03 10:14:49 +00:00
|
|
|
configurationManager->quit();
|
2015-03-02 09:13:28 +00:00
|
|
|
inputManager->quit();
|
2015-03-03 10:14:49 +00:00
|
|
|
video.term();
|
|
|
|
audio.term();
|
|
|
|
input.term();
|
|
|
|
Application::quit();
|
2015-03-02 09:13:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
auto Program::setEmulator(Emulator::Interface* emulator) -> void {
|
|
|
|
activeEmulator = emulator;
|
|
|
|
}
|