Skip to content

Commit

Permalink
(retroarch.c) Add --log-file and --version
Browse files Browse the repository at this point in the history
  • Loading branch information
heuripedes committed Jun 12, 2015
1 parent 4e595b3 commit ecede41
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 2 deletions.
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
HAVE_FILE_LOGGER=1

include config.mk

TARGET = retroarch
Expand Down
4 changes: 4 additions & 0 deletions Makefile.common
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ ifeq ($(TDM_GCC),)
LDCXXFLAGS += -static-libstdc++
endif

ifeq ($(HAVE_FILE_LOGGER), 1)
CFLAGS += -DHAVE_FILE_LOGGER -Ilogger/netlogger
endif

CFLAGS += -I./libretro-common/include

# Switches
Expand Down
20 changes: 19 additions & 1 deletion retroarch.c
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,10 @@ static void parse_input(int argc, char *argv[])
{ "subsystem", 1, NULL, 'Z' },
{ "max-frames", 1, NULL, 'm' },
{ "eof-exit", 0, &val, 'e' },
{ "version", 0, &val, 'V' },
#ifdef HAVE_FILE_LOGGER
{ "log-file", 1, &val, 'L' },
#endif
{ NULL, 0, NULL, 0 }
};

Expand Down Expand Up @@ -662,7 +666,7 @@ static void parse_input(int argc, char *argv[])
runloop->frames.video.max = strtoul(optarg, NULL, 10);
break;

case 0:
case 0: /* options without short variant */
switch (val)
{
case 'M':
Expand Down Expand Up @@ -743,6 +747,16 @@ static void parse_input(int argc, char *argv[])
global->bsv.eof_exit = true;
break;

case 'V':
print_version();
exit(0);

#ifdef HAVE_FILE_LOGGER
case 'L':
global->log_file = fopen(optarg, "wb");
break;
#endif

default:
break;
}
Expand Down Expand Up @@ -1169,6 +1183,10 @@ int rarch_main_init(int argc, char *argv[])
void rarch_main_init_wrap(const struct rarch_main_wrap *args,
int *argc, char **argv)
{
#ifdef HAVE_FILE_LOGGER
int i;
#endif

*argc = 0;
argv[(*argc)++] = strdup("retroarch");

Expand Down
3 changes: 2 additions & 1 deletion retroarch_logger.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
#include <stdarg.h>
#include <stdio.h>

#if defined(HAVE_FILE_LOGGER) && defined(RARCH_INTERNAL)
#if defined(HAVE_FILE_LOGGER) && defined(RARCH_INTERNAL) && !defined(IS_JOYCONFIG)
FILE *rarch_main_log_file(void);
#define LOG_FILE (rarch_main_log_file())
#else
#define LOG_FILE (stderr)
Expand Down
2 changes: 2 additions & 0 deletions tools/retroarch-joyconfig-griffin.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
* If not, see <http://www.gnu.org/licenses/>.
*/

#define IS_JOYCONFIG

#include "retroarch-joyconfig.c"

#include "../libretro-common/dynamic/dylib.c"
Expand Down

0 comments on commit ecede41

Please sign in to comment.