Skip to content

Commit

Permalink
thanm: minor cleanup after merge
Browse files Browse the repository at this point in the history
  • Loading branch information
DankRank committed Aug 20, 2023
1 parent ec46954 commit f66bd67
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 13 deletions.
6 changes: 3 additions & 3 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ What's new in thtk master
- New thanm spec format. See <https://github.com/thpatch/thtk/pull/86> for more
details. The old format is not supported anymore. Use thanm.old for it.
- Game version now must be specified, just as with other tools.
- Support for TH18, TH185, TH19 has been added.
- Support for TH18, TH185, TH19 (full) has been added.
- Support th143/bestshot.anm

#### thanm.old
- Will be removed in the next release.
- Support for TH18, TH185, TH19 has been added.
- Support for TH18, TH185, TH19 (trial) has been added.
TH19 creation won't work, though. Use the new thanm instead.
- You can now specify the version for the -l command.
This is required for correct dumping of TH18, TH185.
Expand Down Expand Up @@ -46,7 +46,7 @@ What's new in thtk master
- Add -j option for converting strings between Shift-JIS and UTF-8.

#### thdat
- Automatic version detection now supports th165, th17, th18 and th185.
- Automatic version detection now supports th165, th17, th18, th185, th19.
- Detection works better with renamed files.
- Support for TH18, TH185, TH19 has been added.
- Improve extraction speed.
Expand Down
2 changes: 1 addition & 1 deletion extlib/thtypes
Submodule thtypes updated 1 files
+4 −2 anm_types.h
19 changes: 10 additions & 9 deletions thanm/thanm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1069,8 +1069,8 @@ anm_read_file(
assert(header->rt_textureslot == 0);
assert(header->zero3 == 0);

//if(header->version == 8)
// assert(header->lowresscale == 0 || header->lowresscale == 1);
if(header->version == 8)
assert((header->lowresscale&0xFE) == 0); /* Low byte can only be 0 or 1. High byte is used by TH19 */

/* Lengths, including padding, observed are: 16, 32, 48. */
entry->name = anm_get_name(archive, (const char*)map + header->nameoffset);
Expand Down Expand Up @@ -1175,7 +1175,8 @@ anm_read_file(
(thtx_header_t*)(map + header->thtxoffset);
assert(util_strcmp_ref(thtx->magic, stringref("THTX")) == 0);
assert(thtx->zero == 0);
//assert(thtx->w * thtx->h * format_Bpp(thtx->format) <= thtx->size);
/* NEWHU: 19 */
assert(version == 19 || thtx->w * thtx->h * format_Bpp(thtx->format) <= thtx->size);
assert(
thtx->format == FORMAT_BGRA8888 ||
thtx->format == FORMAT_RGB565 ||
Expand Down Expand Up @@ -1478,7 +1479,7 @@ anm_extract(
/* Then there's nothing to extract. */
return;
}

anm_entry_t* entry;
list_for_each(&anm->entries, entry) {
if (entry->header->hasdata && entry->name == name) {
Expand Down Expand Up @@ -1508,8 +1509,8 @@ anm_extract(
}
}
}
}
}

png_write(name, &image);
free(image.data);
}
Expand Down Expand Up @@ -1815,7 +1816,7 @@ anm_defaults(
free(img_buf);
fprintf(stderr, "%s: not a PNG or JFIF file. Image files must be encoded in PNG or JFIF for Touhou 19\n", entry->name);
exit(1);
}
}

entry->data = img_buf;
continue;
Expand Down Expand Up @@ -2111,7 +2112,7 @@ main(
int command = -1;

FILE* in;

anm_archive_t* anm;
#ifdef HAVE_LIBPNG
anm_entry_t* entry;
Expand Down Expand Up @@ -2336,7 +2337,7 @@ main(
current_input = argv[1];
anm = anm_create(argv[1], symbolfp, version);



if (symbolfp)
fclose(symbolfp);
Expand Down

0 comments on commit f66bd67

Please sign in to comment.