-
Notifications
You must be signed in to change notification settings - Fork 167
/
Copy pathbsnes.cpp
64 lines (55 loc) · 2.02 KB
/
bsnes.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#include "bsnes.hpp"
#include <sfc/interface/interface.hpp>
Video video;
Audio audio;
Input input;
unique_pointer<Emulator::Interface> emulator;
auto locate(string name) -> string {
string location = {Path::program(), name};
if(inode::exists(location)) return location;
location = {Path::userData(), "bsnes/", name};
if(inode::exists(location)) return location;
location = {Path::sharedData(), "bsnes/", name};
if(inode::exists(location)) return location;
directory::create({Path::userSettings(), "bsnes/"});
return {Path::userSettings(), "bsnes/", name};
}
#include <nall/main.hpp>
auto nall::main(Arguments arguments) -> void {
settings.location = locate("settings.bml");
for(auto argument : arguments) {
if(argument == "--fullscreen") {
program.startFullScreen = true;
} else if(argument.beginsWith("--locale=")) {
Application::locale().scan(locate("Locale/"));
Application::locale().select(argument.trimLeft("--locale=", 1L));
} else if(argument.beginsWith("--settings=")) {
settings.location = argument.trimLeft("--settings=", 1L);
} else if(inode::exists(argument)) {
//game without option
program.gameQueue.append({"Auto;", argument});
} else if(argument.find(";")) {
//game with option
auto game = argument.split(";", 1L);
if(inode::exists(game.last())) program.gameQueue.append(argument);
}
}
settings.load();
Application::setName("bsnes");
Application::setToolTips(settings.general.toolTips);
Instances::presentation.construct();
Instances::settingsWindow.construct();
Instances::cheatDatabase.construct();
Instances::cheatWindow.construct();
Instances::stateWindow.construct();
Instances::toolsWindow.construct();
emulator = new SuperFamicom::Interface;
program.create();
Application::run();
Instances::presentation.destruct();
Instances::settingsWindow.destruct();
Instances::cheatDatabase.destruct();
Instances::cheatWindow.destruct();
Instances::stateWindow.destruct();
Instances::toolsWindow.destruct();
}