MCPcopy Create free account
hub / github.com/clementgallet/libTAS / build_arg_list

Method build_arg_list

src/program/GameThread.cpp:134–274  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

132}
133
134std::list<std::string> GameThread::build_arg_list(Context *context, int gameArch)
135{
136 bool macappflag = gameArch & BT_MACOSAPP;
137 gameArch &= BT_TYPEMASK;
138
139 /* Build the argument list to be fed to execv */
140 std::list<std::string> arg_list;
141
142 if ((gameArch == BT_PE32) || (gameArch == BT_PE32P) || (gameArch == BT_NE)) {
143 if (context->config.use_proton && !context->config.proton_path.empty()) {
144 /* Change the executable to proton */
145 std::string winepath = context->config.proton_path;
146 winepath += "/dist/bin/wine";
147 if (gameArch == BT_PE32P)
148 winepath += "64";
149 arg_list.push_back(winepath);
150 }
151 else {
152 /* Change the executable to wine */
153 std::string winename = "wine";
154 if (gameArch == BT_PE32P)
155 winename += "64";
156
157 /* wine[64] presence was already checked in ui/ErrorChecking.cpp */
158 std::string cmd = "which ";
159 cmd += winename;
160
161 std::string winepath = queryCmd(cmd);
162 arg_list.push_back(winepath);
163 }
164
165 /* Push the game executable as the first command-line argument */
166 /* Wine can fail if not specifying a Windows path */
167 context->gameexecutable = "Z:" / context->gameexecutable;
168 arg_list.push_back(context->gameexecutable);
169 }
170 else {
171 if (context->attach_gdb) {
172 std::string cmd;
173
174 switch (context->config.debugger) {
175 case Config::DEBUGGER_GDB:
176 cmd = "which gdb";
177 break;
178 case Config::DEBUGGER_LLDB:
179 cmd = "which lldb";
180 break;
181 case Config::DEBUGGER_STRACE:
182 cmd = "which strace";
183 break;
184 }
185
186 std::string dbgpath = queryCmd(cmd);
187 arg_list.push_back(dbgpath);
188
189 std::string ldpreloadstr = context->libtaspath;
190 if (!context->old_ld_preload.empty()) {
191 ldpreloadstr += ":";

Callers

nothing calls this directly

Calls 4

queryCmdFunction · 0.85
extractMacOSExecutableFunction · 0.85
emptyMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected