/// Application entry point int main(int argc, char **argv) { Log::Filter log_filter(Log::Level::Debug); Log::SetFilter(&log_filter); if (argc < 2) { LOG_CRITICAL(Frontend, "Failed to load ROM: No ROM specified"); return -1; } Config config; log_filter.ParseFilterString(Settings::values.log_filter); std::string boot_filename = argv[1]; EmuWindow_GLFW* emu_window = new EmuWindow_GLFW; VideoCore::g_hw_renderer_enabled = Settings::values.use_hw_renderer; System::Init(emu_window); Loader::ResultStatus load_result = Loader::LoadFile(boot_filename); if (Loader::ResultStatus::Success != load_result) { LOG_CRITICAL(Frontend, "Failed to load ROM (Error %i)!", load_result); return -1; } while (emu_window->IsOpen()) { Core::RunLoop(); } System::Shutdown(); delete emu_window; return 0; }
int main(int argc, char* argv[]) { Log::Filter log_filter(Log::Level::Info); Log::SetFilter(&log_filter); MicroProfileOnThreadCreate("Frontend"); SCOPE_EXIT({ MicroProfileShutdown(); });
/// Application entry point int __cdecl main(int argc, char **argv) { std::shared_ptr<Log::Logger> logger = Log::InitGlobalLogger(); Log::Filter log_filter(Log::Level::Debug); std::thread logging_thread(Log::TextLoggingLoop, logger, &log_filter); SCOPE_EXIT({ logger->Close(); logging_thread.join(); });
/// Application entry point int main(int argc, char **argv) { Config config; int option_index = 0; bool use_gdbstub = Settings::values.use_gdbstub; u32 gdb_port = static_cast<u32>(Settings::values.gdbstub_port); char *endarg; std::string boot_filename; static struct option long_options[] = { { "gdbport", required_argument, 0, 'g' }, { "help", no_argument, 0, 'h' }, { "version", no_argument, 0, 'v' }, { 0, 0, 0, 0 } }; while (optind < argc) { char arg = getopt_long(argc, argv, "g:hv", long_options, &option_index); if (arg != -1) { switch (arg) { case 'g': errno = 0; gdb_port = strtoul(optarg, &endarg, 0); use_gdbstub = true; if (endarg == optarg) errno = EINVAL; if (errno != 0) { perror("--gdbport"); exit(1); } break; case 'h': PrintHelp(argv[0]); return 0; case 'v': PrintVersion(); return 0; } } else { boot_filename = argv[optind]; optind++; } } Log::Filter log_filter(Log::Level::Debug); Log::SetFilter(&log_filter); MicroProfileOnThreadCreate("EmuThread"); SCOPE_EXIT({ MicroProfileShutdown(); });
void on_application_initialized () { try { common::LogFilter log_filter ("render.manager*", &log_print); Test test (L"Effect loader test", false); RenderManager render_manager = test.RenderManager (); render_manager.LoadResource (LIBRARY_NAME); printf ("Effects loaded\n"); } catch (std::exception& e) { printf ("%s\n", e.what ()); } syslib::Application::Exit (0); }
int main () { printf ("Results of scene1_test:\n"); try { common::LogFilter log_filter ("render.*", &log_print); syslib::Window window (syslib::WindowStyle_Overlapped, 512, 512); syslib::Window window2 (syslib::WindowStyle_Overlapped, 512, 512); window.RegisterEventHandler (syslib::WindowEvent_OnClose, xtl::bind (&on_window_close)); const char* SERVER_NAME = "MyServer"; Server server (SERVER_NAME, render::scene::server::ServerThreadingModel_SingleThreaded); Client client (SERVER_NAME); common::PropertyMap window_properties; window_properties.SetProperty ("ColorBits", 32); window_properties.SetProperty ("DepthBits", 24); server.AttachWindow ("my_window", window, window_properties); server.AttachWindow ("my_window2", window2, window_properties); client.LoadResource ("data/render.rfx"); client.LoadResource ("data/u1/texture0000.dds"); client.LoadResource ("data/u1/texture0001.dds"); client.LoadResource ("data/u1/texture0002.dds"); client.LoadResource ("data/u1/EnvGala_020_D.dds"); client.LoadResource ("data/u1.xmtl"); client.LoadResource ("data/u1.xmesh"); client.LoadResource ("data/quad.xmesh"); RenderTarget target = client.CreateRenderTarget ("my_window"); RenderTarget target2 = client.CreateRenderTarget ("my_window2"); scene_graph::Screen screen; scene_graph::Screen screen2; target.SetScreen (&screen); target2.SetScreen (&screen2); // screen.SetBackgroundState (true); screen.SetBackgroundColor (math::vec4f (0.0f, 1.0f, 1.0f, 1.0f)); // screen2.SetBackgroundState (true); screen2.SetBackgroundColor (math::vec4f (1.0f, 0.0f, 1.0f, 1.0f)); scene_graph::OrthoCamera::Pointer camera = scene_graph::OrthoCamera::Create (); camera->SetLeft (-10.0f); camera->SetRight (10.0f); camera->SetBottom (-10.0f); camera->SetTop (10.0f); camera->SetZNear (-1000.0f); camera->SetZFar (1000.0f); camera->SetPosition (0, 10.0f, 0.0f); camera->LookTo (math::vec3f (0.0f), scene_graph::NodeOrt_Z, scene_graph::NodeOrt_X, scene_graph::NodeTransformSpace_World); // camera->LookTo (math::vec3f (0.0f), math::vec3f (0, 1.0f, 0), scene_graph::NodeTransformSpace_World); scene_graph::Scene scene; camera->BindToScene (scene); scene_graph::OrthoCamera::Pointer camera2 = scene_graph::OrthoCamera::Create (); camera2->SetLeft (-10.0f); camera2->SetRight (10.0f); camera2->SetBottom (-10.0f); camera2->SetTop (10.0f); camera2->SetZNear (-1000.0f); camera2->SetZFar (1000.0f); camera2->SetPosition (0, 10.0f, 0.0f); camera2->LookTo (math::vec3f (0.0f), scene_graph::NodeOrt_Z, scene_graph::NodeOrt_X, scene_graph::NodeTransformSpace_World); camera2->BindToScene (scene); scene_graph::OrthoCamera::Pointer camera3 = scene_graph::OrthoCamera::Create (); camera3->SetLeft (-10.0f); camera3->SetRight (10.0f); camera3->SetBottom (-10.0f); camera3->SetTop (10.0f); camera3->SetZNear (-1000.0f); camera3->SetZFar (1000.0f); camera3->SetPosition (0, 10.0f, 0.0f); camera3->LookTo (math::vec3f (0.0f), scene_graph::NodeOrt_Z, scene_graph::NodeOrt_X, scene_graph::NodeTransformSpace_World); camera3->BindToScene (scene); scene_graph::OrthoCamera::Pointer camera4 = scene_graph::OrthoCamera::Create (); camera4->SetLeft (-10.0f); camera4->SetRight (10.0f); camera4->SetBottom (-10.0f); camera4->SetTop (10.0f); camera4->SetZNear (-1000.0f); camera4->SetZFar (1000.0f); camera4->SetPosition (0, 10.0f, 0.0f); camera4->LookTo (math::vec3f (0.0f), scene_graph::NodeOrt_Z, scene_graph::NodeOrt_X, scene_graph::NodeTransformSpace_World); camera4->BindToScene (scene); scene_graph::StaticMesh::Pointer model = scene_graph::StaticMesh::Create (); model->SetMeshName ("u1.polySurface2.mesh#0"); model->BindToScene (scene); scene_graph::StaticMesh::Pointer model2 = scene_graph::StaticMesh::Create (); model2->SetMeshName ("quad"); model2->Rotate (math::degree (-90.f), math::degree (0.f), math::degree (0.f)); model2->SetPosition (0, -8.0f, 0); model2->Scale (10.0f, 10.0f, 10.0f); model2->BindToScene (scene); scene_graph::SpotLight::Pointer light = scene_graph::SpotLight::Create (); light->SetPosition (0.0f, 10.0f, 0); light->SetRange (20.0f); light->LookTo (math::vec3f (0.0f), scene_graph::NodeOrt_Z, scene_graph::NodeOrt_X, scene_graph::NodeTransformSpace_World); light->SetIntensity (1.0f); light->SetAngle (math::degree (100.0f)); light->BindToScene (scene); //пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅ scene_graph::Viewport vp; vp.SetArea (0, 0, 100, 100); vp.SetCamera (camera.get ()); vp.SetTechnique ("default"); vp.SetMinDepth (0); vp.SetMaxDepth (0.2); screen.Attach (vp); scene_graph::Viewport vp2; vp2.SetArea (0, 0, 100, 100); vp2.SetCamera (camera2.get ()); vp2.SetTechnique ("default"); vp2.SetMinDepth (0.3); vp2.SetMaxDepth (0.5); screen2.Attach (vp2); window.Show (); window2.Show (); window.SetPosition (100, 100); window2.SetPosition (700, 100); Test test (target, target2, *model); syslib::Application::RegisterEventHandler (syslib::ApplicationEvent_OnIdle, xtl::bind (&idle, xtl::ref (test), xtl::ref (*light))); syslib::Application::Run (); } catch (std::exception& e) { printf ("%s\n", e.what ()); } }
/// Application entry point int main(int argc, char** argv) { Config config; int option_index = 0; bool use_gdbstub = Settings::values.use_gdbstub; u32 gdb_port = static_cast<u32>(Settings::values.gdbstub_port); char* endarg; #ifdef _WIN32 int argc_w; auto argv_w = CommandLineToArgvW(GetCommandLineW(), &argc_w); if (argv_w == nullptr) { LOG_CRITICAL(Frontend, "Failed to get command line arguments"); return -1; } #endif std::string boot_filename; static struct option long_options[] = { {"gdbport", required_argument, 0, 'g'}, {"help", no_argument, 0, 'h'}, {"version", no_argument, 0, 'v'}, {0, 0, 0, 0}, }; while (optind < argc) { char arg = getopt_long(argc, argv, "g:hv", long_options, &option_index); if (arg != -1) { switch (arg) { case 'g': errno = 0; gdb_port = strtoul(optarg, &endarg, 0); use_gdbstub = true; if (endarg == optarg) errno = EINVAL; if (errno != 0) { perror("--gdbport"); exit(1); } break; case 'h': PrintHelp(argv[0]); return 0; case 'v': PrintVersion(); return 0; } } else { #ifdef _WIN32 boot_filename = Common::UTF16ToUTF8(argv_w[optind]); #else boot_filename = argv[optind]; #endif optind++; } } #ifdef _WIN32 LocalFree(argv_w); #endif Log::Filter log_filter(Log::Level::Debug); Log::SetFilter(&log_filter); MicroProfileOnThreadCreate("EmuThread"); SCOPE_EXIT({ MicroProfileShutdown(); });
/*############################## read_text() ############################*/ static void read_text(void) { int fd = fileno(p_log_file); char *src = NULL, *dst = NULL, *ptr, *ptr_dst, *ptr_start, *ptr_line; struct stat stat_buf; XSetWindowAttributes attrs; XEvent event; if (fstat(fd, &stat_buf) < 0) { (void)xrec(FATAL_DIALOG, "fstat() error : %s (%s %d)", strerror(errno), __FILE__, __LINE__); return; } if (stat_buf.st_size > 0) { int block_length, length, last = MISS; off_t tmp_total_length = 0; /* Change cursor to indicate we are doing something. */ attrs.cursor = cursor1; XChangeWindowAttributes(display, XtWindow(appshell), CWCursor, &attrs); XFlush(display); /* Copy file to memory. */ #ifdef HAVE_MMAP if (lseek(fd, stat_buf.st_size, SEEK_SET) == -1) { (void)xrec(FATAL_DIALOG, "lseek() error : %s (%s %d)", strerror(errno), __FILE__, __LINE__); return; } if ((src = mmap(NULL, stat_buf.st_size, PROT_READ, MAP_SHARED, fd, 0)) == (caddr_t) -1) { (void)xrec(FATAL_DIALOG, "mmap() error : %s (%s %d)", strerror(errno), __FILE__, __LINE__); return; } #else if ((src = malloc(stat_buf.st_size)) == NULL) { (void)xrec(FATAL_DIALOG, "malloc() error : %s (%s %d)", strerror(errno), __FILE__, __LINE__); return; } if (read(fd, src, stat_buf.st_size) != stat_buf.st_size) { int tmp_errno = errno; free(src); (void)xrec(FATAL_DIALOG, "read() error : %s (%s %d)", strerror(tmp_errno), __FILE__, __LINE__); return; } #endif if ((dst = malloc(stat_buf.st_size + 1)) == NULL) { (void)xrec(FATAL_DIALOG, "malloc() error [%d bytes] : %s (%s %d)", stat_buf.st_size + 1, strerror(errno), __FILE__, __LINE__); return; } ptr_start = ptr = src; ptr_dst = dst; block_length = 0; *ptr_dst = '\0'; if (no_of_hosts > 0) { int i; while (tmp_total_length < stat_buf.st_size) { length = 0; ptr_line = ptr; while ((*ptr != '\n') && (*ptr != '\0')) { length++; ptr++; } length++; ptr++; tmp_total_length += length; if ((log_type_flag == TRANSFER_LOG_TYPE) || (log_type_flag == TRANS_DB_LOG_TYPE)) { if ((length > (LOG_SIGN_POSITION + MAX_HOSTNAME_LENGTH + 4)) && ((((toggles_set & SHOW_INFO) == 0) && (*(ptr_line + LOG_SIGN_POSITION) == 'I')) || (((toggles_set & SHOW_WARN) == 0) && (*(ptr_line + LOG_SIGN_POSITION) == 'W')) || (((toggles_set & SHOW_ERROR) == 0) && (*(ptr_line + LOG_SIGN_POSITION) == 'E')) || (((toggles_set & SHOW_FATAL) == 0) && (*(ptr_line + LOG_SIGN_POSITION) == 'F')) || (((toggles_set & SHOW_OFFLINE) == 0) && (*(ptr_line + LOG_SIGN_POSITION) == 'O')) || (((toggles_set & SHOW_DEBUG) == 0) && (*(ptr_line + LOG_SIGN_POSITION) == 'D')) || (((toggles_set & SHOW_TRACE) == 0) && (*(ptr_line + LOG_SIGN_POSITION) == 'T')) || (((toggles_set_parallel_jobs - 1) != (*(ptr_line + LOG_SIGN_POSITION + MAX_HOSTNAME_LENGTH + 4) - 48)) && (toggles_set_parallel_jobs != 0)))) { if (last == HIT) { (void)memcpy(ptr_dst, ptr_start, block_length); *(ptr_dst + block_length) = '\0'; ptr_dst += block_length; block_length = 0; } last = MISS; } else { for (i = 0; i < no_of_hosts; i++) { if (log_filter(hosts[i], ptr_line + 16) == 0) { i = no_of_hosts + 1; } } if (i == (no_of_hosts + 2)) { if (last == MISS) { ptr_start = ptr - length; } block_length += length; line_counter++; last = HIT; } else { if (last == HIT) { memcpy(ptr_dst, ptr_start, block_length); *(ptr_dst + block_length) = '\0'; ptr_dst += block_length; block_length = 0; } last = MISS; } } } else { if ((length > LOG_SIGN_POSITION) && ((((toggles_set & SHOW_INFO) == 0) && (*(ptr_line + LOG_SIGN_POSITION) == 'I')) || (((toggles_set & SHOW_CONFIG) == 0) && (*(ptr_line + LOG_SIGN_POSITION) == 'C')) || (((toggles_set & SHOW_WARN) == 0) && (*(ptr_line + LOG_SIGN_POSITION) == 'W')) || (((toggles_set & SHOW_ERROR) == 0) && (*(ptr_line + LOG_SIGN_POSITION) == 'E')) || (((toggles_set & SHOW_FATAL) == 0) && (*(ptr_line + LOG_SIGN_POSITION) == 'F')) || (((toggles_set & SHOW_OFFLINE) == 0) && (*(ptr_line + LOG_SIGN_POSITION) == 'O')) || (((toggles_set & SHOW_DEBUG) == 0) && (*(ptr_line + LOG_SIGN_POSITION) == 'D')))) { if (last == HIT) { (void)memcpy(ptr_dst, ptr_start, block_length); *(ptr_dst + block_length) = '\0'; ptr_dst += block_length; block_length = 0; } last = MISS; } else { for (i = 0; i < no_of_hosts; i++) { if (log_filter(hosts[i], ptr_line + 16) == 0) { i = no_of_hosts + 1; } } if (i == (no_of_hosts + 2)) { if (last == MISS) { ptr_start = ptr - length; } block_length += length; line_counter++; last = HIT; } else { if (last == HIT) { memcpy(ptr_dst, ptr_start, block_length); *(ptr_dst + block_length) = '\0'; ptr_dst += block_length; block_length = 0; } last = MISS; } } } } } else { while (tmp_total_length < stat_buf.st_size) { length = 0; ptr_line = ptr; while ((*ptr != '\n') && (*ptr != '\0')) { length++; ptr++; } length++; ptr++; tmp_total_length += length; if ((log_type_flag == TRANSFER_LOG_TYPE) || (log_type_flag == TRANS_DB_LOG_TYPE)) { if ((length > (LOG_SIGN_POSITION + MAX_HOSTNAME_LENGTH + 4)) && ((((toggles_set & SHOW_INFO) == 0) && (*(ptr_line + LOG_SIGN_POSITION) == 'I')) || (((toggles_set & SHOW_WARN) == 0) && (*(ptr_line + LOG_SIGN_POSITION) == 'W')) || (((toggles_set & SHOW_ERROR) == 0) && (*(ptr_line + LOG_SIGN_POSITION) == 'E')) || (((toggles_set & SHOW_FATAL) == 0) && (*(ptr_line + LOG_SIGN_POSITION) == 'F')) || (((toggles_set & SHOW_OFFLINE) == 0) && (*(ptr_line + LOG_SIGN_POSITION) == 'O')) || (((toggles_set & SHOW_DEBUG) == 0) && (*(ptr_line + LOG_SIGN_POSITION) == 'D')) || (((toggles_set & SHOW_TRACE) == 0) && (*(ptr_line + LOG_SIGN_POSITION) == 'T')) || (((toggles_set_parallel_jobs - 1) != (*(ptr_line + LOG_SIGN_POSITION + MAX_HOSTNAME_LENGTH + 4) - 48)) && (toggles_set_parallel_jobs != 0)))) { if (last == HIT) { memcpy(ptr_dst, ptr_start, block_length); *(ptr_dst + block_length) = '\0'; ptr_dst += block_length; block_length = 0; } last = MISS; } else { if (last == MISS) { ptr_start = ptr - length; } block_length += length; line_counter++; last = HIT; } } else { if ((length > LOG_SIGN_POSITION) && ((((toggles_set & SHOW_INFO) == 0) && (*(ptr_line + LOG_SIGN_POSITION) == 'I')) || (((toggles_set & SHOW_CONFIG) == 0) && (*(ptr_line + LOG_SIGN_POSITION) == 'C')) || (((toggles_set & SHOW_WARN) == 0) && (*(ptr_line + LOG_SIGN_POSITION) == 'W')) || (((toggles_set & SHOW_ERROR) == 0) && (*(ptr_line + LOG_SIGN_POSITION) == 'E')) || (((toggles_set & SHOW_FATAL) == 0) && (*(ptr_line + LOG_SIGN_POSITION) == 'F')) || (((toggles_set & SHOW_OFFLINE) == 0) && (*(ptr_line + LOG_SIGN_POSITION) == 'O')) || (((toggles_set & SHOW_DEBUG) == 0) && (*(ptr_line + LOG_SIGN_POSITION) == 'D')))) { if (last == HIT) { memcpy(ptr_dst, ptr_start, block_length); *(ptr_dst + block_length) = '\0'; ptr_dst += block_length; block_length = 0; } last = MISS; } else { if (last == MISS) { ptr_start = ptr - length; } block_length += length; line_counter++; last = HIT; } } } } if (block_length > 0) { memcpy(ptr_dst, ptr_start, block_length); *(ptr_dst + block_length) = '\0'; } #ifdef HAVE_MMAP if (munmap(src, stat_buf.st_size) < 0) { (void)xrec(WARN_DIALOG, "munmap() error : %s (%s %d)", strerror(errno), __FILE__, __LINE__); } #else free(src); #endif if (wpr_position == 0) { XmTextSetString(log_output, dst); } else { #ifndef LESSTIF_WORKAROUND XtUnmanageChild(log_output); #endif XmTextInsert(log_output, wpr_position, dst); #ifndef LESSTIF_WORKAROUND XtManageChild(log_output); #endif } wpr_position += tmp_total_length; total_length += tmp_total_length; free((void *)dst); attrs.cursor = None; XChangeWindowAttributes(display, XtWindow(appshell), CWCursor, &attrs); XFlush(display); /* Get rid of all events that have occurred. */ XSync(display, False); while (XCheckMaskEvent(display, ButtonPressMask | ButtonReleaseMask | ButtonMotionMask | PointerMotionMask | KeyPressMask, &event) == TRUE) { /* do nothing */; } } return; }