Import Amiga applications and desktop tools
This commit is contained in:
commit
1c144c9a3c
347 files changed
+423483
No files matched your search
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Globalization;
|
||||
using System.Threading;
|
||||
using System.Xml;
|
||||
using System.Xml.Linq;
|
||||
using System.Linq;
|
||||
class NewsFeed {
|
||||
static string Plain(string s) {
|
||||
s=WebUtility.HtmlDecode(s).Replace('\u2019','\'').Replace('\u2018','\'').Replace('\u0092','\'').Replace('\u201c','"').Replace('\u201d','"').Replace('\u2013','-').Replace('\u2014','-');
|
||||
var b=new StringBuilder();foreach(char c in s.Normalize(NormalizationForm.FormD))if(CharUnicodeInfo.GetUnicodeCategory(c)!=UnicodeCategory.NonSpacingMark)b.Append(c>=32&&c<=126?c:' ');
|
||||
return System.Text.RegularExpressions.Regex.Replace(b.ToString(),@"\s+"," ").Trim();
|
||||
}
|
||||
static void Fetch() {
|
||||
var req=(HttpWebRequest)WebRequest.Create("https://feeds.hwupgrade.it/rss_news.xml");req.UserAgent="AmigaNewsTicker/1.0 (personal RSS reader)";req.Timeout=25000;
|
||||
XDocument doc;using(var response=req.GetResponse())using(var stream=response.GetResponseStream())using(var xml=XmlReader.Create(stream,new XmlReaderSettings{DtdProcessing=DtdProcessing.Prohibit,XmlResolver=null}))doc=XDocument.Load(xml);
|
||||
var items=doc.Descendants("item").Take(24).Select(i=>new {Title=Plain((string)i.Element("title")??""),Link=(string)i.Element("link")??""}).Where(i=>i.Title.Length>0).ToArray();
|
||||
if(items.Length==0)throw new Exception("Feed vuoto");
|
||||
var text=new StringBuilder("HARDWARE UPGRADE | "+DateTime.Now.ToString("dd/MM HH:mm")+"\n");foreach(var item in items)text.AppendLine(item.Title);
|
||||
string file="C:/Amiga/HD0/Utilities/NewsTicker/news.txt",tmp=file+".tmp";File.WriteAllText(tmp,text.ToString().Replace("\r\n","\n"),Encoding.ASCII);
|
||||
if(File.Exists(file))File.Replace(tmp,file,null);else File.Move(tmp,file);
|
||||
File.WriteAllLines("C:/Amiga/NewsTicker/links.txt",items.Select(i=>i.Title+"\n"+i.Link).ToArray(),Encoding.UTF8);
|
||||
File.WriteAllText("C:/Amiga/NewsTicker/status.txt","OK "+DateTime.Now.ToString("s"));
|
||||
}
|
||||
static void Main(string[] args) {
|
||||
bool first;using(var mutex=new Mutex(true,"Local\\AmigaNewsTickerFeed",out first)){
|
||||
if(!first)return;ServicePointManager.SecurityProtocol=SecurityProtocolType.Tls12;
|
||||
do{try{Fetch();}catch(Exception e){File.WriteAllText("C:/Amiga/NewsTicker/status.txt",DateTime.Now.ToString("s")+" "+e.Message);}if(args.Contains("--once"))break;Thread.Sleep(300000);}while(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
# NewsTicker
|
||||
|
||||
Sorgenti raccolti da work/ticker. Binario installato conservato in dist/News; risorse in assets.
|
||||
|
||||
Build: ./build.ps1 -Toolchain <VBCC/VASM/VLINK + NDK m68k-amigaos>.
|
||||
|
||||
Gli script originali sono conservati senza modificarne i percorsi: alcuni generatori leggono C:/Amiga o font Windows. Il binario presente in dist e quello effettivamente installato; il sorgente raccolto e la versione locale piu recente.
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,26 @@
|
||||
param([string]$Toolchain = $env:AMIGA_TOOLCHAIN)
|
||||
$ErrorActionPreference = 'Stop'
|
||||
if (!$Toolchain) { throw 'Specificare -Toolchain con la cartella che contiene bin e targets/m68k-amigaos.' }
|
||||
$Toolchain = (Resolve-Path -LiteralPath $Toolchain).Path
|
||||
$targetPath = Join-Path $Toolchain 'targets/m68k-amigaos'
|
||||
$buildPath = Join-Path $PSScriptRoot 'build'
|
||||
$configPath = Join-Path $buildPath 'vbcc'
|
||||
New-Item -ItemType Directory -Path (Join-Path $configPath 'config') -Force | Out-Null
|
||||
$config = [IO.File]::ReadAllText((Join-Path $PSScriptRoot 'vbcc-config.in')).Replace('@TARGET@', $targetPath.Replace('\','/'))
|
||||
[IO.File]::WriteAllText((Join-Path $configPath 'config/boing'), $config)
|
||||
$previousVBCC = $env:VBCC
|
||||
$previousPath = $env:PATH
|
||||
try {
|
||||
$env:VBCC = $configPath
|
||||
$env:PATH = (Join-Path $Toolchain 'bin') + ';' + $env:PATH
|
||||
Push-Location -LiteralPath $PSScriptRoot
|
||||
try {
|
||||
& (Join-Path $Toolchain 'bin/vc.exe') +boing -O2 -c99 -o build/News ticker.c
|
||||
if ($LASTEXITCODE -ne 0) { throw 'Compilazione fallita.' }
|
||||
Copy-Item -LiteralPath assets/font.bin,assets/News.info -Destination $buildPath -Force
|
||||
} finally { Pop-Location }
|
||||
} finally {
|
||||
$env:VBCC = $previousVBCC
|
||||
$env:PATH = $previousPath
|
||||
}
|
||||
Write-Output ('Pronto per Amiga: ' + $buildPath)
|
||||
Vendored
BIN
Binary file not shown.
@@ -0,0 +1,22 @@
|
||||
from pathlib import Path
|
||||
from PIL import Image,ImageDraw,ImageFont
|
||||
import struct
|
||||
p=Path('C:/Amiga/HD0/Utilities/NewsTicker')
|
||||
h=bytearray(Path('C:/Amiga/HD0/System/Shell.info').read_bytes()[:78])
|
||||
def u16(n):return struct.pack('>H',n)
|
||||
def u32(n):return struct.pack('>I',n&0xffffffff)
|
||||
h[12:16]=u16(48)+u16(40);h[16:18]=u16(6);h[48]=3
|
||||
for off in (22,26):h[off:off+4]=u32(1)
|
||||
for off in (44,50,54,66,70):h[off:off+4]=u32(0)
|
||||
h[58:66]=u32(-1)+u32(-1);h[74:78]=u32(65536)
|
||||
data=bytearray(h)
|
||||
for selected in (False,True):
|
||||
im=Image.new('P',(48,40),0);d=ImageDraw.Draw(im)
|
||||
d.rounded_rectangle((2,1,45,35),radius=3,fill=2,outline=1 if selected else 3,width=2)
|
||||
for yy in (10,16,22,28):d.line((8,yy,39 if yy<28 else 28,yy),fill=1 if yy==10 else 3,width=2)
|
||||
d.line((6,32,41,32),fill=1);d.rectangle((18,36,30,38),fill=3)
|
||||
data+=u16(0)+u16(0)+u16(48)+u16(40)+u16(2)+u32(1)+bytes([3,0])+u32(0)
|
||||
for plane in range(2):
|
||||
for y in range(40):
|
||||
for x in range(0,48,8):data.append(sum((128>>i) if im.getpixel((x+i,y))&(1<<plane) else 0 for i in range(8)))
|
||||
(p/'News.info').write_bytes(data)
|
||||
@@ -0,0 +1,53 @@
|
||||
#include <exec/types.h>
|
||||
#include <intuition/intuition.h>
|
||||
#include <graphics/gfxbase.h>
|
||||
#include <devices/timer.h>
|
||||
#include <proto/exec.h>
|
||||
#include <proto/dos.h>
|
||||
#include <proto/intuition.h>
|
||||
#include <proto/graphics.h>
|
||||
#include <proto/timer.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#define W 1000
|
||||
#define H 142
|
||||
struct IntuitionBase*IntuitionBase;struct GfxBase*GfxBase;struct Library*TimerBase;
|
||||
static UBYTE *frame,*scaled,*font;static LONG pens[8];
|
||||
static UBYTE colors[8][3]={{17,18,14},{242,222,184},{255,177,54},{97,71,33},{35,32,23},{151,114,54},{116,211,138},{255,218,137}};
|
||||
static char titles[24][256],metadata[96];static int count=0;
|
||||
static void pixel(int x,int y,int c){if(x>=0&&x<W&&y>=0&&y<H)frame[y*W+x]=(UBYTE)pens[c];}
|
||||
static void rect(int x,int y,int w,int h,int c){int a,b;for(b=0;b<h;b++)for(a=0;a<w;a++)pixel(x+a,y+b,c);}
|
||||
static void text(int x,int y,char*s,int color,int scale,int lo,int hi){int a,b,k,ch;for(k=0;s[k];k++){ch=(unsigned char)s[k]-32;if(ch<0||ch>=96)continue;for(b=0;b<12;b++)for(a=0;a<8;a++)if(font[b*768+ch*8+a]){int xx=x+(k*8+a)*scale;if(xx>=lo&&xx+scale<=hi)rect(xx,y+b*scale,scale,scale,color);}}}
|
||||
static void trim(char*s){int n=strlen(s);while(n&&(s[n-1]=='\n'||s[n-1]=='\r'))s[--n]=0;}
|
||||
static int reload(void){FILE*f=fopen("PROGDIR:news.txt","r");int n=0;if(!f)return 0;if(!fgets(metadata,sizeof(metadata),f)){fclose(f);return 0;}trim(metadata);while(n<24&&fgets(titles[n],256,f)){trim(titles[n]);if(titles[n][0])n++;}fclose(f);count=n;return n>0;}
|
||||
int main(void){struct Screen*sc=0;struct Window*w=0;struct IntuiMessage*m;struct MsgPort*tp=0,*single=0;struct timerequest*tr=0;struct EClockVal ec;ULONG freq=0,last=0,delta,cls;UWORD code;int timeron=0,got=0,done=0,i,x,y,iw,ih,rw,rh,ox,oy,index=0,paused=0,speed=72,frames=0;LONG pos=(W-32)*16;char current[256],buf[96];FILE*f;
|
||||
IntuitionBase=(struct IntuitionBase*)OpenLibrary("intuition.library",39);GfxBase=(struct GfxBase*)OpenLibrary("graphics.library",40);if(!IntuitionBase||!GfxBase)goto end;
|
||||
single=CreateMsgPort();if(!single)goto end;single->mp_Node.ln_Name="AMIGA.NEWSWIRE";Forbid();if(FindPort("AMIGA.NEWSWIRE")){Permit();DeleteMsgPort(single);single=0;goto end;}AddPort(single);Permit();
|
||||
sc=LockPubScreen(0);if(!sc)goto end;frame=malloc(W*H);font=malloc(768*12);scaled=malloc((ULONG)sc->Width*sc->Height);if(!frame||!font||!scaled)goto end;
|
||||
f=fopen("PROGDIR:font.bin","rb");if(!f)goto end;i=fread(font,1,768*12,f);fclose(f);if(i!=768*12)goto end;
|
||||
for(i=0;i<8;i++){pens[i]=ObtainBestPen(sc->ViewPort.ColorMap,colors[i][0]*0x01010101UL,colors[i][1]*0x01010101UL,colors[i][2]*0x01010101UL,TAG_DONE);if(pens[i]<0)goto end;got++;}
|
||||
tp=CreateMsgPort();if(!tp)goto end;tr=(struct timerequest*)CreateIORequest(tp,sizeof(struct timerequest));if(!tr)goto end;if(OpenDevice(TIMERNAME,UNIT_MICROHZ,(struct IORequest*)tr,0))goto end;timeron=1;TimerBase=(struct Library*)tr->tr_node.io_Device;freq=ReadEClock(&ec);last=ec.ev_lo;
|
||||
if(!reload()){strcpy(titles[0],"In attesa delle notizie... controlla la connessione internet del PC.");count=1;strcpy(metadata,"HARDWARE UPGRADE | CACHE NON DISPONIBILE");}strcpy(current,titles[0]);
|
||||
w=OpenWindowTags(0,WA_PubScreen,(ULONG)sc,WA_Left,100,WA_Top,790,WA_InnerWidth,W,WA_InnerHeight,H,WA_Title,(ULONG)"Tech News | Hardware Upgrade",WA_CloseGadget,TRUE,WA_DragBar,TRUE,WA_DepthGadget,TRUE,WA_SizeGadget,TRUE,WA_SizeBBottom,TRUE,WA_MinWidth,500,WA_MinHeight,110,WA_MaxWidth,sc->Width,WA_MaxHeight,300,WA_SimpleRefresh,TRUE,WA_IDCMP,IDCMP_CLOSEWINDOW|IDCMP_RAWKEY|IDCMP_REFRESHWINDOW,TAG_DONE);if(!w)goto end;
|
||||
while(!done){while((m=(struct IntuiMessage*)GetMsg(w->UserPort))!=0){cls=m->Class;code=m->Code;ReplyMsg((struct Message*)m);if(cls==IDCMP_CLOSEWINDOW||(cls==IDCMP_RAWKEY&&code==0x45))done=1;if(cls==IDCMP_RAWKEY&&code==0x40)paused=!paused;if(cls==IDCMP_RAWKEY&&code==0x36){index=(index+1)%count;strcpy(current,titles[index]);pos=(W-32)*16;}if(cls==IDCMP_RAWKEY&&code==0x4e&&speed<150)speed+=12;if(cls==IDCMP_RAWKEY&&code==0x4f&&speed>24)speed-=12;if(cls==IDCMP_RAWKEY&&code==0x13){reload();if(index>=count)index=0;}if(cls==IDCMP_REFRESHWINDOW){BeginRefresh(w);EndRefresh(w,TRUE);}}
|
||||
ReadEClock(&ec);delta=ec.ev_lo-last;last=ec.ev_lo;if(delta>freq/4)delta=freq/4;
|
||||
if(!paused)pos-=(delta*speed*16)/freq;
|
||||
if(pos/16+(LONG)strlen(current)*16<120){index=(index+1)%count;strcpy(current,titles[index]);pos=(W-32)*16;}
|
||||
if(++frames%600==0){reload();if(index>=count)index=0;}
|
||||
memset(frame,(UBYTE)pens[0],W*H);
|
||||
rect(10,5,W-20,1,3);rect(10,32,W-20,1,3);rect(10,105,W-20,1,3);
|
||||
text(20,10,"TECH / NEWSWIRE",1,1,0,W);text(240,10,metadata,5,1,0,W);rect(928,12,5,5,paused?3:6);text(940,8,paused?"HOLD":"LIVE",paused?5:6,1,0,W);
|
||||
for(y=43;y<97;y+=3)rect(16,y,W-32,1,4);
|
||||
sprintf(buf,"%02d/%02d",index+1,count);text(22,59,buf,5,1,0,W);
|
||||
/* Headline enters from the right, one illuminated character at a time. */
|
||||
text(pos/16+1,58,current,3,2,120,W-20);text(pos/16,57,current,2,2,120,W-20);
|
||||
x=pos/16+strlen(current)*16;if(x>=120&&x<W-26&&frames%24<17)rect(x,59,10,19,7);
|
||||
rect(118,43,1,52,3);
|
||||
text(20,119,"SPAZIO PAUSA N SUCCESSIVA R RICARICA",5,1,0,W);sprintf(buf,"%d PX/S | RSS / 5 MIN",speed);text(744,119,buf,5,1,0,W);
|
||||
iw=w->Width-w->BorderLeft-w->BorderRight;ih=w->Height-w->BorderTop-w->BorderBottom;if(iw>0&&ih>0&&iw<=sc->Width&&ih<=sc->Height){if(iw==W&&ih==H)WriteChunkyPixels(w->RPort,w->BorderLeft,w->BorderTop,w->BorderLeft+W-1,w->BorderTop+H-1,frame,W);else{rw=iw;rh=iw*H/W;if(rh>ih){rh=ih;rw=ih*W/H;}ox=(iw-rw)/2;oy=(ih-rh)/2;memset(scaled,(UBYTE)pens[0],(ULONG)iw*ih);for(y=0;y<rh;y++){int sy=(ULONG)y*H/rh;for(x=0;x<rw;x++)scaled[(ULONG)(oy+y)*iw+ox+x]=frame[sy*W+(ULONG)x*W/rw];}WriteChunkyPixels(w->RPort,w->BorderLeft,w->BorderTop,w->BorderLeft+iw-1,w->BorderTop+ih-1,scaled,iw);}}
|
||||
Delay(2);
|
||||
}
|
||||
end:
|
||||
if(w)CloseWindow(w);if(timeron)CloseDevice((struct IORequest*)tr);if(tr)DeleteIORequest((struct IORequest*)tr);if(tp)DeleteMsgPort(tp);if(single){RemPort(single);DeleteMsgPort(single);}if(sc){for(i=0;i<got;i++)ReleasePen(sc->ViewPort.ColorMap,pens[i]);UnlockPubScreen(0,sc);}free(frame);free(font);free(scaled);if(GfxBase)CloseLibrary((struct Library*)GfxBase);if(IntuitionBase)CloseLibrary((struct Library*)IntuitionBase);return 0;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
-cc=vbccm68k -quiet -hunkdebug %s -o= %s %s -O=%ld -I"@TARGET@/include" -I"@TARGET@/ndk/include_h" -I"@TARGET@/netinclude"
|
||||
-ccv=vbccm68k -hunkdebug %s -o= %s %s -O=%ld -I"@TARGET@/include" -I"@TARGET@/ndk/include_h" -I"@TARGET@/netinclude"
|
||||
-as=vasmm68k_mot -quiet -Fhunk -phxass -opt-fconst -nowarn=62 %s -o %s
|
||||
-asv=vasmm68k_mot -Fhunk -phxass -opt-fconst -nowarn=62 %s -o %s
|
||||
-ld=vlink -bamigahunk -x -Bstatic -Cvbcc -nostdlib "@TARGET@/lib/startup.o" %s %s -L"@TARGET@/lib" -lvc -o %s
|
||||
-l2=vlink -bamigahunk -x -Bstatic -Cvbcc -nostdlib %s %s -L"@TARGET@/lib" -o %s
|
||||
-ldv=vlink -bamigahunk -t -x -Bstatic -Cvbcc -nostdlib "@TARGET@/lib/startup.o" %s %s -L"@TARGET@/lib" -lvc -o %s
|
||||
-l2v=vlink -bamigahunk -t -x -Bstatic -Cvbcc -nostdlib %s %s -L"@TARGET@/lib" -o %s
|
||||
-ldnodb=-s -Rshort
|
||||
-ul=-l%s
|
||||
-cf=-F%s
|
||||
-ml=500
|
||||
Reference in new issue
Block a user