/* $VER: Update Hack Attack III to load from Retro Gold 1.0 by Gerard Sweeney 17-09-96. Based on AddSearchGuide.rexx 1.1 (9.5.96) by Remco van Hooff (rvhooff@globalxs.nl) */ call ADDLIB('rexxsupport.library',0,-30,0) call ADDLIB('rexxarplib.library',0,-30,0) open_file=0 updatefile='ram:filelist' if OPEN(upfile,updatefile,"r") then do open_file=1 end else DO prompt_str='Sorry.... The update filelist could not be found\It should be a file called FILELIST, and should\have been copied to RAM: by the installation program\Do you want to select another filelist textfile?' prompt_yes="Yes please" prompt_no="No thanks" call prompt_proc prompt_str='Try reinstalling this package again from\ the original archive.\Or try mailing me on\GSS@ARTS.GLA.AC.UK - This may take a few days\' if prompt_temp='' then do call prompt_exit end req_str='Please select an update filelist' call req_proc if req_temp='' then do call prompt_exit end updatefile=req_temp if OPEN(upfile,updatefile,"r") then do open_file=1 end END do while ~eof(upfile) ha3_file = READLN(upfile) cd_file = readln(upfile) say ha3_file call update_guide end call close(upfile) prompt_str='All of the files have been updated. Thanks for waiting!\' call prompt_exit end exit update_guide: inlist.1 = 'ha3:'ha3_file cdname.1 = cd_file inlist.count = 1 cdname.count = 1 output = inlist.1'.tmp' DO i = 1 to inlist.count if ~exists(inlist.i) then do say 'Hack Attack III file 'inlist.i' not found' end IF EXISTS(inlist.i) then do output = inlist.i'.tmp' CALL OPEN(in,inlist.i,'r') line = READLN(in) IF POS('DATABASE', UPPER(line)) = 0 THEN DO SAY 'This isn''t an AmigaGuide document.' CALL CLOSE(in) ITERATE i END CALL OPEN(out,output,'w') DO UNTIL (POS('@NODE', UPPER(line)) ~= 0 & POS('MAIN', UPPER(line)) ~= 0) WRITELN(out, line) line = READLN(in) END WRITELN(out, line) line = READLN(in) IF POS('LOAD FROM RETRO GOLD', line) = 0 THEN DO WRITELN(out, '@{"LOAD FROM RETRO GOLD" system "rx rexx:zxam_run.rexx retro:games/spectrum/'cdname.i'|N"} ... retro:games/spectrum/'cdname.i) WRITELN(out, '@{"RUN GAME " rxs "zxamrun()"}') WRITELN(out, line) DO UNTIL EOF(in) rest = readch(in, 1048576) /* 1MB should be enough :.) */ WRITECH(out, rest) END END ELSE DO SAY 'Skipping, Load from Retro Gold button already added to 'inlist.i CALL CLOSE(out) CALL CLOSE(in) DELETE(inlist.i'.tmp') ITERATE i END CALL CLOSE(out) CALL CLOSE(in) DELETE(inlist.i) RENAME(inlist.i'.tmp',inlist.i) END END return PROMPT_PROC: prompt_temp=request(100,50,prompt_str,,prompt_yes,prompt_no) return PROMPT_EXIT: prompt_yes="Exit" prompt_no="Exit" call prompt_proc exit return REQ_PROC: req_temp=getfile(100,50,"ram:",,,REQ_STR) return update_retro_guide: parse var ha3_file ha3_dir '/' ha3_filename retro_guide_name='retro_'ha3_dir'.guide' retro_temp='retro_index:'retro_guide_name if ~exists(retro_temp) then do say 'Retro Guide file not found' end if open(retro_in,retro_temp,"r") then do retro_output = retro_temp'.tmp' CALL OPEN(retro_out,retro_output,'w') do while ~eof(retro_in) line = READLN(retro_in) parse var line temp_name 'system "rx rexx:zxam_run.rexx retro:games/spectrum/' temp_cd_name '"}' if temp_cd_name=cd_file then do line=temp_name'link HA3:'ha3_file'/MAIN}' end WRITELN(retro_out, line) END CALL CLOSE(retro_out) CALL CLOSE(retro_in) call DELETE(retro_temp) call RENAME(retro_temp'.tmp',retro_temp) END return