MCPcopy Create free account
hub / github.com/Farama-Foundation/Stable-Retro / get

Method get

src/script.cpp:16–35  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14static unordered_map<string, shared_ptr<ScriptContext>> s_scriptContexts;
15
16shared_ptr<ScriptContext> ScriptContext::get(const string& type) {
17 if (type.empty() && s_scriptContexts.size() == 1) {
18 return s_scriptContexts.begin()->second;
19 }
20 const auto& foundContext = s_scriptContexts.find(type);
21 if (foundContext != s_scriptContexts.end()) {
22 return foundContext->second;
23 }
24
25 const auto& found = s_scriptTypes.find(type);
26 if (found == s_scriptTypes.end()) {
27 return nullptr;
28 }
29 shared_ptr<ScriptContext> context = found->second();
30 if (!context->init()) {
31 return nullptr;
32 }
33 s_scriptContexts[type] = context;
34 return context;
35}
36
37vector<string> ScriptContext::listContexts() {
38 vector<string> contexts;

Callers 15

runMethod · 0.45
lookupValueMethod · 0.45
lookupAllMethod · 0.45
configureMethod · 0.45
loadGameMethod · 0.45
dataMethod · 0.45
scenarioMethod · 0.45
_load_benchmark_specsFunction · 0.45
mainFunction · 0.45
conf.pyFile · 0.45
get_fbneo_rom_nameFunction · 0.45

Calls 6

emptyMethod · 0.45
sizeMethod · 0.45
beginMethod · 0.45
findMethod · 0.45
endMethod · 0.45
initMethod · 0.45

Tested by

no test coverage detected