这篇教程C++ ui_error函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中ui_error函数的典型用法代码示例。如果您正苦于以下问题:C++ ui_error函数的具体用法?C++ ui_error怎么用?C++ ui_error使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了ui_error函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: write_pcapfilestatic void write_pcapfile(void){ FILE *f; DEBUG_MSG("write_pcapfile"); /* check if the file is writeable */ f = fopen(GBL_OPTIONS->pcapfile_out, "w"); if (f == NULL) { ui_error("Cannot write %s", GBL_OPTIONS->pcapfile_out); SAFE_FREE(GBL_OPTIONS->pcapfile_out); return; } /* if ok, delete it */ fclose(f); unlink(GBL_OPTIONS->pcapfile_out); /* set the options for writing to a file */ GBL_OPTIONS->write = 1; GBL_OPTIONS->read = 0;}
开发者ID:vishalekhe,项目名称:ettercap,代码行数:22,
示例2: driver_errorstatic voiddriver_error( void ){ switch( errno ) { case AO_ENODRIVER: ui_error( UI_ERROR_ERROR, "ao: no driver corresponds to driver_id." ); break; case AO_ENOTLIVE: ui_error( UI_ERROR_ERROR, "ao: driver is not a live output device." ); break; case AO_ENOTFILE: ui_error( UI_ERROR_ERROR, "ao: driver is not a file output driver." ); break; case AO_EBADOPTION: ui_error( UI_ERROR_ERROR, "ao: a valid option key has an invalid value." ); break; case AO_EOPENDEVICE: ui_error( UI_ERROR_ERROR, "ao: cannot open output device." ); break; case AO_EOPENFILE: ui_error( UI_ERROR_ERROR, "ao: cannot open output file '%s'.", filename ); break; case AO_EFILEEXISTS: ui_error( UI_ERROR_ERROR, "ao: output file '%s' already exists.", filename ); break; case AO_EFAIL: ui_error( UI_ERROR_ERROR, "ao: unspecified error." ); }}
开发者ID:CiaranG,项目名称:ZXdroid,代码行数:36,
示例3: tcp_send/* Send data from stream to tcp socket. * Will block until all data has been sent. */voidtcp_send(rdpTcp * tcp, STREAM s){ int sent = 0; int total = 0; int length = s->end - s->data;#ifndef DISABLE_TLS if (tcp->iso->mcs->sec->tls_connected) { tls_write(tcp->iso->mcs->sec->ssl, (char*) s->data, length); } else#endif { while (total < length) { while (total < length) { sent = send(tcp->sock, s->data + total, length - total, MSG_NOSIGNAL); if (sent <= 0) { if (sent == -1 && TCP_BLOCKS) { tcp_can_send(tcp->sock, 100); sent = 0; } else { ui_error(tcp->iso->mcs->sec->rdp->inst, "send: %s/n", TCP_STRERROR); return; } } total += sent; } } }}
开发者ID:nidelius,项目名称:FreeRDP,代码行数:40,
示例4: network_start_serverint network_start_server(void){ vice_network_socket_address_t * server_addr = NULL; int ret = -1; do { if (network_mode != NETWORK_IDLE) break; server_addr = vice_network_address_generate(server_bind_address, server_port); if ( ! server_addr ) { break; } listen_socket = vice_network_server(server_addr); if ( ! listen_socket ) { break; } /* Set proper settings */ if (resources_set_event_safe() < 0) { ui_error("Warning! Failed to set netplay-safe settings."); } network_mode = NETWORK_SERVER; vsync_suspend_speed_eval(); ui_display_statustext(translate_text(IDGS_SERVER_IS_WAITING_FOR_CLIENT), 1); ret = 0; } while (0); if (server_addr) { vice_network_address_close(server_addr); } return ret;}
开发者ID:twinaphex,项目名称:vice-next,代码行数:38,
示例5: add_cbstatic void add_cb(GtkButton *button, gpointer ptr){ GtkWidget *dialog; UNUSED(button); UNUSED(ptr); struct playlist_page *page = page_playlist(); if (page->playlist == japlay_queue || page->playlist == japlay_history) { ui_error("Can not add files to this playlist./n/nPlease select a main or a custom playlist./n"); return; } dialog = gtk_file_chooser_dialog_new("Add Files", GTK_WINDOW(main_window), GTK_FILE_CHOOSER_ACTION_OPEN, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, NULL); gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(dialog), true); const char *path = get_setting("file_chooser_path"); if (path) { gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog), path); } if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) { char *path = gtk_file_chooser_get_current_folder(GTK_FILE_CHOOSER(dialog)); if (path) { set_setting("file_chooser_path", path); free(path); } GSList *filelist = gtk_file_chooser_get_filenames(GTK_FILE_CHOOSER(dialog)); g_slist_foreach(filelist, (GFunc)add_one_file, NULL); g_slist_free(filelist); } gtk_widget_destroy(dialog);}
开发者ID:japeq,项目名称:japlay,代码行数:38,
示例6: svgadisplay_initint svgadisplay_init( void ){ size_t i; int found_mode = 0; vga_init(); /* First, see if our preferred mode exists */ for( i=0; i<mode_count && !found_mode; i++ ) { if( available_modes[i].fuse_id == settings_current.svga_mode || settings_current.doublescan_mode == 0 ) { if( vga_hasmode( available_modes[i].svgalib_id ) ) { vga_setmode( available_modes[i].svgalib_id ); hires = available_modes[i].hires; found_mode = 1; } } } /* If we haven't found a mode yet, try each in order */ for( i=0; i<mode_count && !found_mode; i++ ) { if( vga_hasmode( available_modes[i].svgalib_id ) ) { vga_setmode( available_modes[i].svgalib_id ); hires = available_modes[i].hires; found_mode = 1; } } /* Error out if we couldn't find a VGA mode */ if( !found_mode ) { ui_error( UI_ERROR_ERROR, "couldn't find a mode to start in" ); return 1; } svgadisplay_allocate_colours( 16 ); return 0;}
开发者ID:CiaranG,项目名称:ZXdroid,代码行数:38,
示例7: debugger_page_hashintdebugger_page_hash( const char *text ){ int offset; switch( tolower( (unsigned char)text[0] ) ) { case 'c': offset = BREAKPOINT_PAGE_ROMCS; break; case 'd': offset = BREAKPOINT_PAGE_DOCK; break; case 'r': offset = BREAKPOINT_PAGE_ROM; break; case 'x': offset = BREAKPOINT_PAGE_EXROM; break; default: ui_error( UI_ERROR_ERROR, "%s:debugger_page_hash: unknown page letter '%c'", __FILE__, text[0] ); fuse_abort(); } offset += atoi( &text[1] ); return offset;}
开发者ID:twinaphex,项目名称:sdcell,代码行数:23,
示例8: utils_read_fdintutils_read_fd( compat_fd fd, const char *filename, utils_file *file ){ file->length = compat_file_get_length( fd ); if( file->length == -1 ) return 1; file->buffer = libspectrum_new( unsigned char, file->length ); if( compat_file_read( fd, file ) ) { libspectrum_free( file->buffer ); compat_file_close( fd ); return 1; } if( compat_file_close( fd ) ) { ui_error( UI_ERROR_ERROR, "Couldn't close '%s': %s", filename, strerror( errno ) ); libspectrum_free( file->buffer ); return 1; } return 0;}
开发者ID:jacadym,项目名称:fuse-emulator,代码行数:23,
示例9: end_resid_dialogstatic void end_resid_dialog(HWND hwnd){ TCHAR st[4]; int temp_val, res_val; res_val = (int)SendDlgItemMessage(hwnd, IDC_SID_RESID_SAMPLING, CB_GETCURSEL, 0, 0); resources_set_int("SidResidSampling", res_val); GetDlgItemText(hwnd, IDC_SID_RESID_PASSBAND_VALUE, st, 4); temp_val = _ttoi(st); if (temp_val < 0) { res_val = 0; } else if (temp_val > 90) { res_val = 90; } else { res_val = temp_val; } if (temp_val != res_val) { ui_error(translate_text(IDS_VAL_D_FOR_S_OUT_RANGE_USE_D), temp_val, translate_text(IDS_SID_RESID_PASSBAND), res_val); } resources_set_int("SidResidPassband", res_val);}
开发者ID:bobsummerwill,项目名称:VICE,代码行数:23,
示例10: UI_CALLBACKstatic UI_CALLBACK(events_select_dir){ char *wd; unsigned int i, is_dir; int len; len = ioutil_maxpathlen(); wd = lib_malloc(len); ioutil_getcwd(wd, len); vsync_suspend_speed_eval(); if (ui_input_string(_("VICE setting"), _("Select history directory"), wd, len) == UI_BUTTON_OK) { ioutil_stat(wd, &i, &is_dir); if (!is_dir) ui_error(_("Directory not found")); else resources_set_string("EventSnapshotDir", wd); } lib_free(wd);}
开发者ID:martinpiper,项目名称:VICE,代码行数:23,
示例11: win32ui_get_monospaced_fontintwin32ui_get_monospaced_font( HFONT *font ){ if( ! monospaced_font ) { /* Get font height in pixels for current DPI resolution */ HDC hdc = GetDC( NULL ); long font_height = -MulDiv( 8, GetDeviceCaps( hdc, LOGPIXELSY ), 72 ); ReleaseDC( NULL, hdc ); *font = CreateFont( font_height, 0, 0, 0, 400, FALSE, FALSE, FALSE, 0, 400, 2, 1, 1, TEXT( "Courier New" ) ); if( *font == NULL ) { ui_error( UI_ERROR_ERROR, "couldn't find a monospaced font" ); return 1; } monospaced_font = *font; } else { *font = monospaced_font; } return 0;}
开发者ID:jacadym,项目名称:fuse-emulator,代码行数:23,
示例12: gtkui_set_netmask/* * set a different netmask than the system one */static void gtkui_set_netmask(void){ struct in_addr net; DEBUG_MSG("gtkui_set_netmask"); if (GBL_OPTIONS->netmask == NULL) SAFE_CALLOC(GBL_OPTIONS->netmask, IP_ASCII_ADDR_LEN, sizeof(char)); /* * no callback, the filter is set but we have to return to * the interface for other user input */ gtkui_input("Netmask :", GBL_OPTIONS->netmask, IP_ASCII_ADDR_LEN, NULL); /* sanity check */ if (strcmp(GBL_OPTIONS->netmask, "") && inet_aton(GBL_OPTIONS->netmask, &net) == 0) ui_error("Invalid netmask %s", GBL_OPTIONS->netmask); /* if no netmask was specified, free it */ if (!strcmp(GBL_OPTIONS->netmask, "")) SAFE_FREE(GBL_OPTIONS->netmask);}
开发者ID:ftbe,项目名称:ettercap,代码行数:26,
示例13: add_dir_cbstatic void add_dir_cb(GtkMenuItem *menuitem, gpointer ptr){ GtkWidget *dialog; UNUSED(menuitem); UNUSED(ptr); struct playlist_page *page = page_playlist(); if (page->playlist == japlay_queue || page->playlist == japlay_history) { ui_error("Can not add files to this playlist./n/nPlease select a main or a custom playlist./n"); return; } dialog = gtk_file_chooser_dialog_new("Add directory", GTK_WINDOW(main_window), GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, NULL); const char *path = get_setting("file_chooser_path"); if (path) { gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog), path); } if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) { char *path = gtk_file_chooser_get_current_folder(GTK_FILE_CHOOSER(dialog)); if (path) { set_setting("file_chooser_path", path); free(path); } char *filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog)); add_dir_or_file_playlist(page->playlist, filename); g_free(filename); } gtk_widget_destroy(dialog);}
开发者ID:japeq,项目名称:japlay,代码行数:37,
示例14: ui_initintui_init( int *argc, char ***argv ){ int error;#ifdef USE_WIDGET if( ui_widget_init() ) return 1;#endif /* #ifdef USE_WIDGET */ error = atexit( wii_end ); if( error ) { ui_error( UI_ERROR_ERROR, "%s: couldn't set atexit function", __func__ ); return 1; } error = wiidisplay_init(); if( error ) return error; error = wiikeyboard_init(); if( error ) return error; error = wiimouse_init(); if( error ) return error; return 0;}
开发者ID:twinaphex,项目名称:sdcell,代码行数:24,
示例15: debugger_breakpoint_add_portintdebugger_breakpoint_add_port( debugger_breakpoint_type type, libspectrum_word port, libspectrum_word mask, size_t ignore, debugger_breakpoint_life life, debugger_expression *condition ){ debugger_breakpoint_value value; switch( type ) { case DEBUGGER_BREAKPOINT_TYPE_PORT_READ: case DEBUGGER_BREAKPOINT_TYPE_PORT_WRITE: break; default: ui_error( UI_ERROR_ERROR, "debugger_breakpoint_add_port given type %d", type ); fuse_abort(); } value.port.port = port; value.port.mask = mask; return breakpoint_add( type, value, ignore, life, condition );}
开发者ID:twinaphex,项目名称:sdcell,代码行数:24,
示例16: encode_bank_and_pagestatic intencode_bank_and_page( debugger_breakpoint_type type, libspectrum_word address ){ memory_page *read_write, *page; breakpoint_page_offset offset; switch( type ) { case DEBUGGER_BREAKPOINT_TYPE_EXECUTE: case DEBUGGER_BREAKPOINT_TYPE_READ: read_write = memory_map_read; break; case DEBUGGER_BREAKPOINT_TYPE_WRITE: read_write = memory_map_write; break; default: ui_error( UI_ERROR_ERROR, "encode_bank_and_page: unexpected breakpoint type %d", type ); return -1; } page = &read_write[ address >> 13 ]; switch( page->bank ) { case MEMORY_BANK_HOME: offset = page->writable ? BREAKPOINT_PAGE_RAM : BREAKPOINT_PAGE_ROM; break; case MEMORY_BANK_DOCK: offset = BREAKPOINT_PAGE_DOCK; break; case MEMORY_BANK_EXROM: offset = BREAKPOINT_PAGE_EXROM; break; case MEMORY_BANK_ROMCS: offset = BREAKPOINT_PAGE_ROMCS; break; default: return -1; } return offset + page->page_num;}
开发者ID:twinaphex,项目名称:sdcell,代码行数:36,
示例17: sound_init_blipstatic intsound_init_blip( Blip_Buffer **buf, Blip_Synth **synth ){ *buf = new_Blip_Buffer(); blip_buffer_set_clock_rate( *buf, sound_get_effective_processor_speed() ); /* Allow up to 1s of playback buffer - this allows us to cope with slowing down to 2% of speed where a single Speccy frame generates just under 1s of sound */ if ( blip_buffer_set_sample_rate( *buf, settings_current.sound_freq, 1000 ) ) { sound_end(); ui_error( UI_ERROR_ERROR, "out of memory at %s:%d", __FILE__, __LINE__ ); return 0; } *synth = new_Blip_Synth(); blip_synth_set_volume( *synth, sound_get_volume( settings_current.volume_beeper ) ); blip_synth_set_output( *synth, *buf ); blip_buffer_set_bass_freq( *buf, speaker_type[ option_enumerate_sound_speaker_type() ].bass ); blip_synth_set_treble_eq( *synth, speaker_type[ option_enumerate_sound_speaker_type() ].treble ); return 1;}
开发者ID:matthewbauer,项目名称:fuse-libretro,代码行数:24,
示例18: sound_resamplestatic voidsound_resample( void ){ int error; SRC_DATA data; data.data_in = convert_input_buffer; data.input_frames = sound_generator_framesiz; data.data_out = convert_output_buffer; data.output_frames = sound_framesiz; data.src_ratio = ( double ) settings_current.sound_freq / sound_generator_freq; data.end_of_input = 0; src_short_to_float_array( ( const short * ) sound_buf, convert_input_buffer, sound_generator_framesiz * sound_channels ); while( data.input_frames ) { error = src_process( src_state, &data ); if( error ) { ui_error( UI_ERROR_ERROR, "hifi sound downsample error %s", src_strerror( error ) ); sound_end(_this); return; } src_float_to_short_array( convert_output_buffer, ( short * ) sound_buf, data.output_frames_gen * sound_channels ); sound_lowlevel_frame( sound_buf, data.output_frames_gen * sound_channels ); data.data_in += data.input_frames_used * sound_channels; data.input_frames -= data.input_frames_used; }}
开发者ID:jvernet,项目名称:apple2,代码行数:36,
示例19: tcp_recv/* Read length bytes from tcp socket to stream and return it. * Appends to stream s if specified, otherwise it uses stream from tcp layer. * Will block until data available. * Returns NULL on error. */STREAMtcp_recv(rdpTcp * tcp, STREAM s, uint32 length){ int rcvd = 0; uint32 p_offset; uint32 new_length; uint32 end_offset; if (s == NULL) { /* read into "new" stream */ if (length > tcp->in.size) { tcp->in.data = (uint8 *) xrealloc(tcp->in.data, length); tcp->in.size = length; } tcp->in.end = tcp->in.p = tcp->in.data; s = &(tcp->in); } else { /* append to existing stream */ new_length = (s->end - s->data) + length; if (new_length > s->size) { p_offset = s->p - s->data; end_offset = s->end - s->data; s->data = (uint8 *) xrealloc(s->data, new_length); s->size = new_length; s->p = s->data + p_offset; s->end = s->data + end_offset; } } while (length > 0) {#ifndef DISABLE_TLS if (tcp->iso->mcs->sec->tls_connected) { rcvd = tls_read(tcp->iso->mcs->sec->ssl, (char*) s->end, length); if (rcvd < 0) return NULL; } else#endif { if (!ui_select(tcp->iso->mcs->sec->rdp->inst, tcp->sock)) return NULL; /* user quit */ rcvd = recv(tcp->sock, s->end, length, 0); if (rcvd < 0) { if (rcvd == -1 && TCP_BLOCKS) { tcp_can_recv(tcp->sock, 1); rcvd = 0; } else { ui_error(tcp->iso->mcs->sec->rdp->inst, "recv: %s/n", TCP_STRERROR); return NULL; } } else if (rcvd == 0) { ui_error(tcp->iso->mcs->sec->rdp->inst, "Connection closed/n"); return NULL; } } s->end += rcvd; length -= rcvd; } return s;}
开发者ID:nidelius,项目名称:FreeRDP,代码行数:82,
示例20: sound_initvoidsound_init( const char *device ){ float hz; double treble; Blip_Synth **ay_left_synth; Blip_Synth **ay_mid_synth; Blip_Synth **ay_mid_synth_r; Blip_Synth **ay_right_synth; /* Allow sound as long as emulation speed is greater than 2% (less than that and a single Speccy frame generates more than a seconds worth of sound which is bigger than the maximum Blip_Buffer of 1 second) */ if( !( !sound_enabled && settings_current.sound && settings_current.emulation_speed > 1 ) ) return; /* only try for stereo if we need it */ sound_stereo_ay = option_enumerate_sound_stereo_ay(); if( settings_current.sound && sound_lowlevel_init( device, &settings_current.sound_freq, &sound_stereo_ay ) ) return; if( !sound_init_blip(&left_buf, &left_beeper_synth) ) return; if( sound_stereo_ay != SOUND_STEREO_AY_NONE && !sound_init_blip(&right_buf, &right_beeper_synth) ) return; treble = speaker_type[ option_enumerate_sound_speaker_type() ].treble; ay_a_synth = new_Blip_Synth(); blip_synth_set_volume( ay_a_synth, sound_get_volume( settings_current.volume_ay) ); blip_synth_set_treble_eq( ay_a_synth, treble ); ay_b_synth = new_Blip_Synth(); blip_synth_set_volume( ay_b_synth, sound_get_volume( settings_current.volume_ay) ); blip_synth_set_treble_eq( ay_b_synth, treble ); ay_c_synth = new_Blip_Synth(); blip_synth_set_volume( ay_c_synth, sound_get_volume( settings_current.volume_ay) ); blip_synth_set_treble_eq( ay_c_synth, treble ); left_specdrum_synth = new_Blip_Synth(); blip_synth_set_volume( left_specdrum_synth, sound_get_volume( settings_current.volume_specdrum ) ); blip_synth_set_output( left_specdrum_synth, left_buf ); blip_synth_set_treble_eq( left_specdrum_synth, treble ); /* important to override these settings if not using stereo * (it would probably be confusing to mess with the stereo * settings in settings_current though, which is why we make copies * rather than using the real ones). */ ay_a_synth_r = NULL; ay_b_synth_r = NULL; ay_c_synth_r = NULL; if( sound_stereo_ay != SOUND_STEREO_AY_NONE ) { /* Attach the Blip_Synth's we've already created as appropriate, and * create one more Blip_Synth for the middle channel's right buffer. */ if( sound_stereo_ay == SOUND_STEREO_AY_ACB ) { ay_left_synth = &ay_a_synth; ay_mid_synth = &ay_c_synth; ay_mid_synth_r = &ay_c_synth_r; ay_right_synth = &ay_b_synth; } else if ( sound_stereo_ay == SOUND_STEREO_AY_ABC ) { ay_left_synth = &ay_a_synth; ay_mid_synth = &ay_b_synth; ay_mid_synth_r = &ay_b_synth_r; ay_right_synth = &ay_c_synth; } else { ui_error( UI_ERROR_ERROR, "unknown AY stereo separation type: %d", sound_stereo_ay ); fuse_abort(); } blip_synth_set_output( *ay_left_synth, left_buf ); blip_synth_set_output( *ay_mid_synth, left_buf ); blip_synth_set_output( *ay_right_synth, right_buf ); *ay_mid_synth_r = new_Blip_Synth(); blip_synth_set_volume( *ay_mid_synth_r, sound_get_volume( settings_current.volume_ay ) ); blip_synth_set_output( *ay_mid_synth_r, right_buf ); blip_synth_set_treble_eq( *ay_mid_synth_r, treble ); right_specdrum_synth = new_Blip_Synth(); blip_synth_set_volume( right_specdrum_synth, sound_get_volume( settings_current.volume_specdrum ) ); blip_synth_set_output( right_specdrum_synth, right_buf ); blip_synth_set_treble_eq( right_specdrum_synth, treble ); } else { blip_synth_set_output( ay_a_synth, left_buf ); blip_synth_set_output( ay_b_synth, left_buf ); blip_synth_set_output( ay_c_synth, left_buf ); } sound_enabled = sound_enabled_ever = 1;//.........这里部分代码省略.........
开发者ID:matthewbauer,项目名称:fuse-libretro,代码行数:101,
示例21: dx_initstatic int dx_init(const char *param, int *speed, int *fragsize, int *fragnr, int *channels){HRESULT result; DEBUG(("DirectSound driver initialization: speed = %d, fragsize = %d, fragnr = %d, channels = %d/n", *speed, *fragsize, *fragnr, *channels)); if (ds == NULL) { result = DirectSoundCreate(NULL, &ds, NULL); if (result != DS_OK) { ui_error("Cannot initialize DirectSound:/n%s", ds_error(result)); return -1; } result = IDirectSound_SetCooperativeLevel(ds, ui_get_main_hwnd(), DSSCL_EXCLUSIVE); if (result != DS_OK) { ui_error("Cannot set cooperative level:/n%s", ds_error(result)); return -1; } } memset(&capabilities, 0, sizeof(DSCAPS)); capabilities.dwSize = sizeof(DSCAPS); IDirectSound_GetCaps(ds, &capabilities); if ((capabilities.dwFlags & DSCAPS_PRIMARY16BIT) || (capabilities.dwFlags & DSCAPS_SECONDARY16BIT)) { is16bit = 1; } else { is16bit = 0; } if (!((capabilities.dwFlags & DSCAPS_PRIMARYSTEREO) || (capabilities.dwFlags & DSCAPS_SECONDARYSTEREO))) { *channels = 1; } num_of_channels = *channels; DEBUG(("16bit flag: %d",is16bit)); DEBUG(("Channels: %d",*channels)); DEBUG(("Capabilities %08x",capabilities.dwFlags)); DEBUG(("Secondary min Hz: %d",capabilities.dwMinSecondarySampleRate)); DEBUG(("Secondary max Hz: %d",capabilities.dwMaxSecondarySampleRate)); memset(&pcmwf, 0, sizeof(PCMWAVEFORMAT)); pcmwf.wf.wFormatTag = WAVE_FORMAT_PCM; pcmwf.wf.nChannels = *channels; pcmwf.wf.nSamplesPerSec = *speed; pcmwf.wBitsPerSample = is16bit ? 16 : 8;/* Hack to fix if mmsystem header is bad ((WORD*)&pcmwf)[7] = 16;*/ pcmwf.wf.nBlockAlign = (is16bit ? 2 : 1) * *channels; pcmwf.wf.nAvgBytesPerSec = pcmwf.wf.nSamplesPerSec * pcmwf.wf.nBlockAlign; memset(&desc, 0, sizeof(DSBUFFERDESC)); desc.dwSize = sizeof(DSBUFFERDESC); desc.dwFlags = DSBCAPS_PRIMARYBUFFER; fragment_size = *fragsize; /* frames */ buffer_size = *fragsize * *fragnr * (is16bit ? 2 : 1) * *channels; /* bytes */ stream_buffer_size = fragment_size * *fragnr * *channels; /* nr of samples */ buffer_offset = 0; /* bytes */ result = IDirectSound_CreateSoundBuffer(ds, &desc, &pbuffer, NULL); if (result != DS_OK) { ui_error("Cannot create Primary DirectSound bufer: %s", ds_error(result)); return -1; } memset(&desc, 0, sizeof(DSBUFFERDESC)); desc.dwSize = sizeof(DSBUFFERDESC); desc.dwFlags = DSBCAPS_CTRLPOSITIONNOTIFY | DSBCAPS_GETCURRENTPOSITION2 | DSBCAPS_CTRLFREQUENCY | DSBCAPS_CTRLPAN | DSBCAPS_CTRLVOLUME | DSBCAPS_GLOBALFOCUS ; desc.dwBufferBytes = buffer_size; desc.lpwfxFormat = (LPWAVEFORMATEX)&pcmwf; result = IDirectSound_CreateSoundBuffer(ds, &desc, &buffer, NULL); if (result != DS_OK) { ui_error("Cannot create DirectSound buffer:/n%s", ds_error(result)); return -1; } memset(&wfex, 0, sizeof(WAVEFORMATEX)); wfex.wFormatTag = WAVE_FORMAT_PCM; wfex.nChannels = *channels; wfex.nSamplesPerSec = *speed; wfex.wBitsPerSample = is16bit ? 16 : 8; wfex.nBlockAlign = (is16bit ? 2 : 1) * *channels; wfex.nAvgBytesPerSec = wfex.nSamplesPerSec * wfex.nBlockAlign; result=IDirectSoundBuffer_SetFormat(pbuffer, &wfex); if (result != DS_OK) { ui_error("Cannot set Output format for primary sound buffer:/n%s",//.........这里部分代码省略.........
开发者ID:twinaphex,项目名称:vice-next,代码行数:101,
示例22: ui_statusbar_updateintui_statusbar_update( ui_statusbar_item item, ui_statusbar_state state ){ GdkPixbuf *which; switch( item ) { case UI_STATUSBAR_ITEM_DISK: switch( state ) { case UI_STATUSBAR_STATE_NOT_AVAILABLE: gtk_widget_hide( disk_status ); break; case UI_STATUSBAR_STATE_ACTIVE: gtk_widget_show( disk_status ); gtk_image_set_from_pixbuf( GTK_IMAGE( disk_status ), pixbuf_disk_active ); break; default: gtk_widget_show( disk_status ); gtk_image_set_from_pixbuf( GTK_IMAGE( disk_status ), pixbuf_disk_inactive ); break; } return 0; case UI_STATUSBAR_ITEM_MOUSE: which = ( state == UI_STATUSBAR_STATE_ACTIVE ? pixbuf_mouse_active : pixbuf_mouse_inactive ); gtk_image_set_from_pixbuf( GTK_IMAGE( mouse_status ), which ); return 0; case UI_STATUSBAR_ITEM_PAUSED: which = ( state == UI_STATUSBAR_STATE_ACTIVE ? pixbuf_pause_active : pixbuf_pause_inactive ); gtk_image_set_from_pixbuf( GTK_IMAGE( pause_status ), which ); return 0; case UI_STATUSBAR_ITEM_MICRODRIVE: switch( state ) { case UI_STATUSBAR_STATE_NOT_AVAILABLE: gtk_widget_hide( microdrive_status ); break; case UI_STATUSBAR_STATE_ACTIVE: gtk_widget_show( microdrive_status ); gtk_image_set_from_pixbuf( GTK_IMAGE( microdrive_status ), pixbuf_mdr_active ); break; default: gtk_widget_show( microdrive_status ); gtk_image_set_from_pixbuf( GTK_IMAGE( microdrive_status ), pixbuf_mdr_inactive ); break; } return 0; case UI_STATUSBAR_ITEM_TAPE: which = ( state == UI_STATUSBAR_STATE_ACTIVE ? pixbuf_tape_active : pixbuf_tape_inactive ); gtk_image_set_from_pixbuf( GTK_IMAGE( tape_status ), which ); return 0; } ui_error( UI_ERROR_ERROR, "Attempt to update unknown statusbar item %d", item ); return 1;}
开发者ID:matthewbauer,项目名称:fuse-libretro,代码行数:65,
示例23: sound_initstatic void sound_init( CAY8910 *_this, const char *device, unsigned long nSampleRate ){// static int first_init = 1;// int f, ret; float hz;#ifdef HAVE_SAMPLERATE int error;#endif /* #ifdef HAVE_SAMPLERATE *//* if we don't have any sound I/O code compiled in, don't do sound */#ifdef NO_SOUND return;#endif#if 0 if( !( !sound_enabled && settings_current.sound && settings_current.emulation_speed == 100 ) ) return; sound_stereo_ay = settings_current.stereo_ay; sound_stereo_beeper = settings_current.stereo_beeper;/* only try for stereo if we need it */ if( sound_stereo_ay || sound_stereo_beeper ) sound_stereo = 1; ret = sound_lowlevel_init( device, &settings_current.sound_freq, &sound_stereo ); if( ret ) return;#endif#if 0/* important to override these settings if not using stereo * (it would probably be confusing to mess with the stereo * settings in settings_current though, which is why we make copies * rather than using the real ones). */ if( !sound_stereo ) { sound_stereo_ay = 0; sound_stereo_beeper = 0; } sound_enabled = sound_enabled_ever = 1; sound_channels = ( sound_stereo ? 2 : 1 );#endif sound_channels = 3; // 3 mono channels: ABC// hz = ( float ) machine_current->timings.processor_speed /// machine_current->timings.tstates_per_frame; hz = HZ_COMMON_DENOMINATOR;// sound_generator_freq =// settings_current.sound_hifi ? HIFI_FREQ : settings_current.sound_freq; sound_generator_freq = nSampleRate; sound_generator_framesiz = sound_generator_freq / (int)hz;#if 0 if( ( sound_buf = (libspectrum_signed_word*) malloc( sizeof( libspectrum_signed_word ) * sound_generator_framesiz * sound_channels ) ) == NULL || ( tape_buf = malloc( sizeof( libspectrum_signed_word ) * sound_generator_framesiz ) ) == NULL ) { if( sound_buf ) { free( sound_buf ); sound_buf = NULL; } sound_end(_this); return; }#endif// sound_framesiz = ( float ) settings_current.sound_freq / hz; sound_framesiz = sound_generator_freq / (int)hz;#ifdef HAVE_SAMPLERATE if( settings_current.sound_hifi ) { if( ( convert_input_buffer = malloc( sizeof( float ) * sound_generator_framesiz * sound_channels ) ) == NULL || ( convert_output_buffer = malloc( sizeof( float ) * sound_framesiz * sound_channels ) ) == NULL ) { if( convert_input_buffer ) { free( convert_input_buffer ); convert_input_buffer = NULL; } sound_end(_this); return; } } src_state = src_new( SRC_SINC_MEDIUM_QUALITY, sound_channels, &error ); if( error ) { ui_error( UI_ERROR_ERROR, "error initialising sample rate converter %s", src_strerror( error ) ); sound_end(_this);//.........这里部分代码省略.........
开发者ID:jvernet,项目名称:apple2,代码行数:101,
示例24: sound_lowlevel_initintsound_lowlevel_init( const char *device, int *freqptr, int *stereoptr ){ unsigned int exact_rate, periods; unsigned int val, n; snd_pcm_hw_params_t *hw_params; snd_pcm_sw_params_t *sw_params; snd_pcm_uframes_t avail_min = 0, sound_periodsize, bsize = 0; static int first_init = 1; static int init_running = 0; const char *option; char tmp; int err, dir, nperiods = NUM_FRAMES; float hz; if( init_running ) return 0; init_running = 1;/* select a default device if we weren't explicitly given one */ option = device; while( option && *option ) { tmp = '*'; if( ( err = sscanf( option, " buffer=%i %n%c", &val, &n, &tmp ) > 0 ) && ( tmp == ',' || strlen( option ) == n ) ) { if( val < 1 ) { fprintf( stderr, "Bad value for ALSA buffer size %i, using default/n", val ); } else { bsize = val; } } else if( ( err = sscanf( option, " frames=%i %n%c", &val, &n, &tmp ) > 0 ) && ( tmp == ',' || strlen( option ) == n ) ) { if( val < 1 ) { fprintf( stderr, "Bad value for ALSA buffer size %i frames, using default (%d)/n", val, NUM_FRAMES ); } else { nperiods = val; } } else if( ( err = sscanf( option, " avail=%i %n%c", &val, &n, &tmp ) > 0 ) && ( tmp == ',' || strlen( option ) == n ) ) { if( val < 1 ) { fprintf( stderr, "Bad value for ALSA avail_min size %i frames, using default/n", val ); } else { avail_min = val; } } else if( ( err = sscanf( option, " verbose %n%c", &n, &tmp ) == 1 ) && ( tmp == ',' || strlen( option ) == n ) ) { verb = 1; } else { /* try as device name */ while( isspace(*option) ) option++; if( *option == '/'' ) /* force device... */ option++; pcm_name = option; n = strlen( pcm_name ); } option += n + ( tmp == ',' ); }/* Open the sound device */ if( pcm_name == NULL || *pcm_name == '/0' ) pcm_name = "default"; if( snd_pcm_open( &pcm_handle, pcm_name , stream, 0 ) < 0 ) { if( strcmp( pcm_name, "default" ) == 0 ) { /* we try a last one: plughw:0,0 but what a weired ALSA conf.... */ if( snd_pcm_open( &pcm_handle, "plughw:0,0", stream, 0 ) < 0 ) { settings_current.sound = 0; ui_error( UI_ERROR_ERROR, "couldn't open sound device 'default' and 'plughw:0,0' check ALSA configuration." ); init_running = 0; return 1; } else { if( first_init ) fprintf( stderr, "Couldn't open sound device 'default', using 'plughw:0,0' check ALSA configuration./n" ); } } settings_current.sound = 0; ui_error( UI_ERROR_ERROR, "couldn't open sound device '%s'.", pcm_name ); init_running = 0; return 1; }/* Allocate the snd_pcm_hw_params_t structure on the stack. */ snd_pcm_hw_params_alloca( &hw_params );/* Init hw_params with full configuration space */ if( snd_pcm_hw_params_any( pcm_handle, hw_params ) < 0 ) { settings_current.sound = 0; ui_error( UI_ERROR_ERROR, "couldn't get configuration space on sound device '%s'.", pcm_name ); snd_pcm_close( pcm_handle );//.........这里部分代码省略.........
开发者ID:jacadym,项目名称:fuse-emulator,代码行数:101,
示例25: utils_open_file/* Open `filename' and do something sensible with it; autoload tapes if `autoload' is true and return the type of file found in `type' */intutils_open_file( const char *filename, int autoload, libspectrum_id_t *type_ptr){ utils_file file; libspectrum_id_t type; libspectrum_class_t class; int error; error = 0; if( rzx_recording ) error = rzx_stop_recording(); if( rzx_playback ) error = rzx_stop_playback( 1 ); if( error ) return error; /* Read the file into a buffer */ if( utils_read_file( filename, &file ) ) return 1; /* See if we can work out what it is */ if( libspectrum_identify_file_with_class( &type, &class, filename, file.buffer, file.length ) ) { utils_close_file( &file ); return 1; } switch( class ) { case LIBSPECTRUM_CLASS_UNKNOWN: ui_error( UI_ERROR_ERROR, "utils_open_file: couldn't identify `%s'", filename ); utils_close_file( &file ); return 1; case LIBSPECTRUM_CLASS_RECORDING: error = rzx_start_playback_from_buffer( file.buffer, file.length ); break; case LIBSPECTRUM_CLASS_SNAPSHOT: error = snapshot_read_buffer( file.buffer, file.length, type ); pokemem_find_pokfile( filename ); break; case LIBSPECTRUM_CLASS_TAPE: error = tape_read_buffer( file.buffer, file.length, type, filename, autoload ); pokemem_find_pokfile( filename ); break; case LIBSPECTRUM_CLASS_DISK_PLUS3: if( !( machine_current->capabilities & LIBSPECTRUM_MACHINE_CAPABILITY_PLUS3_DISK ) ) { error = machine_select( LIBSPECTRUM_MACHINE_PLUS3 ); if( error ) break; } error = specplus3_disk_insert( SPECPLUS3_DRIVE_A, filename, autoload ); break; case LIBSPECTRUM_CLASS_DISK_DIDAKTIK: error = didaktik80_disk_insert( DIDAKTIK80_DRIVE_A, filename, autoload ); break; case LIBSPECTRUM_CLASS_DISK_PLUSD: if( periph_is_active( PERIPH_TYPE_DISCIPLE ) ) error = disciple_disk_insert( DISCIPLE_DRIVE_1, filename, autoload ); else error = plusd_disk_insert( PLUSD_DRIVE_1, filename, autoload ); break; case LIBSPECTRUM_CLASS_DISK_OPUS: error = opus_disk_insert( OPUS_DRIVE_1, filename, autoload ); break; case LIBSPECTRUM_CLASS_DISK_TRDOS: if( !( machine_current->capabilities & LIBSPECTRUM_MACHINE_CAPABILITY_TRDOS_DISK ) && !periph_is_active( PERIPH_TYPE_BETA128 ) ) { error = machine_select( LIBSPECTRUM_MACHINE_PENT ); if( error ) break; } /* Check that we actually got a Beta capable machine to insert the disk */ if( ( machine_current->capabilities & LIBSPECTRUM_MACHINE_CAPABILITY_TRDOS_DISK ) || periph_is_active( PERIPH_TYPE_BETA128 ) ) { error = beta_disk_insert( BETA_DRIVE_A, filename, autoload ); } break; case LIBSPECTRUM_CLASS_DISK_GENERIC: if( machine_current->machine == LIBSPECTRUM_MACHINE_PLUS3 || machine_current->machine == LIBSPECTRUM_MACHINE_PLUS2A ) error = specplus3_disk_insert( SPECPLUS3_DRIVE_A, filename, autoload ); else if( machine_current->machine == LIBSPECTRUM_MACHINE_PENT || machine_current->machine == LIBSPECTRUM_MACHINE_PENT512 || machine_current->machine == LIBSPECTRUM_MACHINE_PENT1024 || machine_current->machine == LIBSPECTRUM_MACHINE_SCORP )//.........这里部分代码省略.........
开发者ID:jacadym,项目名称:fuse-emulator,代码行数:101,
示例26: evaluate_binaryopstatic libspectrum_dwordevaluate_binaryop( struct binaryop_type *binary ){ switch( binary->operation ) { case '+': return debugger_expression_evaluate( binary->op1 ) + debugger_expression_evaluate( binary->op2 ); case '-': return debugger_expression_evaluate( binary->op1 ) - debugger_expression_evaluate( binary->op2 ); case '*': return debugger_expression_evaluate( binary->op1 ) * debugger_expression_evaluate( binary->op2 ); case '/': return debugger_expression_evaluate( binary->op1 ) / debugger_expression_evaluate( binary->op2 ); case DEBUGGER_TOKEN_EQUAL_TO: return debugger_expression_evaluate( binary->op1 ) == debugger_expression_evaluate( binary->op2 ); case DEBUGGER_TOKEN_NOT_EQUAL_TO: return debugger_expression_evaluate( binary->op1 ) != debugger_expression_evaluate( binary->op2 ); case '>': return debugger_expression_evaluate( binary->op1 ) > debugger_expression_evaluate( binary->op2 ); case '<': return debugger_expression_evaluate( binary->op1 ) < debugger_expression_evaluate( binary->op2 ); case DEBUGGER_TOKEN_LESS_THAN_OR_EQUAL_TO: return debugger_expression_evaluate( binary->op1 ) <= debugger_expression_evaluate( binary->op2 ); case DEBUGGER_TOKEN_GREATER_THAN_OR_EQUAL_TO: return debugger_expression_evaluate( binary->op1 ) >= debugger_expression_evaluate( binary->op2 ); case '&': return debugger_expression_evaluate( binary->op1 ) & debugger_expression_evaluate( binary->op2 ); case '^': return debugger_expression_evaluate( binary->op1 ) ^ debugger_expression_evaluate( binary->op2 ); case '|': return debugger_expression_evaluate( binary->op1 ) | debugger_expression_evaluate( binary->op2 ); case DEBUGGER_TOKEN_LOGICAL_AND: return debugger_expression_evaluate( binary->op1 ) && debugger_expression_evaluate( binary->op2 ); case DEBUGGER_TOKEN_LOGICAL_OR: return debugger_expression_evaluate( binary->op1 ) || debugger_expression_evaluate( binary->op2 ); } ui_error( UI_ERROR_ERROR, "unknown binary operator %d", binary->operation ); fuse_abort();}
开发者ID:CiaranG,项目名称:ZXdroid,代码行数:61,
示例27: deparse_binaryopstatic intdeparse_binaryop( char *buffer, size_t length, const struct binaryop_type *binaryop ){ char *operand1_buffer, *operand2_buffer; const char *operation_string = NULL; int brackets_necessary1, brackets_necessary2; int error; operand1_buffer = malloc( 2 * length ); if( !operand1_buffer ) { ui_error( UI_ERROR_ERROR, "out of memory at %s:%d", __FILE__, __LINE__ ); return 1; } operand2_buffer = &operand1_buffer[ length ]; error = debugger_expression_deparse( operand1_buffer, length, binaryop->op1 ); if( error ) { free( operand1_buffer ); return error; } error = debugger_expression_deparse( operand2_buffer, length, binaryop->op2 ); if( error ) { free( operand1_buffer ); return error; } switch( binaryop->operation ) { case '+': operation_string = "+"; break; case '-': operation_string = "-"; break; case '*': operation_string = "*"; break; case '/': operation_string = "/"; break; case DEBUGGER_TOKEN_EQUAL_TO: operation_string = "=="; break; case DEBUGGER_TOKEN_NOT_EQUAL_TO: operation_string = "!="; break; case '<': operation_string = "<"; break; case '>': operation_string = ">"; break; case DEBUGGER_TOKEN_LESS_THAN_OR_EQUAL_TO: operation_string = "<="; break; case DEBUGGER_TOKEN_GREATER_THAN_OR_EQUAL_TO: operation_string = ">="; break; case '&': operation_string = "&"; break; case '^': operation_string = "^"; break; case '|': operation_string = "|"; break; case DEBUGGER_TOKEN_LOGICAL_AND: operation_string = "&&"; break; case DEBUGGER_TOKEN_LOGICAL_OR: operation_string = "||"; break; default: ui_error( UI_ERROR_ERROR, "unknown binary operation %d", binaryop->operation ); fuse_abort(); } brackets_necessary1 = brackets_necessary( binaryop->operation, binaryop->op1 ); brackets_necessary2 = brackets_necessary( binaryop->operation, binaryop->op2 ); snprintf( buffer, length, "%s%s%s %s %s%s%s", brackets_necessary1 ? "( " : "", operand1_buffer, brackets_necessary1 ? " )" : "", operation_string, brackets_necessary2 ? "( " : "", operand2_buffer, brackets_necessary2 ? " )" : "" ); free( operand1_buffer ); return 0;}
开发者ID:CiaranG,项目名称:ZXdroid,代码行数:63,
示例28: dialog_advanced_procstatic BOOL CALLBACK dialog_advanced_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam){ int type, ival; float tf; TCHAR s[100]; extern int querynewpalette; switch (msg) { case WM_NOTIFY: if (((NMHDR FAR *)lparam)->code == (UINT)PSN_APPLY) { GetDlgItemText(hwnd, IDC_VIDEO_COLORS_GAM, s, 100); _stscanf(s, TEXT("%f"), &tf); ival = (int)(tf * 1000.0 + 0.5); resources_set_int("ColorGamma", ival); resources_set_int(current_chip->res_ExternalPalette_name, res_extpalette); GetDlgItemText(hwnd, IDC_VIDEO_ADVANCED_SHADE, s, 100); _stscanf(s, TEXT("%f"), &tf); ival = (int)(tf * 1000.0 + 0.5); resources_set_int("PALScanLineShade", ival); GetDlgItemText(hwnd, IDC_VIDEO_ADVANCED_BLUR, s, 100); _stscanf(s, TEXT("%f"), &tf); ival = (int)(tf * 1000.0 + 0.5); resources_set_int("PALBlur", ival); ival = SendMessage(GetDlgItem(hwnd, IDC_VIDEO_ADVANCED_MODE), CB_GETCURSEL, 0, 0); resources_set_int("PALMode", ival); querynewpalette = 1; if (resources_set_string(current_chip->res_PaletteFile_name, palette_file) < 0) { ui_error(translate_text(IDS_COULD_NOT_LOAD_PALETTE)); resources_set_int(current_chip->res_ExternalPalette_name, res_extpalette); SetWindowLong (hwnd, DWL_MSGRESULT, TRUE); return TRUE; } lib_free(palette_file); palette_file = NULL; resources_set_int(current_chip->res_ExternalPalette_name, res_extpalette); SetWindowLong(hwnd, DWL_MSGRESULT, FALSE); return TRUE; } return FALSE; case WM_INITDIALOG: init_advanced_dialog(hwnd, (Chip_Parameters*)((PROPSHEETPAGE*)lparam)->lParam); return TRUE; case WM_COMMAND: type = LOWORD(wparam); switch (type) { case IDC_TOGGLE_VIDEO_EXTPALETTE: res_extpalette = !res_extpalette; EnableWindow(GetDlgItem(hwnd, IDC_VIDEO_CUSTOM_BROWSE), res_extpalette); EnableWindow(GetDlgItem(hwnd, IDC_VIDEO_CUSTOM_NAME), res_extpalette); break; case IDC_VIDEO_COLORS_GAM: break; case IDC_VIDEO_CUSTOM_BROWSE: { TCHAR *st_name; if ((st_name = uilib_select_file(hwnd, translate_text(IDS_LOAD_VICE_PALETTE_FILE), UILIB_FILTER_ALL | UILIB_FILTER_PALETTE, UILIB_SELECTOR_TYPE_FILE_LOAD, UILIB_SELECTOR_STYLE_DEFAULT)) != NULL) { char *name; SetDlgItemText(hwnd, IDC_VIDEO_CUSTOM_NAME, st_name); name = system_wcstombs_alloc(st_name); update_palettename(name); system_wcstombs_free(name); res_extpalette = 1; CheckDlgButton(hwnd, IDC_TOGGLE_VIDEO_EXTPALETTE, BST_CHECKED); lib_free(st_name); } } break; case IDC_VIDEO_CUSTOM_NAME: { TCHAR st[100]; char s[100]; GetDlgItemText(hwnd, IDC_VIDEO_CUSTOM_NAME, st, 100); system_wcstombs(s, st, 100); update_palettename(s); res_extpalette = 1; CheckDlgButton(hwnd, IDC_TOGGLE_VIDEO_EXTPALETTE, BST_CHECKED); break;//.........这里部分代码省略.........
开发者ID:martinpiper,项目名称:VICE,代码行数:101,
示例29: dialog_palette_procstatic BOOL CALLBACK dialog_palette_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam){ int type; extern int querynewpalette; switch (msg) { case WM_NOTIFY: if (((NMHDR FAR *)lparam)->code == (UINT)PSN_APPLY) { querynewpalette = 1; if (resources_set_string(current_chip2->res_PaletteFile_name, palette_file2) < 0) { ui_error(translate_text(IDS_COULD_NOT_LOAD_PALETTE)); SetWindowLong (hwnd, DWL_MSGRESULT, TRUE); return TRUE; } lib_free(palette_file2); palette_file2 = NULL; SetWindowLong (hwnd, DWL_MSGRESULT, FALSE); return TRUE; } return FALSE; case WM_INITDIALOG: init_palette_dialog(hwnd, (Chip_Parameters*)((PROPSHEETPAGE*)lparam)->lParam); return TRUE; case WM_COMMAND: type = LOWORD(wparam); switch (type) { case IDC_VIDEO_CUSTOM_BROWSE: { TCHAR *st_name; if ((st_name = uilib_select_file(hwnd, translate_text(IDS_LOAD_VICE_PALETTE_FILE), UILIB_FILTER_ALL | UILIB_FILTER_PALETTE, UILIB_SELECTOR_TYPE_FILE_LOAD, UILIB_SELECTOR_STYLE_DEFAULT)) != NULL) { char *name; SetDlgItemText(hwnd, IDC_VIDEO_CUSTOM_NAME, st_name); name = system_wcstombs_alloc(st_name); update_palettename2(name); system_wcstombs_free(name); lib_free(st_name); } } break; case IDC_VIDEO_CUSTOM_NAME: { TCHAR st[100]; char s[100]; GetDlgItemText(hwnd, IDC_VIDEO_CUSTOM_NAME, st, 100); system_wcstombs(s, st, 100); update_palettename2(s); break; } } return TRUE; } return FALSE;}
开发者ID:martinpiper,项目名称:VICE,代码行数:64,
示例30: tcp_connect/* Establish a connection on the TCP layer */RD_BOOLtcp_connect(rdpTcp * tcp, char * server, int port){ int sock; uint32 option_value; socklen_t option_len;#ifdef IPv6 int n; struct addrinfo hints, *res, *ressave; char tcp_port_rdp_s[10]; printf("connecting to %s:%d/n", server, port); snprintf(tcp_port_rdp_s, 10, "%d", port); memset(&hints, 0, sizeof(struct addrinfo)); hints.ai_family = AF_UNSPEC; hints.ai_socktype = SOCK_STREAM; if ((n = getaddrinfo(server, tcp_port_rdp_s, &hints, &res))) { ui_error(tcp->iso->mcs->sec->rdp->inst, "getaddrinfo: %s/n", gai_strerror(n)); return False; } ressave = res; sock = -1; while (res) { sock = socket(res->ai_family, res->ai_socktype, res->ai_protocol); if (!(sock < 0)) { if (connect(sock, res->ai_addr, res->ai_addrlen) == 0) break; TCP_CLOSE(sock); sock = -1; } res = res->ai_next; } freeaddrinfo(ressave); if (sock == -1) { ui_error(tcp->iso->mcs->sec->rdp->inst, "%s: unable to connect/n", server); return False; }#else /* no IPv6 support */ struct hostent *nslookup; struct sockaddr_in servaddr; printf("connecting to %s:%d/n", server, port); if ((nslookup = gethostbyname(server)) != NULL) { memcpy(&servaddr.sin_addr, nslookup->h_addr, sizeof(servaddr.sin_addr)); } else if ((servaddr.sin_addr.s_addr = inet_addr(server)) == INADDR_NONE) { ui_error(tcp->iso->mcs->sec->rdp->inst, "%s: unable to resolve host/n", server); return False; } if ((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) { ui_error(tcp->iso->mcs->sec->rdp->inst, "socket: %s/n", TCP_STRERROR); return False; } servaddr.sin_family = AF_INET; servaddr.sin_port = htons((uint16) port); if (connect(sock, (struct sockaddr *) &servaddr, sizeof(struct sockaddr)) < 0) { ui_error(tcp->iso->mcs->sec->rdp->inst, "connect: %s/n", TCP_STRERROR); TCP_CLOSE(sock); return False; }#endif /* IPv6 */ tcp->sock = sock; /* set socket as non blocking */#ifdef _WIN32 { u_long arg = 1; ioctlsocket(tcp->sock, FIONBIO, &arg); tcp->wsa_event = WSACreateEvent(); WSAEventSelect(tcp->sock, tcp->wsa_event, FD_READ); }#else option_value = fcntl(tcp->sock, F_GETFL); option_value = option_value | O_NONBLOCK; fcntl(tcp->sock, F_SETFL, option_value);#endif//.........这里部分代码省略.........
开发者ID:nidelius,项目名称:FreeRDP,代码行数:101,
注:本文中的ui_error函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ ui_get_showing_back_button函数代码示例 C++ ui_color函数代码示例 |