void *_main_thread_start(void* dummmy) { _thread_sethere(_place_first()); _task * t = (_task*)malloc(sizeof(_task)); /*t -> total_memory = 0; t -> total_memory_string=0; t -> total_memory_value_class=0; t -> total_memory_value_array=0; t -> total_memory_class=0; t -> total_memory_update_array=0;*/ _thread_setspecific((void*)t); runmain(); //fprintf(stderr, "MAIN TOTAL MEMORY USED =%lu=\n", (((_task*) _thread_getspecific()) -> total_memory)); // print_memory(((_task*) _thread_getspecific())); int32_t success = _terminate_all_places(); //free the mainthread task if(success== EXIT_SUCCESS) { writeDebug("Wrote all termination messages"); }else { writeError("termination messages Failed"); } }
int wmain (int argc, wchar_t *argv[], wchar_t *envp[]) { #if XFD return runxfd (argc, argv); #else return runmain (argc, argv); #endif }
static int runxfd(int argc,wchar_t *argv[]) { STARTUPINFO si = { 0 }; PROCESS_INFORMATION pi = { 0 }; TCHAR *src, *dst; TCHAR *parms[5]; FILE *f; _tprintf(_T("uaexfd 0.1b by Toni Wilen (c)2010\n")); if (argc < 2) { _tprintf(_T("uaexfd <source> [<destination>]")); return 0; } if (GetFileAttributes(_T("xfd.uae")) == INVALID_FILE_ATTRIBUTES) { _tprintf(_T("xfd.uae missing\n")); return 0; } if (GetFileAttributes(_T("uaexfd.zip")) == INVALID_FILE_ATTRIBUTES) { _tprintf(_T("uaexfd.zip missing\n")); return 0; } dst = src = argv[1]; if (GetFileAttributes(src) == INVALID_FILE_ATTRIBUTES) { _tprintf(_T("can't open '%s'\n"), src); return 0; } if (argc >= 3) dst = argv[2]; DeleteFile(_T("xfd-in-file.dat")); DeleteFile(_T("xfd-out-file.dat")); DeleteFile(_T("xfd-out-text.txt")); CopyFile(src, _T("xfd-in-file.dat"), FALSE); parms[0] = _T("winuae.com"); parms[1] = _T("-f"); parms[2] = _T("xfd.uae"); parms[3] = _T("-datapath"); parms[4] = _T("."); parms[5] = NULL; if (!runmain(5, parms)) { if (GetFileAttributes(_T("xfd-out-file.dat")) != INVALID_FILE_ATTRIBUTES) { DeleteFile(dst); MoveFile(_T("xfd-out-file.dat"), dst); } f = _tfopen(_T("xfd-out-text.txt"), _T("rb")); if (f) { char tmp[1000]; while (fgets(tmp, sizeof tmp, f)) { if (strlen(tmp) <= 1) continue; for (int i = 0; tmp[i]; i++) { if (tmp[i] == -101 || (tmp[i] == 27 && tmp[i + 1] == '[')) { int j = i + 1; if (tmp[i] == 27) j++; while (tmp[j] > 0 && tmp[j] < 0x40) j++; if (tmp[j]) j++; memmove (tmp + i, tmp + j, strlen(tmp + j) + 1); } } if (tmp[strlen(tmp)-1] == 10) tmp[strlen(tmp)-1] = 0; printf("%s\n", tmp); } fclose(f); } else { _tprintf(_T("startup failed\n")); } } DeleteFile(_T("xfd-in-file.dat")); DeleteFile(_T("xfd-out-file.dat")); DeleteFile(_T("xfd-out-text.txt")); DeleteFile(_T("winuaebootlog.txt")); RemoveDirectory(_T("Host")); RemoveDirectory(_T("Hardware")); return 0; }