13
0

ptformat: Update to upstream c0305a2

This commit is contained in:
Damien Zammit 2018-04-22 12:49:43 +10:00
parent 8473cdb086
commit ffd8855391
2 changed files with 55 additions and 46 deletions

View File

@ -1,18 +1,24 @@
/* /*
Copyright (C) 2015 Damien Zammit * libptformat - a library to read ProTools sessions
Copyright (C) 2015 Robin Gareus *
* Copyright (C) 2015 Damien Zammit
This program is free software; you can redistribute it and/or modify * Copyright (C) 2015 Robin Gareus
it under the terms of the GNU General Public License as published by *
the Free Software Foundation; either version 3 of the License, or * This library is free software; you can redistribute it and/or
(at your option) any later version. * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
This program is distributed in the hope that it will be useful, * version 2.1 of the License, or (at your option) any later version.
but WITHOUT ANY WARRANTY; without even the implied warranty of *
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * This library is distributed in the hope that it will be useful,
GNU General Public License for more details. * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
*/ * Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -1509,12 +1515,12 @@ PTFFormat::parserest12(void) {
if (!jumpback(&k, ptfunxored, len, (const unsigned char *)"\x5a", 1)) if (!jumpback(&k, ptfunxored, len, (const unsigned char *)"\x5a", 1))
return; return;
jumpto(&k, ptfunxored, k+0x500, (const unsigned char *)"\x5a\x03", 2); jumpto(&k, ptfunxored, k+0x2000, (const unsigned char *)"\x5a\x03", 2);
k++; k++;
groupcount = 0; groupcount = 0;
for (i = k; i < len - 0x500; i++) { for (i = k; i < len; i++) {
if (!jumpto(&i, ptfunxored, i+0x500, (const unsigned char *)"\x5a\x03", 2)) if (!jumpto(&i, ptfunxored, len, (const unsigned char *)"\x5a\x03", 2))
break; break;
groupcount++; groupcount++;
} }
@ -1619,13 +1625,16 @@ nocustom:
if (!jumpto(&k, ptfunxored, len, (const unsigned char *)"\x5a\x06", 2)) if (!jumpto(&k, ptfunxored, len, (const unsigned char *)"\x5a\x06", 2))
return; return;
for (l = 0; l < 11; l++) { k++;
if (!jumpto(&k, ptfunxored, len, (const unsigned char *)"\x5a", 1))
return; if (!jumpto(&k, ptfunxored, len, (const unsigned char *)"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 16))
k++; return;
} k++;
if (!jumpto(&k, ptfunxored, len, (const unsigned char *)"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 16))
return;
k++;
/*
// Hack to find actual start of region group information // Hack to find actual start of region group information
while (k < len) { while (k < len) {
if ((ptfunxored[k+13] == 0x5a) && (ptfunxored[k+14] & 0xf)) { if ((ptfunxored[k+13] == 0x5a) && (ptfunxored[k+14] & 0xf)) {
@ -1641,19 +1650,13 @@ nocustom:
break; break;
k++; k++;
} }
*/
verbose_printf("hack region groups k=0x%x\n", k); verbose_printf("hack region groups k=0x%x\n", k);
groupcount = 0;
compoundcount = 0; compoundcount = 0;
j = k; j = k;
if (!jumpto(&j, ptfunxored, j+100, (const unsigned char *)"\x5a\x09", 2)) { groupmax = groupcount == 0 ? 0 : ptfunxored[j+3] | ptfunxored[j+4] << 8;
groupmax = 0; groupcount = 0;
} else { for (i = k; (groupcount < groupmax) && (i < len-70); i++) {
groupmax = ptfunxored[j+3] | ptfunxored[j+4] << 8;
}
i = k;
for (; (groupcount < groupmax) && (i < len-70); i++) {
if ( (ptfunxored[i ] == 0x5a) && if ( (ptfunxored[i ] == 0x5a) &&
(ptfunxored[i+1] == 0x03)) { (ptfunxored[i+1] == 0x03)) {
break; break;
@ -1923,7 +1926,7 @@ nocustom:
// Start pure regions // Start pure regions
k = m != 0 ? m : k - 1; k = m != 0 ? m : k - 1;
if (!jumpto(&k, ptfunxored, k+64, (const unsigned char *)"\x5a\x05", 2)) if (!jumpto(&k, ptfunxored, k+64, (const unsigned char *)"\x5a\x05", 2))
jumpto(&k, ptfunxored, k+128, (const unsigned char *)"\x5a\x02", 2); jumpto(&k, ptfunxored, k+0x400, (const unsigned char *)"\x5a\x02", 2);
verbose_printf("pure regions k=0x%x\n", k); verbose_printf("pure regions k=0x%x\n", k);

View File

@ -1,17 +1,23 @@
/* /*
Copyright (C) 2015 Damien Zammit * libptformat - a library to read ProTools sessions
*
This program is free software; you can redistribute it and/or modify * Copyright (C) 2015 Damien Zammit
it under the terms of the GNU General Public License as published by *
the Free Software Foundation; either version 3 of the License, or * This library is free software; you can redistribute it and/or
(at your option) any later version. * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
This program is distributed in the hope that it will be useful, * version 2.1 of the License, or (at your option) any later version.
but WITHOUT ANY WARRANTY; without even the implied warranty of *
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * This library is distributed in the hope that it will be useful,
GNU General Public License for more details. * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
*/ * Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifndef PTFFORMAT_H #ifndef PTFFORMAT_H
#define PTFFORMAT_H #define PTFFORMAT_H