2015-08-08 13:57:52 +00:00
|
|
|
// Hyperbolic Rogue
|
2018-02-08 23:40:26 +00:00
|
|
|
// Copyright (C) 2011-2018 Zeno Rogue
|
2015-08-08 13:57:52 +00:00
|
|
|
|
|
|
|
// This program is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU General Public License
|
|
|
|
// as published by the Free Software Foundation; either version 2
|
|
|
|
// of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with this program; if not, write to the Free Software
|
|
|
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
|
2017-03-23 10:53:57 +00:00
|
|
|
#include "init.cpp"
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2017-10-29 13:19:51 +00:00
|
|
|
#if CU_HYPER
|
|
|
|
|
2017-07-22 23:33:27 +00:00
|
|
|
#if ISLINUX
|
2016-08-26 09:58:03 +00:00
|
|
|
#include <sys/resource.h>
|
|
|
|
|
|
|
|
void moreStack() {
|
|
|
|
const rlim_t kStackSize = 1 << 28; // 28;
|
|
|
|
struct rlimit rl;
|
|
|
|
int result;
|
|
|
|
|
|
|
|
result = getrlimit(RLIMIT_STACK, &rl);
|
|
|
|
if(result == 0) {
|
|
|
|
if(rl.rlim_cur < kStackSize) {
|
|
|
|
// rl.rlim_cur = 1 << 19; // kStackSize;
|
|
|
|
result = setrlimit(RLIMIT_STACK, &rl);
|
|
|
|
if (result != 0) {
|
|
|
|
fprintf(stderr, "setrlimit returned result = %d\n", result);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2015-08-08 13:57:52 +00:00
|
|
|
}
|
2016-08-26 09:58:03 +00:00
|
|
|
#endif
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2018-02-26 12:14:20 +00:00
|
|
|
hookset<bool(int argc, char** argv)> *hooks_main;
|
2017-07-10 18:47:38 +00:00
|
|
|
|
2017-07-04 13:38:33 +00:00
|
|
|
#ifndef NOMAIN
|
2018-02-26 12:14:20 +00:00
|
|
|
int main(int argc, char **argv) {
|
2018-02-12 11:49:20 +00:00
|
|
|
#if ISWEB
|
2018-02-26 12:14:20 +00:00
|
|
|
emscripten_get_commandline();
|
|
|
|
#else
|
|
|
|
arg::init(argc, argv);
|
2018-02-12 11:49:20 +00:00
|
|
|
#endif
|
2017-07-10 18:47:38 +00:00
|
|
|
if(callhandlers(false, hooks_main, argc, argv)) return 0;
|
2017-07-22 23:33:27 +00:00
|
|
|
#if !ISWEB
|
|
|
|
#if ISLINUX
|
2017-03-23 10:53:57 +00:00
|
|
|
moreStack();
|
|
|
|
#endif
|
2017-12-01 23:22:01 +00:00
|
|
|
#endif
|
|
|
|
#if CAP_COMMANDLINE
|
2017-03-23 10:53:57 +00:00
|
|
|
initializeCLI();
|
2016-08-26 09:58:03 +00:00
|
|
|
#endif
|
2017-03-23 10:53:57 +00:00
|
|
|
initAll();
|
2017-12-01 23:22:01 +00:00
|
|
|
#if CAP_COMMANDLINE
|
2017-03-23 10:53:57 +00:00
|
|
|
arg::read(3);
|
2017-12-01 23:22:01 +00:00
|
|
|
#endif
|
2018-02-12 15:21:19 +00:00
|
|
|
#if !ISWEB
|
2017-08-06 12:50:16 +00:00
|
|
|
if(showstartmenu)
|
|
|
|
pushScreen(showStartMenu);
|
2018-02-12 15:21:19 +00:00
|
|
|
#endif
|
2016-08-26 09:58:03 +00:00
|
|
|
mainloop();
|
2017-03-23 10:53:57 +00:00
|
|
|
finishAll();
|
|
|
|
profile_info();
|
2015-08-08 13:57:52 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2018-02-08 21:27:12 +00:00
|
|
|
#endif
|
2017-10-29 13:19:51 +00:00
|
|
|
#endif
|