Skip to content

Commit 89bb4f0

Browse files
committed
Support getting updates for Thor's Lha
1 parent d1a9828 commit 89bb4f0

5 files changed

Lines changed: 41 additions & 10 deletions

File tree

src/http.c

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* Avalanche
2-
* (c) 2023-5 Chris Young
2+
* (c) 2023-6 Chris Young
33
*
44
* This program is free software; you can redistribute it and/or modify
55
* it under the terms of the GNU General Public License as published by
@@ -312,6 +312,7 @@ static BOOL http_check_version_internal(void)
312312
ULONG bufsize = 1024;
313313
char *buffer = AllocVec(bufsize + 1, MEMF_CLEAR);
314314
BOOL update_available = FALSE;
315+
BOOL thor_lha = FALSE;
315316

316317
static struct avalanche_version_numbers avn[] = {
317318
{ .name = "Avalanche\0",
@@ -358,7 +359,12 @@ static BOOL http_check_version_internal(void)
358359
.download_url = "https://aminet.net/util/arc/lha_68k.lha\0",
359360
#endif
360361
},
361-
#ifdef __amigaos4__
362+
#ifndef __amigaos4__
363+
{ .name = "Lha (Thor)\0",
364+
.check_url = "https://aminet.net/util/arc/Lha_thor.readme\0",
365+
.download_url = "https://aminet.net/util/arc/Lha_thor.lha\0",
366+
}
367+
#else
362368
{ .name = "zip.library\0",
363369
.check_url = "https://os4depot.net/share/library/misc/zip_lib_lha.readme\0",
364370
.download_url = "https://os4depot.net/share/library/misc/zip_lib.lha\0",
@@ -407,8 +413,21 @@ static BOOL http_check_version_internal(void)
407413
case ACHECKVER_LHA:
408414
avn[ACHECKVER_LHA].current_version = 0;
409415
avn[ACHECKVER_LHA].current_revision = 0;
410-
mod_lha_get_ver(&avn[ACHECKVER_LHA].current_version, &avn[ACHECKVER_LHA].current_revision);
416+
thor_lha = mod_lha_get_ver(&avn[ACHECKVER_LHA].current_version, &avn[ACHECKVER_LHA].current_revision);
417+
break;
418+
419+
#ifndef __amigaos4__
420+
case ACHECKVER_LHA_THOR:
421+
if(thor_lha) {
422+
avn[ACHECKVER_LHA_THOR].current_version = avn[ACHECKVER_LHA].current_version;
423+
avn[ACHECKVER_LHA_THOR].current_revision = avn[ACHECKVER_LHA].current_revision;
424+
425+
avn[ACHECKVER_LHA].check_url = NULL;
426+
avn[ACHECKVER_LHA].current_version = 0;
427+
avn[ACHECKVER_LHA].current_revision = 0;
428+
}
411429
break;
430+
#endif
412431

413432
#ifdef __amigaos4__
414433
case ACHECKVER_ZIP:

src/mod_lha.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* Avalanche
2-
* (c) 2022-5 Chris Young
2+
* (c) 2022-6 Chris Young
33
*
44
* This program is free software; you can redistribute it and/or modify
55
* it under the terms of the GNU General Public License as published by
@@ -159,9 +159,11 @@ BOOL mod_lha_new(void *awin, char *archive)
159159
#define AVALANCHE_LHA_VER_CMD "version c:lha"
160160
#endif
161161

162-
ULONG mod_lha_get_ver(ULONG *ver, ULONG *rev)
162+
BOOL mod_lha_get_ver(ULONG *ver, ULONG *rev)
163163
{
164164
BPTR fh = 0;
165+
BPTR thor = FALSE;
166+
165167
CONFIG_LOCK;
166168
ULONG tmpfile_len = CONFIG_GET(tmpdirlen) + 30;
167169
char *tmpfile = AllocVec(tmpfile_len, MEMF_CLEAR);
@@ -197,6 +199,10 @@ ULONG mod_lha_get_ver(ULONG *ver, ULONG *rev)
197199
if(strncmp(p, "LhA ", 4) == 0) {
198200
p += 4;
199201
break;
202+
} else if(strncmp(p, "Lha ", 4) == 0) {
203+
thor = TRUE;
204+
p += 4;
205+
break;
200206
}
201207
}
202208

@@ -209,7 +215,7 @@ ULONG mod_lha_get_ver(ULONG *ver, ULONG *rev)
209215

210216
FreeVec(tmpfile);
211217

212-
return *ver;
218+
return thor;
213219
}
214220

215221
void mod_lha_register(struct module_functions *funcs)

src/module.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,5 +71,5 @@ void mod_lha_register(struct module_functions *funcs);
7171

7272
/*** Get version info ***/
7373
ULONG mod_zip_get_ver(ULONG *ver, ULONG *rev);
74-
ULONG mod_lha_get_ver(ULONG *ver, ULONG *rev);
74+
BOOL mod_lha_get_ver(ULONG *ver, ULONG *rev); /* Returns FALSE=Original, TRUE=Thor */
7575
#endif

src/update.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* Avalanche
2-
* (c) 2025 Chris Young
2+
* (c) 2025-6 Chris Young
33
*
44
* This program is free software; you can redistribute it and/or modify
55
* it under the terms of the GNU General Public License as published by
@@ -239,6 +239,10 @@ void update_gui(struct avalanche_version_numbers avn[])
239239
NewList(&list);
240240

241241
for(int i = 0; i < ACHECKVER_MAX; i++) {
242+
#ifndef __amigaos4__
243+
/* Skip LhA if not installed (we will show Lha) */
244+
if((i == ACHECKVER_LHA) && ((avn[i].current_version == 0) && (avn[i].current_revision == 0))) continue;
245+
#endif
242246
char installed_version[10];
243247
char latest_version[10];
244248
ULONG update_glyph = avn[i].update_available ? GLYPH_CHECKMARK : AVALANCHE_GLYPH_NONE;

src/update.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* Avalanche
2-
* (c) 2025 Chris Young
2+
* (c) 2025-6 Chris Young
33
*
44
* This program is free software; you can redistribute it and/or modify
55
* it under the terms of the GNU General Public License as published by
@@ -31,7 +31,9 @@ enum {
3131
ACHECKVER_XVS,
3232
ACHECKVER_DEARK,
3333
ACHECKVER_LHA,
34-
#ifdef __amigaos4__
34+
#ifndef __amigaos4__
35+
ACHECKVER_LHA_THOR,
36+
#else
3537
ACHECKVER_ZIP,
3638
#endif
3739
ACHECKVER_MAX

0 commit comments

Comments
 (0)