⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 logo.pas

📁 这是一个DVD的开机画面修改的程序!!在DOS下运行
💻 PAS
字号:
program Catch_logo(input,output);

uses
  dos;

label
  Head,Tail;

const
  TWinbond  = 1;
  TAmlogic  = 2;    { Ess has the same type of Amlogic }
  TSunplus  = 3;

  ExtBIN = '.BIN';
  ExtMPG = '.MPG';
  ExtC   = '.C';
  ExtROM = '.ROM';

  ExtraFile:string = 'EXTRA000';

  Head_SunPlus:array[1..4] of byte = ($00,$00,$01,$b6);

  Head1:string[4] = chr($00)+chr($00)+chr($01)+chr($b3);
  Head2:string[4] = chr($00)+chr($00)+chr($b3)+chr($01);
  Tail1:string[4] = chr($00)+chr($00)+chr($01)+chr($b7);
  Tail2:string[4] = chr($00)+chr($00)+chr($b7)+chr($01);
  Tail3:string[4] = chr($01)+chr($00)+chr($00)+chr($b7);

  readfilecount:word=0;

var
  SourceName,TargetName:string;
  SourceFile,TargetFile,TempFile:file;
  Buffer:array [1..255] of byte;
  MpegFileType:byte;

  HeaderFound:boolean;

  Position:word;
  blocklength:word;

  i,j:integer;
  w,k:word;

  TargetBuffer:array[0..4095] of byte;

  TempBuffer:array[1..37] of byte;
  TB:array[1..4] of byte;

  dir:dirstr;
  name:namestr;
  ext:extstr;

procedure readfile;
var
  li:integer;
begin
  if readfilecount=0 then
    begin
      for li:=1 to 37 do TempBuffer[li]:=0;
      for li:=1 to 255 do Buffer[li]:=0;
      blockread(SourceFile,Buffer,255,blocklength);
      HeaderFound:=false;
    end
  else
    begin
      for li:=1 to 37 do TempBuffer[li]:=Buffer[215+li];
      Buffer[1]:=Buffer[253];
      Buffer[2]:=Buffer[254];
      Buffer[3]:=Buffer[255];
      for li:=4 to 255 do Buffer[li]:=0;
      blockread(SourceFile,Buffer[4],252,blocklength);
    end;
  readfilecount:=readfilecount+1;
end;

function scanbuffer:byte;
var
  ls:string[255];
  li:integer;
begin
  scanbuffer:=0;
  Position:=0;
  for li:=1 to 255 do ls[li]:=chr(Buffer[li]);
  ls[0]:=chr(255);
  if pos(Head1,ls)<>0 then
    begin
      Position:=pos(Head1,ls);
      HeaderFound:=true;
      if Position<6 then
        begin
          if Position<3 then
            begin
              for li:=32+Position to 35+Position do
                TB[li-Position-31]:=TempBuffer[li];
            end
          else
            begin
              for li:=32+Position to 37 do
                TB[li-Position-31]:=TempBuffer[li];
              for li:=1 to Position-2 do TB[li+6-Position]:=Buffer[li];
            end
        end
      else
        for li:=Position-5 to Position-2 do TB[li-Position+6]:=Buffer[li];
      if ((TB[1]=$00) and (TB[2]=$00) and (TB[3]=$01) and (TB[4]=$b6)) then
        MpegFileType:=TSunplus
      else
        MpegFileType:=TAmlogic;
      scanbuffer:=1;
    end;
  if ((pos(Head2,ls)<>0) and ((pos(Head2,ls)<Position) or (Position=0))) then
    begin
      Position:=pos(Head2,ls);
      HeaderFound:=true;
      MpegFileType:=TWinbond;
      scanbuffer:=2;
    end;
  if ((pos(Tail1,ls)<>0) and ((pos(Tail1,ls)<Position) or (Position=0))) then
    begin
      Position:=pos(Tail1,ls);
      scanbuffer:=3;
    end;
  if ((pos(Tail2,ls)<>0) and ((pos(Tail2,ls)<Position) or (Position=0))) then
    begin
      Position:=pos(Tail2,ls);
      scanbuffer:=4;
    end;
  if ((pos(Tail3,ls)<>0) and ((pos(Tail3,ls)<Position) or (Position=0))) then
    begin
      Position:=pos(Tail3,ls);
      scanbuffer:=5;
    end;
end;

procedure TransMpegFile;
var
  li:integer;
  lw,lw1:word;
  lb:byte;
begin
  assign(TargetFile,TargetName);
  reset(TargetFile,1);
  assign(TempFile,dir+'MPEGTEMP.%%%');
  rewrite(TempFile,1);
  repeat
    blockread(TargetFile,TargetBuffer,4096,lw);
    for li:=0 to  2047 do
      begin
        lb:=TargetBuffer[li*2];
        TargetBuffer[li*2]:=TargetBuffer[li*2+1];
        TargetBuffer[li*2+1]:=lb;
      end;
    if eof(TargetFile) then
      begin
        if TargetBuffer[lw-1]=0 then lw:=lw-1;
      end;
    blockwrite(TempFile,TargetBuffer,lw,lw1);
  until eof(TargetFile);
  close(TargetFile);
  erase(TargetFile);
  close(TempFile);
  rename(TempFile,TargetName);
