static appenv *getappenv() { #define SNAPSHOTS "snapshots" #define BACKUP "backup" #define SCREENSHOTS "screenshots" appenv *app = malloc(sizeof(appenv)); pushobject(app, freeappenv); app->basedir = pathcombc(gethomedir(), "." PACKAGE); createdirectory(app->basedir); app->snapshots = pathcombc(strdups(app->basedir), SNAPSHOTS); createdirectory(app->snapshots); app->backup = pathcombc(strdups(app->basedir), BACKUP); createdirectory(app->backup); app->screenshots = pathcombc(strdups(app->basedir), SCREENSHOTS); createdirectory(app->screenshots); #ifdef DEBUG app->debug = pathcombc(strdups(app->basedir), "debug"); createdirectory(app->debug); #endif return app; }
void initmodules(const string basedir) { log4me_init(LOG_EMU_NONE); #ifdef WIN32 string redirect = pathcombc(strdups(basedir), "output.txt"); log4me_redirectoutput(CSTR(redirect)); strfree(redirect); #endif LIBXML_TEST_VERSION; clock_init(); // initialize SDL video if(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_JOYSTICK)<0) { log4me_error(LOG_EMU_SDL, "Unable to init SDL: %s\n", SDL_GetError()); exit(EXIT_FAILURE); } // make sure SDL cleans up before exit pushexit(SDL_Quit); video_init(); input_init(); seticon(getcurrentwindow()); }
static int readzippedrom(struct zip *fzip, int index, romspecs *rspecs) { const char *filename; filename = zip_get_name(fzip, index, ZIP_FL_UNCHANGED); rspecs->romfilename = pathcombc(gettemppath(), filename); rspecs->deleterom = 1; return fzip2file(fzip, index, rspecs->romfilename); }