1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-25 09:30:35 +00:00
hyperrogue/hyper.cpp

73 lines
1.8 KiB
C++
Raw Normal View History

2015-08-08 13:57:52 +00:00
// Hyperbolic Rogue
// 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-12 12:12:08 +00:00
hookset<bool(int argc, const char** argv)> *hooks_main;
2017-07-10 18:47:38 +00:00
2017-07-04 13:38:33 +00:00
#ifndef NOMAIN
2018-02-12 12:12:08 +00:00
int main(int argc, const char **argv) {
#if ISWEB
emscripten_get_commandline(argc, argv);
#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
#endif
#if CAP_COMMANDLINE
2017-03-23 10:53:57 +00:00
arg::init(argc, argv);
initializeCLI();
2016-08-26 09:58:03 +00:00
#endif
2017-03-23 10:53:57 +00:00
initAll();
#if CAP_COMMANDLINE
2017-03-23 10:53:57 +00:00
arg::read(3);
#endif
2017-08-06 12:50:16 +00:00
if(showstartmenu)
pushScreen(showStartMenu);
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;
}
#endif
2017-10-29 13:19:51 +00:00
#endif