Changeset View
Changeset View
Standalone View
Standalone View
source/main.cpp
Show First 20 Lines • Show All 102 Lines • ▼ Show 20 Lines | |||||
// We don't want to include Windows.h as it might mess up the rest | // We don't want to include Windows.h as it might mess up the rest | ||||
// of the file so we just define DWORD as done in Windef.h. | // of the file so we just define DWORD as done in Windef.h. | ||||
#ifndef DWORD | #ifndef DWORD | ||||
typedef unsigned long DWORD; | typedef unsigned long DWORD; | ||||
#endif // !DWORD | #endif // !DWORD | ||||
// Request the high performance GPU on Windows by default if no system override is specified. | // Request the high performance GPU on Windows by default if no system override is specified. | ||||
// See: | // See: | ||||
// - https://github.com/supertuxkart/stk-code/pull/4693/commits/0a99c667ef513b2ce0f5755729a6e05df8aac48a | // - https://github.com/supertuxkart/stk-code/pull/4693/commits/0a99c667ef513b2ce0f5755729a6e05df8aac48a | ||||
// - https://docs.nvidia.com/gameworks/content/technologies/desktop/optimus.htm | // - https://docs.nvidia.com/gameworks/content/technologies/desktop/optimus.htm | ||||
// - https://gpuopen.com/learn/amdpowerxpressrequesthighperformance/ | // - https://gpuopen.com/learn/amdpowerxpressrequesthighperformance/ | ||||
extern "C" | extern "C" | ||||
{ | { | ||||
__declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001; | __declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001; | ||||
__declspec(dllexport) DWORD AmdPowerXpressRequestHighPerformance = 0x00000001; | __declspec(dllexport) DWORD AmdPowerXpressRequestHighPerformance = 0x00000001; | ||||
} | } | ||||
#endif | #endif | ||||
#include <chrono> | #include <chrono> | ||||
▲ Show 20 Lines • Show All 370 Lines • ▼ Show 20 Lines | if (!args.Get("rl-interface").empty()) | ||||
server_address = args.Get("rl-interface"); | server_address = args.Get("rl-interface"); | ||||
g_RLInterface = std::make_unique<RL::Interface>(server_address.c_str()); | g_RLInterface = std::make_unique<RL::Interface>(server_address.c_str()); | ||||
debug_printf("RL interface listening on %s\n", server_address.c_str()); | debug_printf("RL interface listening on %s\n", server_address.c_str()); | ||||
} | } | ||||
// moved into a helper function to ensure args is destroyed before | // moved into a helper function to ensure args is destroyed before | ||||
// exit(), which may result in a memory leak. | // exit(), which may result in a memory leak. | ||||
static void RunGameOrAtlas(int argc, const char* argv[]) | static void RunGameOrAtlas(const PS::span<const char* const> argv) | ||||
{ | { | ||||
CmdLineArgs args(argc, argv); | const CmdLineArgs args(argv); | ||||
vladislavbelov: Might be `const`. | |||||
g_CmdLineArgs = args; | g_CmdLineArgs = args; | ||||
if (args.Has("version")) | if (args.Has("version")) | ||||
{ | { | ||||
debug_printf("Pyrogenesis %s\n", engine_version); | debug_printf("Pyrogenesis %s\n", engine_version); | ||||
return; | return; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 221 Lines • ▼ Show 20 Lines | std::cerr << "********************************************************\n" | ||||
<<" logged in as root or used e.g. the 'sudo' command.) \n" | <<" logged in as root or used e.g. the 'sudo' command.) \n" | ||||
<< "********************************************************\n\n"; | << "********************************************************\n\n"; | ||||
return EXIT_FAILURE; | return EXIT_FAILURE; | ||||
} | } | ||||
#endif // OS_UNIX | #endif // OS_UNIX | ||||
EarlyInit(); // must come at beginning of main | EarlyInit(); // must come at beginning of main | ||||
RunGameOrAtlas(argc, const_cast<const char**>(argv)); | // static_cast is ok, argc is never negative. | ||||
RunGameOrAtlas({argv, static_cast<std::size_t>(argc)}); | |||||
Done Inline ActionsPossible you need to change something for macOS on some .mm file. Stan: Possible you need to change something for macOS on some .mm file.
If it's required to be non… | |||||
Done Inline ActionsMacOS don't has ther own implementation IIRC, did you mix it up with startNewAtlasProcess? phosit: MacOS don't has ther own implementation IIRC, did you mix it up with `startNewAtlasProcess`? | |||||
Done Inline ActionsAh right. Just worth pointing it out :) Stan: Ah right. Just worth pointing it out :) | |||||
Done Inline ActionsStan perfers size_t over std::size_t for consistency :) vladislavbelov: Stan perfers `size_t` over `std::size_t` for consistency :) | |||||
Done Inline ActionsWell I don't particularly, but conventions says, follow conventions in the edited file. Stan: Well I don't particularly, but conventions says, follow conventions in the edited file. | |||||
// Shut down profiler initialised by EarlyInit | // Shut down profiler initialised by EarlyInit | ||||
g_Profiler2.Shutdown(); | g_Profiler2.Shutdown(); | ||||
return EXIT_SUCCESS; | return EXIT_SUCCESS; | ||||
} | } |
Wildfire Games · Phabricator
Might be const.