Fixes from prpr
This commit is contained in:
parent
f6a5c33742
commit
49a7c616ba
2
Makefile
2
Makefile
|
@ -23,7 +23,7 @@ OBJS= $(SRCS:.c=.o)
|
|||
#CC=mipsel-linux-gcc
|
||||
PLATFORM=$(shell uname -s | cut -d- -f1)
|
||||
PROCESSOR=$(shell uname -p)
|
||||
CFLAGS=-g
|
||||
CFLAGS=-g -std=c99
|
||||
INCS=
|
||||
LIBS=
|
||||
ifeq ($(PLATFORM),CYGWIN_NT)
|
||||
|
|
22
cmd.c
22
cmd.c
|
@ -120,7 +120,7 @@ cmd_setgenre(struct hmt *hmt, char *g)
|
|||
|
||||
printf("Current genre: %s\n", genredescr(hmt->bin[HMT_GENRE]));
|
||||
if (*g == '-')
|
||||
hmt->bin[HMT_GENRE] = atoi(g + 1);
|
||||
hmt->bin[HMT_GENRE] = (uint8_t)atoi(g + 1);
|
||||
else
|
||||
hmt->bin[HMT_GENRE] = genrecode(g);
|
||||
printf("Set genre to: %s\n", genredescr(hmt->bin[HMT_GENRE]));
|
||||
|
@ -130,7 +130,7 @@ cmd_setgenre(struct hmt *hmt, char *g)
|
|||
void
|
||||
cmd_setresume(struct hmt *hmt, char *resume)
|
||||
{
|
||||
int32_t r = strtoll(resume, (char **)NULL, 10);
|
||||
int32_t r = strtol(resume, (char **)NULL, 10);
|
||||
|
||||
CHECK_OFFSET(HMT_PLAYED_TIME)
|
||||
|
||||
|
@ -138,11 +138,11 @@ cmd_setresume(struct hmt *hmt, char *resume)
|
|||
{
|
||||
uint32_t d;
|
||||
d = hmt->end - hmt->start;
|
||||
printf("Recording Duration:%lu\n", d);
|
||||
printf("Recording Duration:%u\n", d);
|
||||
r += d;
|
||||
}
|
||||
|
||||
printf("Setting resume point to: %lu second(s) in.\n", r);
|
||||
printf("Setting resume point to: %u second(s) in.\n", r);
|
||||
write_uint32(hmt->bin + HMT_PLAYED_TIME, r);
|
||||
hmt->modified++;
|
||||
}
|
||||
|
@ -213,9 +213,9 @@ cmd_setseries(struct hmt *hmt, char *g)
|
|||
|
||||
if (sscanf(g, "%u,%u,%u", &series, &episode, &episodes) >= 2)
|
||||
{
|
||||
hmt->bin[HMT_SERIES] = series;
|
||||
hmt->bin[HMT_EPISODE] = episode;
|
||||
hmt->bin[HMT_EPISODETOT] = episodes;
|
||||
hmt->bin[HMT_SERIES] = (uint8_t)series;
|
||||
hmt->bin[HMT_EPISODE] = (uint8_t)episode;
|
||||
hmt->bin[HMT_EPISODETOT] = (uint8_t)episodes;
|
||||
hmt->modified++;
|
||||
}
|
||||
else
|
||||
|
@ -289,7 +289,7 @@ patch_string(struct hmt *hmt, uint32_t offset, uint32_t len, char *str)
|
|||
}
|
||||
|
||||
void
|
||||
patch_uint16(struct hmt *hmt, uint32_t offset, uint32_t val)
|
||||
patch_uint16(struct hmt *hmt, uint32_t offset, uint16_t val)
|
||||
{
|
||||
CHECK_OFFSET(offset)
|
||||
|
||||
|
@ -323,7 +323,7 @@ cmd_patch(struct hmt *hmt, char *str)
|
|||
offset = strtoul(offsets, (char **)NULL, 0);
|
||||
val = strtoul(vals, (char **)NULL, 0);
|
||||
|
||||
printf("Patching width %d - %#x(%lu) = %#x(%lu)\n", width,
|
||||
printf("Patching width %d - %#x(%u) = %#x(%u)\n", width,
|
||||
offset, offset, val, val);
|
||||
|
||||
switch(width)
|
||||
|
@ -365,7 +365,7 @@ cmd_unpatch(struct hmt *hmt, char *str)
|
|||
}
|
||||
|
||||
if (debug)
|
||||
printf("Reading width %d - %#x(%lu)\n", width,
|
||||
printf("Reading width %d - %#x(%u)\n", width,
|
||||
offset, offset);
|
||||
|
||||
switch(width)
|
||||
|
@ -385,7 +385,7 @@ cmd_unpatch(struct hmt *hmt, char *str)
|
|||
case 32:
|
||||
{
|
||||
uint32_t val = read_uint32(hmt->bin + offset, 1);
|
||||
printf("%ld %#x\n", val, val);
|
||||
printf("%d %#x\n", val, val);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
|
50
display.c
50
display.c
|
@ -1,18 +1,23 @@
|
|||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include "lint.h"
|
||||
|
||||
char *
|
||||
ctimenl(uint32_t *tm)
|
||||
ctimenl(time_t tm)
|
||||
{
|
||||
static char buf[25];
|
||||
static char buf[32];
|
||||
char *p;
|
||||
|
||||
strcpy(buf, ctime((time_t *)tm));
|
||||
|
||||
p = ctime(&tm);
|
||||
memset(buf, '\0', sizeof(buf));
|
||||
if (p)
|
||||
{
|
||||
strncpy(buf, p, sizeof(buf) - 1);
|
||||
if ((p = strpbrk(buf, "\r\n")))
|
||||
*p = '\0';
|
||||
}
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
@ -39,9 +44,9 @@ display_hmt(struct hmt *hmt)
|
|||
printf("%s\t", hmt->mediatitle);
|
||||
printf("%s\t", hmt->synopsis);
|
||||
printf("%s\t", hmt->definition == DEF_HD ? "HD" : "SD");
|
||||
printf("%lu\t%s\t", hmt->lcn, hmt->channel);
|
||||
printf("%lu\t", hmt->start);
|
||||
printf("%lu\t", hmt->end);
|
||||
printf("%u\t%s\t", hmt->lcn, hmt->channel);
|
||||
printf("%u\t", hmt->start);
|
||||
printf("%u\t", hmt->end);
|
||||
printf("%s\t", hmt_flags(hmt));
|
||||
if (g)
|
||||
printf("%s\t", hmt->guidance);
|
||||
|
@ -49,10 +54,10 @@ display_hmt(struct hmt *hmt)
|
|||
printf("\t");
|
||||
|
||||
printf("%d\t", hmt->num_bookmarks);
|
||||
printf("%lu\t", hmt->schedstart);
|
||||
printf("%lu\t", hmt->scheddur);
|
||||
printf("%u\t", hmt->schedstart);
|
||||
printf("%u\t", hmt->scheddur);
|
||||
printf("%d\t", hmt->genre);
|
||||
printf("%lu\t", hmt->resume);
|
||||
printf("%u\t", hmt->resume);
|
||||
printf("%s/%s\t", recordingstatus(hmt), failurereason(hmt));
|
||||
printf("%u\t%u\t%u\t", hmt->series, hmt->episode,
|
||||
hmt->episodetot);
|
||||
|
@ -65,7 +70,7 @@ display_hmt(struct hmt *hmt)
|
|||
printf("Format:%s\n", hmt->definition == DEF_HD ? "HD" : "SD");
|
||||
printf("Title:%s\n", hmt->mediatitle);
|
||||
printf("ITitle:%s\n", hmt->title);
|
||||
printf("Channel:%lu (%s)\n", hmt->lcn, hmt->channel);
|
||||
printf("Channel:%u (%s)\n", hmt->lcn, hmt->channel);
|
||||
printf("Episode:%u,%u/%u\n",
|
||||
hmt->series, hmt->episode, hmt->episodetot);
|
||||
|
||||
|
@ -92,16 +97,16 @@ display_hmt(struct hmt *hmt)
|
|||
|
||||
printf("\n");
|
||||
|
||||
printf("Scheduled start:%lu (%s)\n", hmt->schedstart,
|
||||
ctimenl(&hmt->schedstart));
|
||||
printf("Scheduled duration:%lu\n", hmt->scheddur);
|
||||
printf("Recording start:%lu (%s)\n", hmt->start,
|
||||
ctimenl(&hmt->start));
|
||||
printf("Recording end:%lu (%s)\n", hmt->end, ctimenl(&hmt->end));
|
||||
printf("Duration:%lu\n", hmt->end - hmt->start);
|
||||
printf("Stored duration:%lu\n", hmt->duration);
|
||||
printf("Scheduled start:%u (%s)\n", hmt->schedstart,
|
||||
ctimenl(hmt->schedstart));
|
||||
printf("Scheduled duration:%u\n", hmt->scheddur);
|
||||
printf("Recording start:%u (%s)\n", hmt->start,
|
||||
ctimenl(hmt->start));
|
||||
printf("Recording end:%u (%s)\n", hmt->end, ctimenl(hmt->end));
|
||||
printf("Duration:%u\n", hmt->end - hmt->start);
|
||||
printf("Stored duration:%u\n", hmt->duration);
|
||||
|
||||
printf("Play resumes at:%lu second%s in.\n", hmt->resume,
|
||||
printf("Play resumes at:%u second%s in.\n", hmt->resume,
|
||||
hmt->resume == 1 ? "" : "s");
|
||||
printf("Timezone offset:%d\n", hmt->tzoffset);
|
||||
|
||||
|
@ -120,7 +125,8 @@ display_hmt(struct hmt *hmt)
|
|||
/* Display basic information EPG blocks... TBC */
|
||||
if (hmt->binsize > 0x1001)
|
||||
{
|
||||
uint16_t j, k;
|
||||
uint16_t j;
|
||||
uint32_t k;
|
||||
int n;
|
||||
|
||||
printf("\n");
|
||||
|
@ -133,7 +139,7 @@ display_hmt(struct hmt *hmt)
|
|||
break;
|
||||
printf(" Block:%d", n);
|
||||
k = read_uint32(hmt->bin + off + 4, 1);
|
||||
printf(" Time:%lu", k);
|
||||
printf(" Time:%u", k);
|
||||
k = read_uint32(hmt->bin + off + 8, 1);
|
||||
printf(" Offset:%#x\n", k);
|
||||
|
||||
|
|
4
file.c
4
file.c
|
@ -5,12 +5,8 @@
|
|||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <unistd.h>
|
||||
#include <time.h>
|
||||
#include <strings.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/mman.h>
|
||||
|
||||
#include "lint.h"
|
||||
|
||||
|
|
7
hmt.c
7
hmt.c
|
@ -5,9 +5,8 @@
|
|||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <unistd.h>
|
||||
#include <time.h>
|
||||
#include <strings.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "lint.h"
|
||||
|
||||
|
@ -18,7 +17,7 @@
|
|||
#define PTR32(addr, x) hmt->x = (uint32_t *)(hmt->bin + addr);
|
||||
|
||||
/* ETSI EN 300 468 Annex A.2 */
|
||||
inline uint8_t *
|
||||
uint8_t *
|
||||
strip_string(uint8_t *str)
|
||||
{
|
||||
if (*str >= 0x20)
|
||||
|
@ -178,7 +177,7 @@ genredescr(unsigned char b)
|
|||
return "Unknown";
|
||||
}
|
||||
|
||||
int
|
||||
unsigned char
|
||||
genrecode(char *s)
|
||||
{
|
||||
int i;
|
||||
|
|
3
hmt.h
3
hmt.h
|
@ -72,7 +72,8 @@ void parse_hmt(struct hmt *);
|
|||
uint8_t *strip_string(uint8_t *);
|
||||
int guidance(struct hmt *);
|
||||
const char *genredescr(unsigned char b);
|
||||
int genrecode(char *);
|
||||
unsigned char genrecode(char *);
|
||||
const char *genre(unsigned char);
|
||||
const char *recordingstatus(struct hmt *);
|
||||
const char *failurereason(struct hmt *);
|
||||
char *hmt_flags(struct hmt *);
|
||||
|
|
35
lint.h
35
lint.h
|
@ -7,10 +7,10 @@ extern int debug;
|
|||
extern const char *version;
|
||||
extern unsigned long sysopts;
|
||||
|
||||
inline uint16_t read_uint16(uint8_t *, int);
|
||||
inline uint32_t read_uint32(uint8_t *, int);
|
||||
inline void write_uint32(uint8_t *, uint32_t);
|
||||
inline void write_uint16(uint8_t *, uint16_t);
|
||||
uint16_t read_uint16(uint8_t *, int);
|
||||
uint32_t read_uint32(uint8_t *, int);
|
||||
void write_uint32(uint8_t *, uint32_t);
|
||||
void write_uint16(uint8_t *, uint16_t);
|
||||
|
||||
void hexdump(uint8_t *, uint32_t, uint32_t);
|
||||
|
||||
|
@ -39,6 +39,29 @@ void cmd_patch(struct hmt *, char *);
|
|||
void cmd_unpatch(struct hmt *, char *);
|
||||
void cmd_setseries(struct hmt *, char *);
|
||||
|
||||
const char *genre(unsigned char);
|
||||
int genrecode(char *);
|
||||
#ifdef _WIN32
|
||||
#include <io.h>
|
||||
#include <windows.h>
|
||||
|
||||
#define MAXPATHLEN MAX_PATH
|
||||
#define open(a,b,c) _open(a,b,c)
|
||||
#define close(a) _close(a)
|
||||
#define read(a,b,c) _read(a,b,c)
|
||||
#define write(a,b,c) _write(a,b,c)
|
||||
#define lseek(a,b,c) _lseek(a,b,c)
|
||||
#define MAP_FAILED 0
|
||||
#define mmap(a,b,c,d,e,f) MAP_FAILED
|
||||
#define munmap(a,b)
|
||||
#define strncasecmp _strnicmp
|
||||
|
||||
typedef long off_t;
|
||||
|
||||
#else /* _WIN32 */
|
||||
|
||||
#include <sys/mman.h>
|
||||
#include <sys/param.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#endif /* _WIN32 */
|
||||
|
||||
|
||||
|
|
12
main.c
12
main.c
|
@ -9,21 +9,19 @@
|
|||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/stat.h>
|
||||
#include <time.h>
|
||||
#include "lint.h"
|
||||
|
||||
int debug = 0;
|
||||
const char *version = "2.0.10";
|
||||
const char *version = "2.0.11";
|
||||
unsigned long sysopts = 0;
|
||||
|
||||
int
|
||||
syntax()
|
||||
{
|
||||
fprintf(stderr, "Humax HMT Tool v%s, by af123, 2011-2016.\n\n",
|
||||
fprintf(stderr, "Humax HMT Tool v%s, by af123, 2011-2019.\n\n",
|
||||
version);
|
||||
fprintf(stderr,
|
||||
"Syntax: hmt [command] <filename> [filename] ...\n");
|
||||
|
@ -67,7 +65,7 @@ syntax()
|
|||
" +patch8=offset:value patch 8-bit value\n"
|
||||
" +patch16=offset:value patch 16-bit value\n"
|
||||
" +patch32=offset:value patch 32-bit value\n"
|
||||
" Offset and value can be preceeded with 0x to indicate hex.\n"
|
||||
" Offset and value can be preceded with 0x to indicate hex.\n"
|
||||
);
|
||||
|
||||
fprintf(stderr,
|
||||
|
@ -76,7 +74,7 @@ syntax()
|
|||
" +read8=offset read 8-bit value\n"
|
||||
" +read16=offset read 16-bit value\n"
|
||||
" +read32=offset read 32-bit value\n"
|
||||
" Offset can be preceeded with 0x to indicate hex.\n"
|
||||
" Offset can be preceded with 0x to indicate hex.\n"
|
||||
);
|
||||
|
||||
fprintf(stderr,
|
||||
|
@ -120,7 +118,7 @@ main(int argc, char **argv)
|
|||
CMD_PATCH,
|
||||
CMD_UNPATCH
|
||||
} cmd = CMD_LIST;
|
||||
char *newstr;
|
||||
char *newstr = "";
|
||||
int i, toggle;
|
||||
|
||||
if (argc > 1 && !strncmp(argv[1], "-d", 2))
|
||||
|
|
8
util.c
8
util.c
|
@ -16,7 +16,7 @@
|
|||
|
||||
#include "lint.h"
|
||||
|
||||
inline uint32_t
|
||||
uint32_t
|
||||
read_uint32(uint8_t *p, int le)
|
||||
{
|
||||
if (le)
|
||||
|
@ -25,7 +25,7 @@ read_uint32(uint8_t *p, int le)
|
|||
return p[0] << 24 | p[1] << 16 | p[2] << 8 | p[3];
|
||||
}
|
||||
|
||||
inline uint16_t
|
||||
uint16_t
|
||||
read_uint16(uint8_t *p, int le)
|
||||
{
|
||||
if (le)
|
||||
|
@ -34,7 +34,7 @@ read_uint16(uint8_t *p, int le)
|
|||
return p[0] << 8 | p[1];
|
||||
}
|
||||
|
||||
inline void
|
||||
void
|
||||
write_uint32(uint8_t *p, uint32_t val)
|
||||
{
|
||||
*p++ = val & 0xff;
|
||||
|
@ -43,7 +43,7 @@ write_uint32(uint8_t *p, uint32_t val)
|
|||
*p++ = val >> 24 & 0xff;
|
||||
}
|
||||
|
||||
inline void
|
||||
void
|
||||
write_uint16(uint8_t *p, uint16_t val)
|
||||
{
|
||||
*p++ = val & 0xff;
|
||||
|
|
Loading…
Reference in New Issue