Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Varios
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Grupo de Teaming del ClubDelphi

 
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 03-03-2012
Gattaca Gattaca is offline
Miembro
 
Registrado: feb 2009
Posts: 31
Poder: 0
Gattaca Va por buen camino
Angry Increíble error el Delphi va muy rapido!

Hola!

Tengo un increíble problema!!

Veran estoy leyendo un archivo binario a una velocidad creo que muy rapida, causandome el error "EAccessViolation", y la unica forma de solventarlo es agregando un "sleep(1)", haciendo que mi applicación valla más lenta!.

Esté es el loop principal llamado desde un menu para cargar el archivo.
La aplicación no dejo de darme errores, hasta que agregue el sleep antes de llamar a ReadItem()
Código Delphi [-]
      // Objects, walls, grounds, etc...
      for itemId := 100 to ItemCount - 100 do
      begin
        // con esta linea no me da error y carga más de 30000+ objetos del archivo binario
        // sin ella, me dá error!
        sleep(1);
        application.ProcessMessages;
        SetItem(itemId-100, ReadItem(itemId));
        //writeln(flogfile, 'Successfully readed Item #' + inttostr(itemId) + '.');

      end;

MI funcion ReadItem
Código Delphi [-]
function TDatFile.ReadItem(Id: UInt16): TItem;
var value: byte;
    return: TItem;
    spriteId: UInt16;
begin
  try
    while (value <> $FF) do
    begin

      value := ReadData.ReadByte();

      case value of
        $00:
          ReadData.ReadUInt16();
        $17, $20, $FF, $01, $02, $03, $04, $05, $06, $07, $08,
        $0B, $0C, $0D, $0E, $0F, $10, $11, $12,
        $13, $14, $15, $18, $1B, $1F, $1C
        : begin end;
        $09, $0A: begin ReadData.ReadUInt16(); end;
        $1A, $1D: begin ReadData.ReadUInt16(); end;
        $16, $19: begin ReadData.ReadUInt16(); ReadData.ReadUInt16(); end;
        $1E: begin ReadData.ReadUInt16(); end;
        else begin
          writeln(Flogfile, '   ERROR: Invalid Integer: ' + inttostr(value) + ' at item #' + inttostr(Id));
        end;
      end;

    end; // End flags

    return := TItem.Create;

    return.ID := Id;

    return.Width := ReadData.ReadByte();
    return.Height := ReadData.ReadByte();

    if (return.Width > 1) or (return.Height > 1) then
      return.CropImage := ReadData.ReadByte();

    return.Blendframes := ReadData.ReadByte();
    return.xRepeat := ReadData.ReadByte();
    return.yRepeat := ReadData.ReadByte();
    return.zRepeat := ReadData.ReadByte();
    return.Animations := ReadData.ReadByte();

    setLength(return.Sprites, return.SpritesCount);

    try
      for spriteId := 0 to return.SpritesCount - 1 do
      begin
        return.Sprites[spriteId] := ReadData.ReadUInt16();

        //writeln(flogfile, ' Readed Sprite #' + inttostr(return.Sprites[spriteid]));
      end;
    except
       on E : Exception do
      writeln(flogfile, ' CRITICAL ERROR AT OBJECT #' + inttostr(id) + ': '#13 + E.ClassName+' error raised, with message : '+E.Message);
    end;

  finally
    result := return;
  end;
  {except
    on E : Exception do
      writeln(flogfile, ' CRITICAL ERROR: '#13 + E.ClassName+' error raised, with message : '+E.Message);
  end; }
end;

Porfavor ayudenme, no tengo idea de que está mal en mi codigo para que me tire ese error!!

Usando Embarcadero Delphi XE2
Windows 7 x64 Home Premium
Tengo derechos de admin.
Responder Con Cita
 



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Ayudenme Rapido, Rapido omarys Varios 6 04-06-2011 09:45:34
Talento increible..... egostar Humor 4 01-08-2008 07:04:37
Increible truco de magia!! FunBit Humor 5 25-10-2006 20:37:56
Rapido con Delphi, y Lento desde fuera de delphi JoseQ Varios 0 08-09-2005 10:54:48
La increíble tecla F1 en Delphi dec Varios 1 31-08-2005 22:26:45


La franja horaria es GMT +2. Ahora son las 19:57:32.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi