diff -ubr wine-0.1.orig/src/cfg.c wine-0.1/src/cfg.c --- wine-0.1.orig/src/cfg.c 2011-02-25 21:04:19.000000000 +1000 +++ wine-0.1/src/cfg.c 2011-04-27 23:01:33.000000000 +1000 @@ -26,8 +26,8 @@ #include #include #include +#include #include "cfg.h" -#include "logger.h" #include "xmltree.h" struct appdb_node { @@ -61,24 +61,24 @@ /* find config directory ~/.ltrdll */ if(!(pwd = getpwuid(getuid()))) { - logmsg("Failed to retreive user's home directory, and thus can't find the config files. Continuing with defaults\n"); + ltr_log_message("Failed to retreive user's home directory, and thus can't find the config files. Continuing with defaults\n"); return -1; } sprintf(cfgdir, "%s/.ltrdll", pwd->pw_dir); if(stat(cfgdir, &st) == -1) { - logmsg("Config dir (%s) doesn't exist. Will create it and continue with defaults\n", cfgdir); + ltr_log_message("Config dir (%s) doesn't exist. Will create it and continue with defaults\n", cfgdir); if(mkdir(cfgdir, 0775) == -1) { - logmsg("Failed to create missing config file directory: %s: %s\n", cfgdir, strerror(errno)); + ltr_log_message("Failed to create missing config file directory: %s: %s\n", cfgdir, strerror(errno)); return -1; } if(stat(cfgdir, &st) == -1) { - logmsg("WTF?\n"); + ltr_log_message("WTF?\n"); return -1; } } if(!S_ISDIR(st.st_mode)) { - logmsg("%s exists but it's not a directory! can't read or store config files. Continuing with defaults\n", cfgdir); + ltr_log_message("%s exists but it's not a directory! can't read or store config files. Continuing with defaults\n", cfgdir); return -1; } @@ -90,11 +90,11 @@ sprintf(path_buf, "%s/apps.xml", cfgdir); if(!(xmltree = xml_read_tree(path_buf))) { - logmsg("failed to read apps list: %s\n", path_buf); + ltr_log_message("failed to read apps list: %s\n", path_buf); } else { cfg.appdb = create_appdb(xmltree); xml_free_tree(xmltree); - logmsg("loaded %d games in the appdb\n", appdb_count_nodes(cfg.appdb)); + ltr_log_message("loaded %d games in the appdb\n", appdb_count_nodes(cfg.appdb)); } return 0; @@ -126,14 +126,14 @@ char *fname, *clean_name; if(!(pwd = getpwuid(getuid()))) { - logmsg("failed to add linuxtrack profile, can't find the home directory: %s\n", strerror(errno)); + ltr_log_message("failed to add linuxtrack profile, can't find the home directory: %s\n", strerror(errno)); return -1; } - fname = alloca(strlen("/.linuxtrack") + strlen(pwd->pw_dir) + 1); - sprintf(fname, "%s/.linuxtrack", pwd->pw_dir); + fname = alloca(strlen("/.linuxtrack/linuxtrack.conf") + strlen(pwd->pw_dir) + 1); + sprintf(fname, "%s/.linuxtrack/linuxtrack.conf", pwd->pw_dir); if(!(fp = fopen(fname, "rb+"))) { - logmsg("failed to open linuxtrack config file: %s: %s\n", fname, strerror(errno)); + ltr_log_message("failed to open linuxtrack config file: %s: %s\n", fname, strerror(errno)); return -1; } @@ -185,7 +185,7 @@ int lineno = 0; if(!(fp = fopen(fname, "r"))) { - logmsg("can't open config file: %s: %s\n", fname, strerror(errno)); + ltr_log_message("can't open config file: %s: %s\n", fname, strerror(errno)); return -1; } @@ -200,7 +200,7 @@ } if(!(tok = strtok(line, CFG_DELIM))) { - logmsg("%s line %d: malformed line: \"%s\"\n", fname, lineno, line); + ltr_log_message("%s line %d: malformed line: \"%s\"\n", fname, lineno, line); continue; } if(strcasecmp(tok, "recenter") == 0) { @@ -208,7 +208,7 @@ } else if(strcasecmp(tok, "pause") == 0) { target = cfg->pause_key; } else { - logmsg("%s line %d: ignoring unknown: \"%s\"\n", fname, lineno, tok); + ltr_log_message("%s line %d: ignoring unknown: \"%s\"\n", fname, lineno, tok); continue; } @@ -229,7 +229,7 @@ struct appdb_node *appdb = 0; if(strcasecmp(xml->name, "games") != 0) { - logmsg("Invalid appdb file, root element should be \"Games\", not: %s\n", xml->name); + ltr_log_message("Invalid appdb file, root element should be \"Games\", not: %s\n", xml->name); return 0; } @@ -243,22 +243,22 @@ iter = iter->next; if(strcasecmp(node->name, "game") != 0) { - logmsg("appdb: ignoring unexpected element: %s\n", node->name); + ltr_log_message("appdb: ignoring unexpected element: %s\n", node->name); continue; } if(!(attr = xml_get_attr_case(node, "id"))) { - logmsg("appdb: game element missing id attribute, ignoring\n"); + ltr_log_message("appdb: game element missing id attribute, ignoring\n"); continue; } if(attr->type != ATYPE_INT) { - logmsg("appdb: game element with invalid id attribute (%s), ignoring\n", attr->str); + ltr_log_message("appdb: game element with invalid id attribute (%s), ignoring\n", attr->str); continue; } id = attr->ival; if(!(attr = xml_get_attr_case(node, "name"))) { - logmsg("appdb: game %d missing name attribute, ignoring\n", id); + ltr_log_message("appdb: game %d missing name attribute, ignoring\n", id); continue; } @@ -286,7 +286,7 @@ if(id == node->id) { if(strcmp(name, node->name) != 0) { - logmsg("appdb: id %d assigned to both \"%s\" and \"%s\" in the app data file!\n", id, node->name, name); + ltr_log_message("appdb: id %d assigned to both \"%s\" and \"%s\" in the app data file!\n", id, node->name, name); return -1; } return 0; /* duplicate entry */ diff -ubr wine-0.1.orig/src/ltrnp.c wine-0.1/src/ltrnp.c --- wine-0.1.orig/src/ltrnp.c 2011-02-25 21:04:19.000000000 +1000 +++ wine-0.1/src/ltrnp.c 2011-04-27 23:02:23.000000000 +1000 @@ -20,9 +20,8 @@ #include #include #include -#include +#include #include "xkey.h" -#include "logger.h" #include "cfg.h" struct tir_data { @@ -52,9 +51,7 @@ { switch(reason) { case DLL_PROCESS_ATTACH: - init_logger("/tmp/npdll.log"); - - logmsg("--- initializing linuxtrack ---\n"); + ltr_log_message("--- initializing linuxtrack ---\n"); init_config(); init_keyb(); @@ -65,11 +62,10 @@ break; case DLL_PROCESS_DETACH: - logmsg("shutting down\n"); + ltr_log_message("shutting down\n"); shutdown_keyb(); ltr_shutdown(); cleanup_config(); - shutdown_logger(); break; default: @@ -85,33 +81,33 @@ assert(sizeof sigdata == 400); *sig = sigdata; - logmsg("%s(c)\n", __func__); + ltr_log_message("%s(c)\n", __func__); return 0; } int __stdcall NPCLIENT_NP_QueryVersion(short *ver) { *ver = 0x0400; - logmsg("%s\n", __func__); + ltr_log_message("%s\n", __func__); return 0; } int __stdcall NPCLIENT_NP_ReCenter(void) { - logmsg("%s\n", __func__); + ltr_log_message("%s\n", __func__); ltr_recenter(); return 0; } int __stdcall NPCLIENT_NP_RegisterWindowHandle(void *handle) { - logmsg("%s\n", __func__); + ltr_log_message("%s\n", __func__); return 0; } int __stdcall NPCLIENT_NP_UnregisterWindowHandle(void) { - logmsg("%s\n", __func__); + ltr_log_message("%s\n", __func__); return 0; } @@ -127,14 +123,14 @@ add_ltr_profile(profile); } - logmsg("Program profile: %s (%d)\n", profile, (int)id); + ltr_log_message("Program profile: %s (%d)\n", profile, (int)id); if(ltr_initialized) { ltr_shutdown(); } if(ltr_init((char*)profile) != 0) { - logmsg("failed to initialize linuxtrack\n"); + ltr_log_message("failed to initialize linuxtrack\n"); return 1; } if(!tracking) { @@ -148,7 +144,7 @@ int __stdcall NPCLIENT_NP_RequestData(short data) { - logmsg("%s\n", __func__); + ltr_log_message("%s\n", __func__); return 0; } @@ -162,7 +158,7 @@ if(ltr_get_camera_update(&tir->yaw, &tir->pitch, &tir->roll, &tir->tx, &tir->ty, &tir->tz, &counter) < 0) { - logmsg("ltr_get_camera_update failed!\n"); + ltr_log_message("ltr_get_camera_update failed!\n"); } tir->frame = frame++; @@ -174,7 +170,7 @@ tir->ty = tir->ty * 64.0f; tir->tz = tir->tz * 64.0f; - /*logmsg("r(%.3f %.3f %.3f) t(%.3f %.3f %.3f)\n", tir->yaw, tir->pitch, tir->roll, tir->tx, tir->ty, tir->tz);*/ + /*ltr_log_message("r(%.3f %.3f %.3f) t(%.3f %.3f %.3f)\n", tir->yaw, tir->pitch, tir->roll, tir->tx, tir->ty, tir->tz);*/ return 0; } @@ -182,20 +178,20 @@ int __stdcall NPCLIENT_NP_StopCursor(void) { - logmsg("%s\n", __func__); + ltr_log_message("%s\n", __func__); return 0; } int __stdcall NPCLIENT_NP_StartCursor(void) { - logmsg("%s\n", __func__); + ltr_log_message("%s\n", __func__); return 0; } int __stdcall NPCLIENT_NP_StartDataTransmission(void) { - logmsg("%s\n", __func__); + ltr_log_message("%s\n", __func__); if(ltr_initialized) { ltr_wakeup(); @@ -208,7 +204,7 @@ int __stdcall NPCLIENT_NP_StopDataTransmission(void) { - logmsg("%s\n", __func__); + ltr_log_message("%s\n", __func__); ltr_suspend(); return 0; } diff -ubr wine-0.1.orig/src/xkey.c wine-0.1/src/xkey.c --- wine-0.1.orig/src/xkey.c 2011-02-25 21:04:19.000000000 +1000 +++ wine-0.1/src/xkey.c 2011-04-27 23:02:33.000000000 +1000 @@ -24,8 +24,7 @@ #include #include #include -#include -#include "logger.h" +#include #include "xkey.h" #include "cfg.h" @@ -49,7 +48,7 @@ int res = pthread_create(&thread, 0, thread_start, 0); if(res != 0) { - logmsg("failed to spawn keybindings handler thread: %s\n", strerror(res)); + ltr_log_message("failed to spawn keybindings handler thread: %s\n", strerror(res)); } if(pipe(pfd) == -1) { @@ -64,11 +63,11 @@ Window win, root; struct config *cfg; - logmsg("setting up X keybindings\n"); + ltr_log_message("setting up X keybindings\n"); if(!(dpy = XOpenDisplay(0))) { const char *dpyenv = getenv("DISPLAY"); - logmsg("failed to connect to the X server (%s)\n", dpyenv ? dpyenv : "DISPLAY not set"); + ltr_log_message("failed to connect to the X server (%s)\n", dpyenv ? dpyenv : "DISPLAY not set"); pthread_exit(0); } root = DefaultRootWindow(dpy); @@ -76,7 +75,7 @@ win = XCreateWindow(dpy, root, 0, 0, 8, 8, 0, CopyFromParent, InputOnly, CopyFromParent, 0, 0); if(!win) { - logmsg("failed to create X window for input processing\n"); + ltr_log_message("failed to create X window for input processing\n"); pthread_exit(0); } XSelectInput(dpy, win, KeyPressMask); @@ -147,10 +146,10 @@ int (*xerr_prev)(); Window root = DefaultRootWindow(dpy); - logmsg("binding key \"%s\" to %s\n", keyname, opname); + ltr_log_message("binding key \"%s\" to %s\n", keyname, opname); if((sym = XStringToKeysym(keyname)) == NoSymbol) { - logmsg("failed to find a key named \"%s\"\n", keyname); + ltr_log_message("failed to find a key named \"%s\"\n", keyname); return 0; } code = XKeysymToKeycode(dpy, sym); @@ -172,16 +171,16 @@ switch(xev->type) { case KeyPress: if(xev->xkey.keycode == recenter_keycode) { - logmsg("recenter...\n"); + ltr_log_message("recenter...\n"); ltr_recenter(); } else if(xev->xkey.keycode == pause_keycode) { static int paused; if(paused) { - logmsg("resume...\n"); + ltr_log_message("resume...\n"); ltr_wakeup(); paused = 0; } else { - logmsg("pause...\n"); + ltr_log_message("pause...\n"); ltr_suspend(); paused = 1; } @@ -196,7 +195,7 @@ void shutdown_keyb(void) { if(thread) { - logmsg("terminating keybindings handler thread\n"); + ltr_log_message("terminating keybindings handler thread\n"); if(pfd[0] != -1) { char c = 'q'; @@ -207,12 +206,12 @@ } } } else { - logmsg("no keybindings thread to terminate\n"); + ltr_log_message("no keybindings thread to terminate\n"); } } static int xerr(Display *dpy, XErrorEvent *err) { - logmsg("Failed to bind %s to the %s function. That function will be unavailable!\n", xerr_key, xerr_op); + ltr_log_message("Failed to bind %s to the %s function. That function will be unavailable!\n", xerr_key, xerr_op); return 0; }