int main(int argc, char *argv[]) { const char *dataPath = "DATA"; const char *savePath = "."; for (int i = 1; i < argc; ++i) { bool opt = false; if (strlen(argv[i]) >= 2) { opt |= parseOption(argv[i], "datapath=", &dataPath); opt |= parseOption(argv[i], "savepath=", &savePath); } if (!opt) { printf(USAGE); return 0; } } Version ver = detectVersion(dataPath); g_debugMask = DBG_INFO; // DBG_CUT | DBG_VIDEO | DBG_RES | DBG_MENU | DBG_PGE | DBG_GAME | DBG_UNPACK | DBG_COL | DBG_MOD | DBG_SFX; SystemStub *stub = SystemStub_SDL_create(); Game *g = new Game(stub, dataPath, savePath, ver); g->run(); delete g; delete stub; return 0; }
int main(int argc, char *argv[]) { const char *dataPath = "DATA"; const char *savePath = "."; const char *levelNum = "0"; char dataPathBuffer[256]; char savePathBuffer[256]; for (int i = 1; i < argc; ++i) { bool opt = false; if (strlen(argv[i]) >= 2) { opt |= parseOption(argv[i], "datapath=", &dataPath); opt |= parseOption(argv[i], "savepath=", &savePath); opt |= parseOption(argv[i], "levelnum=", &levelNum); } if (!opt) { printf(USAGE, argv[0]); return 0; } } #ifdef GCW0 debug(DBG_INFO,"Software version: %s",Game::_version); if(argc<=1){ debug(DBG_INFO, "No arguments given"); char basepath[256]; strcpy(basepath, getenv("HOME")); mkdir(basepath, 0777); strcat(basepath, "/.REminiscence"); strcpy(dataPathBuffer,basepath); strcpy(savePathBuffer,basepath); strcat(dataPathBuffer, "/data"); strcat(savePathBuffer, "/save"); //create directory if they do not exist... mkdir(basepath, 0777); mkdir(savePathBuffer, 0777); mkdir(dataPathBuffer, 0777); dataPath=dataPathBuffer; savePath=savePathBuffer; } #endif g_debugMask = DBG_INFO; // DBG_CUT | DBG_VIDEO | DBG_RES | DBG_MENU | DBG_PGE | DBG_GAME | DBG_UNPACK | DBG_COL | DBG_MOD | DBG_SFX | DBG_FILE; FileSystem fs(dataPath); SystemStub *stub = SystemStub_SDL_create(); const int version = detectVersion(&fs); if (version == -1) { #ifdef GCW0 //display an instruction screen stub->init("help", Video::GAMESCREEN_W, Video::GAMESCREEN_H,new Config()); stub->setPalette(_instr_data_pal,256); stub->copyRect(0, 0, Video::GAMESCREEN_W, Video::GAMESCREEN_H, _instr_data_map, 256); stub->updateScreen(0); while (!stub->_pi.quit) { stub->processEvents(); if (stub->_pi.enter) { stub->_pi.enter = false; break; } stub->sleep(100); } delete stub; #endif error("Unable to find data files, check that all required files are present"); return -1; } Language language = detectLanguage(&fs); Game *g = new Game(stub, &fs, savePath, atoi(levelNum), (ResourceType)version, language); g->run(); delete g; delete stub; return 0; }