MCPcopy Create free account
hub / github.com/Aloshi/EmulationStation / launchGame

Method launchGame

src/SystemData.cpp:70–102  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

68}
69
70void SystemData::launchGame(Window* window, GameData* game)
71{
72 LOG(LogInfo) << "Attempting to launch game...";
73
74 AudioManager::getInstance()->deinit();
75 VolumeControl::getInstance()->deinit();
76 window->deinit();
77
78 std::string command = mLaunchCommand;
79
80 command = strreplace(command, "%ROM%", game->getBashPath());
81 command = strreplace(command, "%BASENAME%", game->getBaseName());
82 command = strreplace(command, "%ROM_RAW%", game->getPath());
83
84 LOG(LogInfo) << " " << command;
85 std::cout << "==============================================\n";
86 int exitCode = system(command.c_str());
87 std::cout << "==============================================\n";
88
89 if(exitCode != 0)
90 {
91 LOG(LogWarning) << "...launch terminated with nonzero exit code " << exitCode << "!";
92 }
93
94 window->init();
95 VolumeControl::getInstance()->init();
96 AudioManager::getInstance()->init();
97 window->normalizeNextUpdate();
98
99 //update number of times the game has been launched and the time
100 game->setTimesPlayed(game->getTimesPlayed() + 1);
101 game->setLastPlayed(std::time(nullptr));
102}
103
104void SystemData::populateFolder(FolderData* folder)
105{

Callers 1

Calls 9

strreplaceFunction · 0.85
getBashPathMethod · 0.80
getBaseNameMethod · 0.80
normalizeNextUpdateMethod · 0.80
setTimesPlayedMethod · 0.80
getTimesPlayedMethod · 0.80
setLastPlayedMethod · 0.80
deinitMethod · 0.45
initMethod · 0.45

Tested by

no test coverage detected