--- np2/x11/main.c 2008/03/18 15:33:14 1.29 +++ np2/x11/main.c 2011/01/15 16:10:12 1.34 @@ -1,4 +1,4 @@ -/* $Id: main.c,v 1.29 2008/03/18 15:33:14 monaka Exp $ */ +/* $Id: main.c,v 1.34 2011/01/15 16:10:12 monaka Exp $ */ /* * Copyright (c) 2003 NONAKA Kimihiro @@ -29,8 +29,13 @@ #include #include +#include #include +#if defined(USE_SDLAUDIO) || defined(USE_SDLMIXER) +#include +#endif + #include "np2.h" #include "diskdrv.h" #include "dosio.h" @@ -82,8 +87,6 @@ static void sighandler(int signo) { - UNUSED(signo); - toolkit_widget_quit(); } @@ -127,6 +130,11 @@ main(int argc, char *argv[]) progname = argv[0]; + setlocale(LC_ALL, ""); + bindtextdomain(np2appname, NP2LOCALEDIR); + bind_textdomain_codeset(np2appname, "UTF-8"); + textdomain(np2appname); + toolkit_initialize(); toolkit_arginit(&argc, &argv); @@ -167,7 +175,7 @@ main(int argc, char *argv[]) char *env = getenv("HOME"); if (env) { /* base dir */ - snprintf(modulefile, sizeof(modulefile), + g_snprintf(modulefile, sizeof(modulefile), "%s/.%s", env, np2appname); if (stat(modulefile, &sb) < 0) { if (mkdir(modulefile, 0700) < 0) { @@ -191,8 +199,12 @@ main(int argc, char *argv[]) } if (modulefile[0] != '\0') { /* font file */ - snprintf(np2cfg.fontfile, sizeof(np2cfg.fontfile), - "%s/font.bmp", modulefile); + file_cpyname(np2cfg.fontfile, modulefile, + sizeof(np2cfg.fontfile)); + file_cutname(np2cfg.fontfile); + file_setseparator(np2cfg.fontfile, sizeof(np2cfg.fontfile)); + file_catname(np2cfg.fontfile, "font.bmp", + sizeof(np2cfg.fontfile)); /* resume/statsave dir */ file_cpyname(statpath, modulefile, sizeof(statpath)); @@ -232,6 +244,10 @@ main(int argc, char *argv[]) TRACEINIT(); +#if defined(USE_SDLAUDIO) || defined(USE_SDLMIXER) + SDL_Init(0); +#endif + if (fontmng_init() != SUCCESS) goto fontmng_failure; @@ -355,6 +371,10 @@ fontmng_failure: skbdwin_deinitialize(); +#if defined(USE_SDLAUDIO) || defined(USE_SDLMIXER) + SDL_Quit(); +#endif + TRACETERM(); dosio_term();