MCPcopy Create free account
hub / github.com/EasyRPG/Player / BootGame

Method BootGame

src/scene_gamebrowser.cpp:181–248  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

179}
180
181void Scene_GameBrowser::BootGame() {
182 if (stack.size() > 1 && gamelist_window->GetIndex() == 0) {
183 // ".." -> Go one level up
184 int index = stack.back().index;
185 stack.pop_back();
186 gamelist_window->Refresh(stack.back().filesystem, stack.size() > 1);
187 gamelist_window->SetIndex(index);
188 load_window->SetVisible(false);
189 game_loading = false;
190 return;
191 }
192
193 auto entry = gamelist_window->GetFilesystemEntry();
194
195 if (!entry.fs) {
196 Output::Warning("The selected file or directory cannot be opened");
197 load_window->SetVisible(false);
198 game_loading = false;
199 return;
200 }
201
202 if (entry.type == FileFinder::ProjectType::Unknown) {
203 // Fetched again for platforms where the type is not populated due to bad IO performance
204 entry.type = FileFinder::GetProjectType(entry.fs);
205 }
206
207 if (entry.type > FileFinder::ProjectType::Supported) {
208 // Game is using a known unsupported engine
209 Main_Data::game_system->SePlay(Main_Data::game_system->GetSystemSE(Main_Data::game_system->SFX_Buzzer));
210 Output::Warning(
211 "{} has unsupported engine {}",
212 FileFinder::GetPathAndFilename(entry.fs.GetFullPath()).second,
213 FileFinder::kProjectType.tag(entry.type)
214 );
215 load_window->SetVisible(false);
216 game_loading = false;
217 return;
218 }
219
220 if (entry.type == FileFinder::ProjectType::Unknown && !FileFinder::OpenViewToEasyRpgFile(entry.fs)) {
221 // Not a game: Open as directory
222 load_window->SetVisible(false);
223 game_loading = false;
224 if (!gamelist_window->Refresh(entry.fs, true)) {
225 Output::Warning("The selected file or directory cannot be opened");
226 return;
227 }
228 stack.push_back({ entry.fs, gamelist_window->GetIndex() });
229 gamelist_window->SetIndex(0);
230
231 return;
232 }
233
234 FileFinder::SetGameFilesystem(entry.fs);
235 Player::CreateGameObjects();
236
237 game_loading = false;
238 load_window->SetVisible(false);

Callers

nothing calls this directly

Calls 9

GetFilesystemEntryMethod · 0.80
SePlayMethod · 0.80
GetFullPathMethod · 0.80
sizeMethod · 0.45
GetIndexMethod · 0.45
RefreshMethod · 0.45
SetIndexMethod · 0.45
SetVisibleMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected