1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-11-10 15:59:53 +00:00
hyperrogue/hyper.cpp

82 lines
1.9 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-12-17 10:33:52 +00:00
if(showstartmenu && !vid.skipstart) {
2019-02-17 17:43:39 +00:00
#if CAP_STARTANIM
2018-12-17 10:33:52 +00:00
startanims::pick();
2019-02-17 17:43:39 +00:00
#endif
2017-08-06 12:50:16 +00:00
pushScreen(showStartMenu);
2018-12-17 10:33:52 +00:00
}
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