end;

procedure Chans_ROM_to_C;
var
  lbuffer:array[1..16] of byte;
  f1:file;
  f2:text;
  i,j,k:integer;
  s:string;
  lw:word;

function chans(b:byte):string;
var
  lb:byte;
  ls:string[4];
begin
  ls[0]:=chr(4);
  ls[1]:='0';
  ls[2]:='x';
  lb:=(b shr 4) + $30;
  if lb>$39 then lb:=lb+$27;
  ls[3]:=chr(lb);
  lb:=(b and $0f) + $30;
  if lb>$39 then lb:=lb+$27;
  ls[4]:=chr(lb);
  chans:=ls;
end;

begin
  assign(f1,SourceName);
  reset(f1,1);
  assign(f2,TargetName);
  rewrite(f2);
  writeln(f2,'const unsigned char RomSlideVideo [] = {');
  repeat
    s:='';
    blockread(f1,lbuffer,16,lw);
    if lw=16 then
      begin
        if eof(f1) then
          begin
            for i:=1 to 15 do s:=s+chans(lbuffer[i])+',';
            s:=s+chans(lbuffer[16]);
          end
        else
          for i:=1 to 16 do s:=s+chans(lbuffer[i])+',';
        writeln(f2,s);
      end
    else if lw=1 then
      writeln(f2,chans(lbuffer[1])+' };')
    else if lw=0 then
      writeln(f2,'};')
    else
      begin
        for i:=1 to lw-1 do s:=s+chans(lbuffer[i])+',';
        s:=s+chans(lbuffer[lw])+' };';
        writeln(f2,s);
      end;
  until lw<16;
  close(f1);
  close(f2);
  halt(0);
end;

begin
  write(output,'LOGO Tool  Version 1.1 Copyright(C) ');
  writeln(output,'1999-2000 by Sunny tech H.K. Ltd');
  writeln;
  if paramcount=0 then
    begin
      write('Please enter file name:');
      readln(SourceName)
    end
  else SourceName:=paramstr(1);
  fsplit(SourceName,dir,name,ext);
  filemode:=0;
  TargetName:=dir+name+ExtMPG;
  assign(SourceFile,SourceName);
  reset(SourceFile,1);
  if ((IOresult<>0) or (SourceName='')) then
    begin
      writeln('File '+SourceName+' not found.');
      halt(1);
    end;
  writeln(output,'Serching source file...');
  repeat
    readfile;
    case scanbuffer of
      0:
         begin
           if HeaderFound then
             blockwrite(TargetFile,Buffer,252,blocklength);
         end;
      1,2:
Head:    if MpegFileType=TSunplus then
           begin
             TargetName:=dir+name+ExtROM;
             assign(TargetFile,TargetName);
             rewrite(TargetFile,1);
             writeln(output,'ROM file found: ',TargetName);
             if Position=33 then k:=TempBuffer[37]+Buffer[1]*256
             else if Position<33 then
                    k:=TempBuffer[Position+4]+TempBuffer[Position+5]*256
             else k:=Buffer[Position-33]+Buffer[Position-32]*256;
             k:=k+8;
             if Position<38 then
               begin
                 blockwrite(TargetFile,TempBuffer[Position],38-Position,w);
                 k:=k-38+Position;
               end;
             blockwrite(TargetFile,Buffer[Position-37],290-Position,w);
             k:=k-290+Position;
             while k>252 do
               begin
                 readfile;
                 blockwrite(TargetFile,Buffer,252,w);
                 k:=k-252;
               end;
             readfile;
             blockwrite(TargetFile,Buffer,k,w);
             close(SourceFile);
             close(TargetFile);
             SourceName:=TargetName;
             TargetName:=dir+name+ExtC;
             writeln(output,'Outputting '+TargetName);
             Chans_ROM_to_C;
           end
         else
           begin
             assign(TargetFile,TargetName);
             rewrite(TargetFile,1);
             blockwrite(TargetFile,Buffer[Position],253-Position,blocklength);
             for i:=0 to 3 do Buffer[Position+i]:=0;
             if scanbuffer in [3..5] then goto Tail;
           end;
      3,4,5:
Tail:    begin
           if HeaderFound then
             begin
               blockwrite(TargetFile,Buffer,Position+3,blocklength);
               close(TargetFile);
               writeln(output,'Mpeg file found: ',TargetName);
               if MpegFileType=TWinbond then TransMpegFile;
               inc(ExtraFile[8]);
               TargetName:=dir+ExtraFile+ExtMPG;
             end;
             HeaderFound:=false;
             for i:=0 to 3 do Buffer[Position+i]:=0;
             if scanbuffer in [1,2] then goto Head;
         end;
    end;
  until eof(SourceFile);
  close(SourceFile);
  if HeaderFound then
    begin
      close(TargetFile);
      erase(TargetFile);
    end;

end.





⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -