/* SSNES - A Super Nintendo Entertainment System (SNES) Emulator frontend for libsnes. * Copyright (C) 2010-2012 - Hans-Kristian Arntzen * * Some code herein may be based on code found in BSNES. * * SSNES is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- * ation, either version 3 of the License, or (at your option) any later version. * * SSNES is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along with SSNES. * If not, see . */ #include "main_wrap.h" #include "../general.h" #include "../strl.h" #include #include #include #define MAX_ARGS 32 int ssnes_main_init_wrap(const struct ssnes_main_wrap *args) { int argc = 0; char *argv[MAX_ARGS] = {NULL}; argv[argc++] = strdup("ssnes"); if (args->rom_path) argv[argc++] = strdup(args->rom_path); if (args->sram_path) { argv[argc++] = strdup("-s"); argv[argc++] = strdup(args->sram_path); } if (args->state_path) { argv[argc++] = strdup("-S"); argv[argc++] = strdup(args->state_path); } if (args->config_path) { argv[argc++] = strdup("-c"); argv[argc++] = strdup(args->config_path); } if (args->verbose) argv[argc++] = strdup("-v"); int ret = ssnes_main_init(argc, argv); char **tmp = argv; while (*tmp) { free(*tmp); tmp++; } return ret; }