Exemplo n.º 1
0
static void
change_load_filename( HWND hwndDlg, LONG user_data )
{
  struct binary_info *info = ( struct binary_info * ) user_data;
  
  TCHAR *new_filename;
  utils_file new_file;

  TCHAR buffer[80];
  int error;

  new_filename = ui_get_open_filename( "Fuse - Load Binary Data" );
  if( !new_filename ) return;

  error = utils_read_file( new_filename, &new_file );
  if( error ) { free( new_filename ); return; }

  /* Remove the data for the old file */
  error = utils_close_file( &info->file );
  if( error ) { free( new_filename ); return; }

  free( info->filename );

  /* Put the new data in */
  info->filename = new_filename; info->file = new_file;

  /* And update the displayed information */
  SendDlgItemMessage( hwndDlg, IDC_BINARY_STATIC_PATH, WM_SETTEXT,
                      0, ( LPARAM ) new_filename );

  _sntprintf( buffer, 80, "%lu", (unsigned long) info->file.length );
  SendDlgItemMessage( hwndDlg, IDC_BINARY_EDIT_LENGTH, WM_SETTEXT,
                      0, ( LPARAM ) buffer );
}
Exemplo n.º 2
0
void
menu_file_loadbinarydata( int action )
{
  /* FIXME: a way to associate a long type with a window is via SetWindowLong
            with GWL_USERDATA parameter - review past code and implement */
  
  struct binary_info info;

  int error;

  fuse_emulation_pause();

  info.dialog_title = TEXT( "Fuse - Load Binary Data" );
  
  info.filename = ui_get_open_filename( info.dialog_title );
  if( !info.filename ) { fuse_emulation_unpause(); return; }

  error = utils_read_file( info.filename, &info.file );
  if( error ) { free( info.filename ); fuse_emulation_unpause(); return; }

  info.on_change_filename = &change_load_filename;
  info.on_execute = &load_data;

  /* Information display */
  DialogBoxParam( fuse_hInstance, MAKEINTRESOURCE( IDD_BINARY ), fuse_hWnd,
                  binarydata_proc, ( LPARAM ) &info );

  free( info.filename );
  utils_close_file( &info.file );

  fuse_emulation_unpause();
}
Exemplo n.º 3
0
static void
select_new_rom( HWND hedit )
{
  TCHAR *filename;

  filename = ui_get_open_filename( "Fuse - Select ROM" );
  if( !filename ) return;

  SendMessage( hedit, WM_SETTEXT, 0, ( LPARAM ) filename );
}
Exemplo n.º 4
0
/* Request a snapshot file from the user and it */
int
utils_open_snap( void )
{
  char *filename;
  int error;

  filename = ui_get_open_filename( "Fuse - Load Snapshot" );
  if( !filename ) return -1;

  error = snapshot_read( filename );
  libspectrum_free( filename );
  return error;
}
Exemplo n.º 5
0
int
menu_open_snap( void )
{
  char *filename;
  int error;

  filename = ui_get_open_filename( "Fuse - Load Snapshot" );
  if( !filename ) return -1;

  error = snapshot_read( filename );
  free( filename );
  return error;
}