1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-20 15:40:26 +00:00
hyperrogue/hyper.cpp

78 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
hr::hookset<bool(int argc, char** argv)> *hr::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) {
using namespace hr;
#if ISWEB
2018-02-26 12:14:20 +00:00
emscripten_get_commandline();
#else
arg::init(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
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);
start_game();
#endif
2018-02-12 15:21:19 +00:00
#if !ISWEB
2018-06-23 23:22:50 +00:00
if(showstartmenu && !vid.skipstart)
2017-08-06 12:50:16 +00:00
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;
}
#endif
2017-10-29 13:19:51 +00:00
#endif