int caps_loadimage (struct zfile *zf, unsigned int drv, unsigned int *num_tracks) { struct CapsImageInfo ci; int len, ret; uae_u8 *buf; char s1[100]; struct CapsDateTimeExt *cdt; if (!caps_init ()) return 0; caps_unloadimage (drv); zfile_fseek (zf, 0, SEEK_END); len = zfile_ftell (zf); zfile_fseek (zf, 0, SEEK_SET); buf = xmalloc (uae_u8, len); if (!buf) return 0; if (zfile_fread (buf, len, 1, zf) == 0) return 0; ret = CAPSLockImageMemory (caps_cont[drv], buf, len, 0); xfree (buf); if (ret != imgeOk) return 0; caps_locked[drv] = 1; CAPSGetImageInfo (&ci, caps_cont[drv]); *num_tracks = (ci.maxcylinder - ci.mincylinder + 1) * (ci.maxhead - ci.minhead + 1); CAPSLoadImage (caps_cont[drv], caps_flags); cdt = &ci.crdt; sprintf (s1, "%d.%d.%d %d:%d:%d", cdt->day, cdt->month, cdt->year, cdt->hour, cdt->min, cdt->sec); write_log ("CAPS: type:%d date:%s rel:%d rev:%d\n", ci.type, s1, ci.release, ci.revision); return 1; }
int caps_loadimage (struct zfile *zf, int drv, int *num_tracks) { static int notified; struct CapsImageInfo ci; int len, ret; uae_u8 *buf; TCHAR s1[100]; struct CapsDateTimeExt *cdt; if (!caps_init ()) return 0; caps_unloadimage (drv); zfile_fseek (zf, 0, SEEK_END); len = zfile_ftell (zf); zfile_fseek (zf, 0, SEEK_SET); buf = xmalloc (uae_u8, len); if (!buf) return 0; if (zfile_fread (buf, len, 1, zf) == 0) return 0; ret = pCAPSLockImageMemory (caps_cont[drv], buf, len, 0); xfree (buf); if (ret != imgeOk) { if (ret == imgeIncompatible || ret == imgeUnsupported) { if (!notified) notify_user (NUMSG_OLDCAPS); notified = 1; } write_log (L"caps: CAPSLockImageMemory() returned %d\n", ret); return 0; } caps_locked[drv] = 1; ret = pCAPSGetImageInfo(&ci, caps_cont[drv]); *num_tracks = (ci.maxcylinder - ci.mincylinder + 1) * (ci.maxhead - ci.minhead + 1); if (cvi.release < 4) { // pre-4.x bug workaround struct CapsTrackInfoT1 cit; cit.type = 1; if (pCAPSLockTrack ((PCAPSTRACKINFO)&cit, caps_cont[drv], 0, 0, caps_flags) == imgeIncompatible) { if (!notified) notify_user (NUMSG_OLDCAPS); notified = 1; caps_unloadimage (drv); return 0; } pCAPSUnlockAllTracks (caps_cont[drv]); } ret = pCAPSLoadImage(caps_cont[drv], caps_flags); cdt = &ci.crdt; _stprintf (s1, L"%d.%d.%d %d:%d:%d", cdt->day, cdt->month, cdt->year, cdt->hour, cdt->min, cdt->sec); write_log (L"caps: type:%d date:%s rel:%d rev:%d\n", ci.type, s1, ci.release, ci.revision); return 1; }
static void init() { int initialized = protocol_init() && caps_init() && signal_init() && comm_init() && injectable_init(); if (!initialized) { fatal("Initialization failed."); cleanup(); exit(EXIT_FAILURE); } }
void jabber_init(void) { log_info("Initialising XMPP"); jabber_conn.conn_status = JABBER_STARTED; jabber_conn.presence_message = NULL; jabber_conn.conn = NULL; jabber_conn.ctx = NULL; jabber_conn.domain = NULL; presence_sub_requests_init(); caps_init(); available_resources = g_hash_table_new_full(g_str_hash, g_str_equal, free, (GDestroyNotify)resource_destroy); xmpp_initialize(); }