extern struct uae_filter uaefilters[];
extern struct uae_filter *usedfilter;
-uae_u8 *getfilterrect1 (RECT *sr, RECT *dr, int dst_depth, int aw, int ah, int scale, int temp_width, int temp_height, uae_u8 *dptr, int pitch);
void getfilterrect2 (RECT *sr, RECT *dr, RECT *zr, int dst_width, int dst_height, int aw, int ah, int scale, int temp_width, int temp_height);
void getfilteroffset (int *dx, int *dy, int *mx, int *my);
uae_u8 *getfilterbuffer (int *widthp, int *heightp, int *pitch, int *depth);
extern void zfile_close_archive (struct zfile *d);
extern struct zfile *zfile_open_archive (const TCHAR *path, int flags);
extern int zfile_exists_archive (const TCHAR *path, const TCHAR *rel);
+extern bool zfile_needwrite (struct zfile*);
\ No newline at end of file
int id;
void *answer;
shmpiece *x;
+ static int recurse;
- if (!canjit()) {
+ if (!canjit ()) {
nocanbang ();
return xcalloc (uae_u8, s + 4);
}
id = shmget (IPC_PRIVATE, s, 0x1ff, file);
if (id == -1) {
- static int recurse;
uae_u8 *p;
nocanbang ();
if (recurse)
shm_start = x;
return (uae_u8*)answer;
}
+ if (recurse)
+ return NULL;
nocanbang ();
- return mapped_malloc (s, file);
+ recurse++;
+ uae_u8 *r = mapped_malloc (s, file);
+ recurse--;
+ return r;
}
#endif
L"killwinkeys", L"sound_force_primary", L"iconified_highpriority",
L"sound_sync", L"sound_tweak", L"directx6", L"sound_style",
L"file_path", L"iconified_nospeed", L"activepriority", L"magic_mouse",
- L"filesystem_codepage", L"aspi",
+ L"filesystem_codepage", L"aspi", L"no_overlay",
0
};
#define WINUAEPUBLICBETA 1
#define LANG_DLL 1
-#define WINUAEBETA L"19"
-#define WINUAEDATE MAKEBD(2010, 9, 19)
-#define WINUAEEXTRA L"RC2"
+#define WINUAEBETA L"20"
+#define WINUAEDATE MAKEBD(2010, 9, 22)
+#define WINUAEEXTRA L"RC3"
#define WINUAEREV L""
#define IHF_WINDOWHIDDEN 6
return v;
}
-static void fixh (int *ah, int *th)
+static void fixh (int *ah, int *th, int minh)
{
if (!(beamcon0 & 0x80)) {
int max = ((572 / 2) * scale) << currprefs.gfx_vresolution;
+ if (minh && max < minh)
+ max = minh;
if (*ah > max)
*ah = max;
if (*th > max)
}
}
-uae_u8 *getfilterrect1 (RECT *sr, RECT *dr, int dst_depth, int aw, int ah, int scale, int temp_width, int temp_height, uae_u8 *dptr, int pitch)
+static uae_u8 *getfilterrect1 (RECT *sr, RECT *dr, int dst_width, int dst_height, int dst_depth, int aw, int ah, int scale, int temp_width, int temp_height, uae_u8 *dptr, int pitch)
{
int aws, ahs;
- fixh (&ah, &temp_height);
+ fixh (&ah, &temp_height, dst_height);
aws = aw * scale;
ahs = ah * scale;
fpux_save (&fpuv);
- fixh (&ah, &temp_height);
+ fixh (&ah, &temp_height, dst_height);
getinit ();
ahs2 = vblscale (ah) * scale;
dptr = surfstart;
enddptr = dptr + pitch * temp_height;
if (!d3d) {
- dptr = getfilterrect1 (&sr, &dr, dst_depth, aw, ah, scale, temp_width, temp_height, dptr, pitch);
+ dptr = getfilterrect1 (&sr, &dr, dst_width, dst_height, dst_depth, aw, ah, scale, temp_width, temp_height, dptr, pitch);
}
if (!dptr) /* weird things can happen */
HandleConfiguration (hDlg, CONFIG_SAVE_FULL, config, newpath);
DeleteConfigTree (hDlg);
config = CreateConfigStore (config, TRUE);
- config = fixloadconfig (hDlg, config);
ConfigToRegistry (config, configtypepanel);
- InitializeConfigTreeView (hDlg);
+ config = initloadsave (hDlg, config);
InitializeConfig (hDlg, config);
break;
case IDC_QUICKSAVE:
HandleConfiguration (hDlg, CONFIG_SAVE, config, NULL);
DeleteConfigTree (hDlg);
config = CreateConfigStore (config, TRUE);
- config = fixloadconfig (hDlg, config);
ConfigToRegistry (config, configtypepanel);
- InitializeConfigTreeView (hDlg);
+ config = initloadsave (hDlg, config);
InitializeConfig (hDlg, config);
break;
case IDC_QUICKLOAD:
HandleConfiguration (hDlg, CONFIG_DELETE, config, NULL);
DeleteConfigTree (hDlg);
config = CreateConfigStore (config, TRUE);
- config = fixloadconfig (hDlg, config);
- InitializeConfigTreeView (hDlg);
+ config = initloadsave (hDlg, config);
+ InitializeConfig (hDlg, config);
break;
case IDC_VIEWINFO:
if (workprefs.info[0]) {
set_path (L"SaveimagePath", NULL, path_type);
set_path (L"VideoPath", NULL, path_type);
set_path (L"RipperPath", NULL, path_type);
+ set_path (L"InputPath", NULL, path_type);
values_to_pathsdialog (hDlg);
FreeConfigStore ();
}
-- rar archives crashed if file was already open (due to design flaw, it was possible to
+Beta 20 (RC3):
+
+- Configuration panel save and delete operations lost currently selected configuration entry
+- some filters in DirectDraw mode had blank screen (depended on display height)
+- VirtualAlloc() allocation error and JIT direct enabled recursed until stack overflowed
+
+Beta 19 (RC2):
+
+- rar archives crashed if file was already open (stupid design flaw, it was possible to
open archives even if requested mode was read-write)
- added "fullscreen (max)" and "fullscreen (tv)" (approximate only) to "autoscale" select
menu, basically replaces old "FS" filter multiplier
+++ /dev/null
-/* testGMC() */
-/* Rip_GMC() */
-/* Depack_GMC() */
-
-#include "globals.h"
-#include "extern.h"
-
-
-short testGMC ( void )
-{
- /* test #1 */
- if ( (PW_i<7) || ((PW_Start_Address+444)>PW_in_size) )
- {
-/*printf ( "#1\n" );*/
- return BAD;
- }
- PW_Start_Address = PW_i-7;
-
- /* samples descriptions */
- PW_WholeSampleSize=0;
- PW_j=0;
- for ( PW_k = 0 ; PW_k < 15 ; PW_k ++ )
- {
- PW_o = (in_data[PW_Start_Address+16*PW_k+4]*256)+in_data[PW_Start_Address+16*PW_k+5];
- PW_n = (in_data[PW_Start_Address+16*PW_k+12]*256)+in_data[PW_Start_Address+16*PW_k+13];
- PW_o *= 2;
- /* volumes */
- if ( in_data[PW_Start_Address + 7 + (16*PW_k)] > 0x40 )
- {
-/*printf ( "#2\n" );*/
- return BAD;
- }
- /* size */
- if ( PW_o > 0xFFFF )
- {
-/*printf ( "#2,1 Start:%ld\n" , PW_Start_Address );*/
- return BAD;
- }
- if ( PW_n > PW_o )
- {
-/*printf ( "#2,2 Start:%ld\n" , PW_Start_Address );*/
- return BAD;
- }
- PW_WholeSampleSize += PW_o;
- if ( PW_o != 0 )
- PW_j = PW_k+1;
- }
- if ( PW_WholeSampleSize <= 4 )
- {
-/*printf ( "#2,3 Start:%ld\n" , PW_Start_Address );*/
- return BAD;
- }
- /* PW_j is the highest not null sample */
-
- /* pattern table size */
- if ( ( in_data[PW_Start_Address+243] > 0x64 ) ||
- ( in_data[PW_Start_Address+243] == 0x00 ) )
- {
- return BAD;
- }
-
- /* pattern order table */
- PW_l=0;
- for ( PW_n=0 ; PW_n<100 ; PW_n++ )
- {
- PW_k = ((in_data[PW_Start_Address+244+PW_n*2]*256)+
- in_data[PW_Start_Address+245+PW_n*2]);
- if ( ((PW_k/1024)*1024) != PW_k )
- {
-/*printf ( "#4 Start:%ld (PW_k:%ld)\n" , PW_Start_Address , PW_k);*/
- return BAD;
- }
- PW_l = ((PW_k/1024)>PW_l) ? PW_k/1024 : PW_l;
- }
- PW_l += 1;
- /* PW_l is the number of pattern */
- if ( (PW_l == 1) || (PW_l >0x64) )
- {
- return BAD;
- }
-
- /* test pattern data */
- PW_o = in_data[PW_Start_Address+243];
- PW_m = 0;
- for ( PW_k=0 ; PW_k<PW_l ; PW_k++ )
- {
- for ( PW_n=0 ; PW_n<256 ; PW_n++ )
- {
- if ( ( in_data[PW_Start_Address+444+PW_k*1024+PW_n*4] > 0x03 ) ||
- ( (in_data[PW_Start_Address+444+PW_k*1024+PW_n*4+2]&0x0f) >= 0x90 ))
- {
-/*printf ( "#5,0 Start:%ld (PW_k:%ld)\n" , PW_Start_Address , PW_k);*/
- return BAD;
- }
- if ( ((in_data[PW_Start_Address+444+PW_k*1024+PW_n*4+2]&0xf0)>>4) > PW_j )
- {
-/*printf ( "#5,1 Start:%ld (PW_j:%ld) (where:%ld) (value:%x)\n"
- , PW_Start_Address , PW_j , PW_Start_Address+444+PW_k*1024+PW_n*4+2
- , ((in_data[PW_Start_Address+444+PW_k*1024+PW_n*4+2]&0xf0)>>4) );*/
- return BAD;
- }
- if ( ((in_data[PW_Start_Address+444+PW_k*1024+PW_n*4+2]&0x0f) == 3) &&
- (in_data[PW_Start_Address+444+PW_k*1024+PW_n*4+3] > 0x40) )
- {
-/*printf ( "#5,2 Start:%ld (PW_j:%ld)\n" , PW_Start_Address , PW_j);*/
- return BAD;
- }
- if ( ((in_data[PW_Start_Address+444+PW_k*1024+PW_n*4+2]&0x0f) == 4) &&
- (in_data[PW_Start_Address+444+PW_k*1024+PW_n*4+3] > 0x63) )
- {
-/*printf ( "#5,3 Start:%ld (PW_j:%ld)\n" , PW_Start_Address , PW_j);*/
- return BAD;
- }
- if ( ((in_data[PW_Start_Address+444+PW_k*1024+PW_n*4+2]&0x0f) == 5) &&
- (in_data[PW_Start_Address+444+PW_k*1024+PW_n*4+3] > PW_o+1) )
- {
-/*printf ( "#5,4 Start:%ld (effect:5)(PW_o:%ld)(4th note byte:%x)\n" , PW_Start_Address , PW_j , in_data[PW_Start_Address+444+PW_k*1024+PW_n*4+3]);*/
- return BAD;
- }
- if ( ((in_data[PW_Start_Address+444+PW_k*1024+PW_n*4+2]&0x0f) == 6) &&
- (in_data[PW_Start_Address+444+PW_k*1024+PW_n*4+3] >= 0x02) )
- {
-/*printf ( "#5,5 Start:%ld (at:%ld)\n" , PW_Start_Address , PW_Start_Address+444+PW_k*1024+PW_n*4+3 );*/
- return BAD;
- }
- if ( ((in_data[PW_Start_Address+444+PW_k*1024+PW_n*4+2]&0x0f) == 7) &&
- (in_data[PW_Start_Address+444+PW_k*1024+PW_n*4+3] >= 0x02) )
- {
-/*printf ( "#5,6 Start:%ld (at:%ld)\n" , PW_Start_Address , PW_Start_Address+444+PW_k*1024+PW_n*4+3 );*/
- return BAD;
- }
- if ( ((in_data[PW_Start_Address+444+PW_k*1024+PW_n*4]&0x0f) > 0x00) || (in_data[PW_Start_Address+445+PW_k*1024+PW_n*4] > 0x00) )
- PW_m = 1;
- }
- }
- if ( PW_m == 0 )
- {
- /* only empty notes */
- return BAD;
- }
- /* PW_WholeSampleSize is the whole sample size */
-
- return GOOD;
-}
-
-
-void Rip_GMC ( void )
-{
- /* PW_l is still the number of pattern to play */
- /* PW_WholeSampleSize is already the whole sample size */
-
- OutputSize = PW_WholeSampleSize + (PW_l*1024) + 444;
-
- CONVERT = GOOD;
- Save_Rip ( "Game Music Creator module", GMC );
-
- if ( Save_Status == GOOD )
- PW_i += 444; /* after header */
-}
-
-/*
- * Game_Music_Creator.c 1997 (c) Sylvain "Asle" Chipaux
- *
- * Depacks musics in the Game Music Creator format and saves in ptk.
- *
- * Last update: 30/11/99
- * - removed open() (and other fread()s and the like)
- * - general Speed & Size Optmizings
-*/
-
-
-void Depack_GMC ( void )
-{
- Uchar *Whatever;
- Uchar Max=0x00;
- long WholeSampleSize=0;
- long i=0,j=0;
- long Where = PW_Start_Address;
- FILE *out;
-
- if ( Save_Status == BAD )
- return;
-
- sprintf ( Depacked_OutName , "%ld.mod" , Cpt_Filename-1 );
- out = PW_fopen ( Depacked_OutName , "w+b" );
-
- /* title */
- Whatever = (Uchar *) malloc ( 1024 );
- BZERO ( Whatever , 1024 );
- fwrite ( Whatever , 20 , 1 , out );
-
- /* read and write whole header */
- /*printf ( "Converting sample headers ... " );*/
- for ( i=0 ; i<15 ; i++ )
- {
- /* write name */
- fwrite ( Whatever , 22 , 1 , out );
-
- /* size */
- fwrite ( &in_data[Where+4] , 2 , 1 , out );
- WholeSampleSize += (((in_data[Where+4]*256)+in_data[Where+5])*2);
-
- /* finetune */
- fwrite ( Whatever , 1 , 1 , out );
-
- /* volume */
- fwrite ( &in_data[Where+7] , 1 , 1 , out );
-
- /* loop size */
- Whatever[32] = in_data[Where+12];
- Whatever[33] = in_data[Where+13];
-
- /* loop start */
- Whatever[34] = in_data[Where+14];
- Whatever[35] = in_data[Where+15];
- Whatever[35] /= 2;
- if ( (Whatever[34]/2)*2 != Whatever[34] )
- {
- if ( Whatever[35] < 0x80 )
- Whatever[35] += 0x80;
- else
- {
- Whatever[35] -= 0x80;
- Whatever[34] += 0x01;
- }
- }
- Whatever[34] /= 2;
- fwrite ( &Whatever[34] , 1 , 1 , out );
- fwrite ( &Whatever[35] , 1 , 1 , out );
- Whatever[33] /= 2;
- if ( (Whatever[32]/2)*2 != Whatever[32] )
- {
- if ( Whatever[33] < 0x80 )
- Whatever[33] += 0x80;
- else
- {
- Whatever[33] -= 0x80;
- Whatever[32] += 0x01;
- }
- }
- Whatever[32] /= 2;
- if ( (Whatever[32]==0x00) && (Whatever[33]==0x00) )
- Whatever[33] = 0x01;
- fwrite ( &Whatever[32] , 1 , 1 , out );
- fwrite ( &Whatever[33] , 1 , 1 , out );
-
- Where += 16;
- }
- Whatever[129] = 0x01;
- for ( i=0 ; i<16 ; i++ )
- fwrite ( &Whatever[100] , 30 , 1 , out );
- /*printf ( "ok\n" );*/
-
- /* pattern list size */
- Where = PW_Start_Address + 0xF3;
- fwrite ( &in_data[Where++] , 1 , 1 , out );
-
- /* ntk byte */
- Whatever[0] = 0x7f;
- fwrite ( Whatever , 1 , 1 , out );
-
- /* read and write size of pattern list */
- /*printf ( "Creating the pattern table ... " );*/
- BZERO (Whatever , 1024);
- for ( i=0 ; i<100 ; i++ )
- {
- Whatever[i] = ((in_data[Where]*256)+in_data[Where+1])/1024;
- Where += 2;
- }
- fwrite ( Whatever , 128 , 1 , out );
-
- /* get number of pattern */
- Max = 0x00;
- for ( i=0 ; i<128 ; i++ )
- {
- if ( Whatever[i] > Max )
- Max = Whatever[i];
- }
- /*printf ( "ok\n" );*/
-
-
- /* write ID */
- Whatever[0] = 'M';
- Whatever[1] = '.';
- Whatever[2] = 'K';
- Whatever[3] = '.';
- fwrite ( Whatever , 4 , 1 , out );
-
-
- /* pattern data */
- /*printf ( "Converting pattern datas " );*/
- Where = PW_Start_Address + 444;
- for ( i=0 ; i<=Max ; i++ )
- {
- BZERO ( Whatever , 1024 );
- for ( j=0 ; j<1024 ; j++ ) Whatever[j] = in_data[Where++];
- for ( j=0 ; j<256 ; j++ )
- {
- switch ( Whatever[(j*4)+2]&0x0f )
- {
- case 3: /* replace by C */
- Whatever[(j*4)+2] += 0x09;
- break;
- case 4: /* replace by D */
- Whatever[(j*4)+2] += 0x09;
- break;
- case 5: /* replace by B */
- Whatever[(j*4)+2] += 0x06;
- break;
- case 6: /* replace by E0 */
- Whatever[(j*4)+2] += 0x08;
- break;
- case 7: /* replace by E0 */
- Whatever[(j*4)+2] += 0x07;
- break;
- case 8: /* replace by F */
- Whatever[(j*4)+2] += 0x07;
- break;
- default:
- break;
- }
- }
- fwrite ( Whatever , 1024 , 1 , out );
- /*printf ( "." );*/
- /*fflush ( stdout );*/
- }
- free ( Whatever );
- /*printf ( " ok\n" );*/
- /*fflush ( stdout );*/
-
- /* sample data */
- /*printf ( "Saving sample data ... " );*/
- fwrite ( &in_data[Where] , WholeSampleSize , 1 , out );
- /*printf ( "ok\n" );*/
- /*fflush ( stdout );*/
-
- /* crap */
- Crap ( "Game Music Creator" , BAD , BAD , out );
-
- fflush ( out );
- fclose ( out );
-
- printf ( "done\n" );
- return; /* useless ... but */
-}
+++ /dev/null
-/* testNoisepacker3() */
-/* Rip_Noisepacker3() */
-/* Depack_Noisepacker3() */
-
-#include "globals.h"
-#include "extern.h"
-
-short testNoisepacker3 ( void )
-{
- if ( PW_i < 9 )
- {
- return BAD;
- }
- PW_Start_Address = PW_i-9;
-
- /* size of the pattern table */
- PW_j = (in_data[PW_Start_Address+2]*256)+in_data[PW_Start_Address+3];
- if ( (((PW_j/2)*2) != PW_j) || (PW_j == 0) )
- {
-/*printf ( "#2 Start:%ld\n" , PW_Start_Address );*/
- return BAD;
- }
- /* PW_j is the size of the pattern list (*2) */
-
- /* test nbr of samples */
- if ( (in_data[PW_Start_Address+1]&0x0f) != 0x0C )
- {
-/*printf ( "#3,0 Start:%ld\n" , PW_Start_Address );*/
- return BAD;
- }
- PW_l = ((in_data[PW_Start_Address]<<4)&0xf0)|((in_data[PW_Start_Address+1]>>4)&0x0f);
- if ( (PW_l > 0x1F) || (PW_l == 0) || ((PW_Start_Address+8+PW_j+PW_l*8)>PW_in_size))
- {
-/*printf ( "#3 Start:%ld\n" , PW_Start_Address );*/
- return BAD;
- }
- /* PW_l is the number of samples */
-
- /* test volumes */
- for ( PW_k=0 ; PW_k<PW_l ; PW_k++ )
- {
- if ( in_data[PW_Start_Address+9+PW_k*16] > 0x40 )
- {
- return BAD;
- }
- }
-
- /* test sample sizes */
- PW_WholeSampleSize=0;
- for ( PW_k=0 ; PW_k<PW_l ; PW_k++ )
- {
- PW_o = (in_data[PW_Start_Address+PW_k*16+14]*256)+in_data[PW_Start_Address+PW_k*16+15];
- PW_m = (in_data[PW_Start_Address+PW_k*16+20]*256)+in_data[PW_Start_Address+PW_k*16+21];
- PW_n = (in_data[PW_Start_Address+PW_k*16+22]*256)+in_data[PW_Start_Address+PW_k*16+23];
- PW_o *= 2;
- PW_m *= 2;
- PW_n *= 2;
- if ( (PW_o > 0xFFFF) ||
- (PW_m > 0xFFFF) ||
- (PW_n > 0xFFFF) )
- {
-/*printf ( "#5 Start:%ld\n" , PW_Start_Address );*/
- return BAD;
- }
- if ( (PW_m + PW_n) > (PW_o+2) )
- {
-/*printf ( "#5,1 Start:%ld\n" , PW_Start_Address );*/
- return BAD;
- }
- if ( (PW_n != 0) && (PW_m == 0) )
- {
-/*printf ( "#5,2 Start:%ld\n" , PW_Start_Address );*/
- return BAD;
- }
- PW_WholeSampleSize += PW_o;
- }
- if ( PW_WholeSampleSize <= 4 )
- {
-/*printf ( "#5,3 Start:%ld\n" , PW_Start_Address );*/
- return BAD;
- }
-
-
- /* small shit to gain some vars */
- PW_l *= 16;
- PW_l += 8;
- PW_l += 4;
- /* PW_l is now the size of the header 'til the end of sample descriptions */
- if ( (PW_l+PW_Start_Address) > PW_in_size )
- {
-/* printf ( "NP3 Header bigger than file size (%ld > %ld)\n", PW_l, PW_in_size);*/
- return BAD;
- }
-
-
- /* test pattern table */
- PW_n=0;
- for ( PW_k=0 ; PW_k<PW_j ; PW_k += 2 )
- {
- PW_m = ((in_data[PW_Start_Address+PW_l+PW_k]*256)+in_data[PW_Start_Address+PW_l+PW_k+1]);
- if ( ((PW_m/8)*8) != PW_m )
- {
-/*printf ( "#6 Start:%ld\n" , PW_Start_Address );*/
- return BAD;
- }
- if ( PW_m > PW_n )
- PW_n = PW_m;
- }
- PW_l += PW_j;
- PW_l += PW_n;
- PW_l += 8; /*paske on a que l'address du dernier pattern .. */
- /* PW_l is now the size of the header 'til the end of the track list */
- /* PW_j is now available for use :) */
- /* PW_n is the highest pattern number (*8) */
-
- /* test track data size */
- PW_k = (in_data[PW_Start_Address+6]*256)+in_data[PW_Start_Address+7];
- if ( (PW_k <= 63) || ((PW_k+PW_l+PW_Start_Address)>PW_in_size))
- {
-/*printf ( "#7 Start:%ld\n" , PW_Start_Address );*/
- return BAD;
- }
-
- /* test notes */
- /* re-calculate the number of sample */
- /* PW_k is the track data size */
- PW_j = ((in_data[PW_Start_Address]<<4)&0xf0)|((in_data[PW_Start_Address+1]>>4)&0x0f);
- for ( PW_m=0 ; PW_m < PW_k ; PW_m++ )
- {
- if ( (in_data[PW_Start_Address+PW_l+PW_m]&0x80) == 0x80 )
- continue;
- /* si note trop grande et si effet = A */
- if ( (in_data[PW_Start_Address+PW_l+PW_m] > 0x49)||
- ((in_data[PW_Start_Address+PW_l+PW_m+1]&0x0f) == 0x0A) )
- {
-/*printf ( "#8 Start:%ld (at %x)(PW_k:%x)(PW_l:%x)(PW_m:%x)\n" , PW_Start_Address,PW_Start_Address+PW_l+PW_m,PW_k,PW_l,PW_m );*/
- return BAD;
- }
- /* si effet D et arg > 0x40 */
- if ( ((in_data[PW_Start_Address+PW_l+PW_m+1]&0x0f) == 0x0D )&&
- (in_data[PW_Start_Address+PW_l+PW_m+2] > 0x40 ) )
- {
-/*printf ( "#8 Start:%ld (at %ld)(effet:%d)(arg:%ld)\n"
- , PW_Start_Address
- , PW_Start_Address+PW_l+PW_m
- , (PW_Start_Address+PW_l+PW_m+1)&0x0f
- , (PW_Start_Address+PW_l+PW_m+2) );*/
- return BAD;
- }
- /* sample nbr > ce qui est defini au debut ? */
- if ( (((in_data[PW_Start_Address+PW_l+PW_m]<<4)&0x10)|
- ((in_data[PW_Start_Address+PW_l+PW_m+1]>>4)&0x0f)) > PW_j )
- {
-/*printf ( "#8,1 Start:%ld (at %x)(PW_k:%x)(PW_l:%x)(PW_m:%x)(PW_j:%ld)\n" , PW_Start_Address,PW_Start_Address+PW_l+PW_m,PW_k,PW_l,PW_m,PW_j );*/
- return BAD;
- }
- /* all is empty ?!? ... cannot be ! */
- if ( (in_data[PW_Start_Address+PW_l+PW_m] == 0) &&
- (in_data[PW_Start_Address+PW_l+PW_m+1] == 0) &&
- (in_data[PW_Start_Address+PW_l+PW_m+2] == 0) && (PW_m<(PW_k-3)) )
- {
-/*printf ( "#8,2 Start:%ld (at %x)(PW_k:%x)(PW_l:%x)(PW_m:%x)(PW_j:%ld)\n" , PW_Start_Address,PW_Start_Address+PW_l+PW_m,PW_k,PW_l,PW_m,PW_j );*/
- return BAD;
- }
- PW_m += 2;
- }
-
- /* PW_WholeSampleSize is the size of the sample data */
- /* PW_l is the size of the header 'til the track datas */
- /* PW_k is the size of the track datas */
- return GOOD;
-}
-
-
-
-void Rip_Noisepacker3 ( void )
-{
- OutputSize = PW_k + PW_WholeSampleSize + PW_l;
- /* printf ( "\b\b\b\b\b\b\b\bNoisePacker v3 module found at %ld !. its size is : %ld\n" , PW_Start_Address , OutputSize );*/
-
- CONVERT = GOOD;
- Save_Rip ( "NoisePacker v3 module", Noisepacker3 );
-
- if ( Save_Status == GOOD )
- PW_i += (OutputSize - 16); /* 15 should do but call it "just to be sure" :) */
-}
-
-
-
-/*
- * NoisePacker_v3.c 1998 (c) Asle / ReDoX
- *
- * Converts NoisePacked MODs back to ptk
- * Last revision : 26/11/1999 by Sylvain "Asle" Chipaux
- * reduced to only one FREAD.
- * Speed-up and Binary smaller.
- * update : 01/12/99
- * - removed fopen() and attached funcs.
-*/
-void Depack_Noisepacker3 ( void )
-{
- Uchar *Whatever;
- Uchar c1=0x00,c2=0x00,c3=0x00,c4=0x00;
- Uchar Nbr_Pos;
- Uchar Nbr_Smp;
- Uchar poss[36][2];
- Uchar Pat_Max=0x00;
- long Where=PW_Start_Address;
- long WholeSampleSize=0;
- long TrackDataSize;
- long Track_Addresses[128][4];
- long Unknown1;
- long i=0,j=0,k;
- long Track_Data_Start_Address;
- long SampleDataAddress=0;
- FILE *out;
-
- if ( Save_Status == BAD )
- return;
-
- fillPTKtable(poss);
-
- BZERO ( Track_Addresses , 128*4*4 );
-
- sprintf ( Depacked_OutName , "%ld.mod" , Cpt_Filename-1 );
- out = PW_fopen ( Depacked_OutName , "w+b" );
-
- /* read number of sample */
- Nbr_Smp = ((in_data[Where]<<4)&0xf0) | ((in_data[Where+1]>>4)&0x0f);
- /*printf ( "\nNumber of sample : %d (%x)\n" , Nbr_Smp , Nbr_Smp );*/
-
- /* write title */
- Whatever = (Uchar *) malloc ( 1024 );
- BZERO ( Whatever , 1024 );
- fwrite ( Whatever , 20 , 1 , out );
-
- /* read size of pattern list */
- Nbr_Pos = in_data[Where+3]/2;
- /*printf ( "Size of pattern list : %d\n" , Nbr_Pos );*/
-
- /* read 2 unknown bytes which size seem to be of some use ... */
- Unknown1 = (in_data[Where+4]*256)+in_data[Where+5];
-
- /* read track data size */
- TrackDataSize = (in_data[Where+6]*256)+in_data[Where+7];
- /*printf ( "TrackDataSize : %ld\n" , TrackDataSize );*/
-
- /* read sample descriptions */
- Where += 8;
- for ( i=0 ; i<Nbr_Smp ; i++ )
- {
- /* sample name */
- fwrite ( Whatever , 22 , 1 , out );
- /* size */
- fwrite ( &in_data[Where+6] , 2 , 1 , out );
- WholeSampleSize += (((in_data[Where+6]*256)+in_data[Where+7])*2);
- /* write finetune,vol */
- fwrite ( &in_data[Where] , 2 , 1 , out );
- /* write loop start */
- fwrite ( &in_data[Where+14] , 2 , 1 , out );
- /* write loop size */
- fwrite ( &in_data[Where+12] , 2 , 1 , out );
- Where += 16;
- }
- /*printf ( "Whole sample size : %ld\n" , WholeSampleSize );*/
-
- /* fill up to 31 samples */
- Whatever[29] = 0x01;
- while ( i != 31 )
- {
- fwrite ( Whatever , 30 , 1 , out );
- i += 1;
- }
-
- /* write size of pattern list */
- fwrite ( &Nbr_Pos , 1 , 1 , out );
-
- /* write noisetracker byte */
- c1 = 0x7f;
- fwrite ( &c1 , 1 , 1 , out );
-
- /* bypass 2 bytes ... seems always the same as in $02 */
- /* & bypass 2 other bytes which meaning is beside me */
- Where += 4;
-
- /* read pattern table */
- Pat_Max = 0x00;
- for ( i=0 ; i<Nbr_Pos ; i++ )
- {
- Whatever[i] = ((in_data[Where+(i*2)]*256)+in_data[Where+(i*2)+1])/8;
- /*printf ( "%d," , Whatever[i] );*/
- if ( Whatever[i] > Pat_Max )
- Pat_Max = Whatever[i];
- }
- Where += Nbr_Pos*2;
- Pat_Max += 1;
- /*printf ( "Number of pattern : %d\n" , Pat_Max );*/
-
- /* write pattern table */
- fwrite ( Whatever , 128 , 1 , out );
-
- /* write ptk's ID */
- Whatever[0] = 'M';
- Whatever[1] = '.';
- Whatever[2] = 'K';
- Whatever[3] = '.';
- fwrite ( Whatever , 4 , 1 , out );
-
- /* read tracks addresses per pattern */
- /*printf ( "\nWhere : %ld\n" , Where );*/
- for ( i=0 ; i<Pat_Max ; i++ )
- {
- Track_Addresses[i][0] = (in_data[Where+(i*8)]*256)+in_data[Where+(i*8)+1];
- Track_Addresses[i][1] = (in_data[Where+(i*8)+2]*256)+in_data[Where+(i*8)+3];
- Track_Addresses[i][2] = (in_data[Where+(i*8)+4]*256)+in_data[Where+(i*8)+5];
- Track_Addresses[i][3] = (in_data[Where+(i*8)+6]*256)+in_data[Where+(i*8)+7];
- }
- Track_Data_Start_Address = (Where + (Pat_Max*8));
- /*printf ( "Track_Data_Start_Address : %ld\n" , Track_Data_Start_Address );*/
-
- /* the track data now ... */
- for ( i=0 ; i<Pat_Max ; i++ )
- {
- BZERO ( Whatever , 1024 );
- for ( j=0 ; j<4 ; j++ )
- {
- Where = Track_Data_Start_Address + Track_Addresses[i][3-j];
- for ( k=0 ; k<64 ; k++ )
- {
- c1 = in_data[Where];
- Where += 1;
- if ( c1 >= 0x80 )
- {
- k += ((0x100-c1)-1);
- continue;
- }
- c2 = in_data[Where];
- Where += 1;
- c3 = in_data[Where];
- Where += 1;
-
- Whatever[k*16+j*4] = (c1<<4)&0x10;
- c4 = (c1 & 0xFE)/2;
- Whatever[k*16+j*4] |= poss[c4][0];
- Whatever[k*16+j*4+1] = poss[c4][1];
- if ( (c2&0x0f) == 0x08 )
- c2 &= 0xf0;
- if ( (c2&0x0f) == 0x07 )
- {
- c2 = (c2&0xf0)+0x0A;
- if ( c3 > 0x80 )
- c3 = 0x100-c3;
- else
- c3 = (c3<<4)&0xf0;
- }
- if ( (c2&0x0f) == 0x06 )
- {
- if ( c3 > 0x80 )
- c3 = 0x100-c3;
- else
- c3 = (c3<<4)&0xf0;
- }
- if ( (c2&0x0f) == 0x05 )
- {
- if ( c3 > 0x80 )
- c3 = 0x100-c3;
- else
- c3 = (c3<<4)&0xf0;
- }
- if ( (c2&0x0f) == 0x0E )
- {
- c3 = 0x01;
- }
- if ( (c2&0x0f) == 0x0B )
- {
- c3 += 0x04;
- c3 /= 2;
- }
- Whatever[k*16+j*4+2] = c2;
- Whatever[k*16+j*4+3] = c3;
- if ( (c2&0x0f) == 0x0D )
- k = 100; /* to leave the loop */
- }
- if ( Where > SampleDataAddress )
- SampleDataAddress = Where;
- }
- fwrite ( Whatever , 1024 , 1 , out );
- }
- free ( Whatever );
-
- /* sample data */
- if ( (((SampleDataAddress-PW_Start_Address)/2)*2) != SampleDataAddress )
- SampleDataAddress += 1;
- Where = SampleDataAddress;
- /*printf ( "Starting address of sample data : %x\n" , ftell ( in ) );*/
- fwrite ( &in_data[SampleDataAddress] , WholeSampleSize , 1 , out );
-
- Crap ( " NoisePacker v3 " , BAD , BAD , out );
-
- fclose ( out );
-
- printf ( "done\n" );
- return; /* useless ... but */
-}
s[_tcslen (s) - _tcslen (ext)] = 0;
}
+static bool checkwrite (struct zfile *zf, int *retcode)
+{
+ if (zfile_needwrite (zf)) {
+ if (retcode)
+ *retcode = -1;
+ return true;
+ }
+ return false;
+}
+
+
static uae_u8 exeheader[]={ 0x00,0x00,0x03,0xf3,0x00,0x00,0x00,0x00 };
static TCHAR *diskimages[] = { L"adf", L"adz", L"ipf", L"fdi", L"dms", L"wrp", L"dsq", 0 };
return z;
}
-struct zfile *zfile_gunzip (struct zfile *z)
+static struct zfile *zfile_gunzip (struct zfile *z, int *retcode)
{
uae_u8 header[2 + 1 + 1 + 4 + 1 + 1];
z_stream zs;
struct zfile *z2;
uae_u8 b;
+ if (checkwrite (z, retcode))
+ return NULL;
_tcscpy (name, z->name);
memset (&zs, 0, sizeof (zs));
memset (header, 0, sizeof (header));
zfile_fclose (z);
return z2;
}
+struct zfile *zfile_gunzip (struct zfile *z)
+{
+ return zfile_gunzip (z, NULL);
+}
static void truncate880k (struct zfile *z)
{
uae_u8 tmp[12];
struct zcache *zc;
+ if (checkwrite (z, retcode))
+ return NULL;
if (index > 2)
return NULL;
uae_u8 tmp[12];
struct zcache *zc;
+ if (checkwrite (z, retcode))
+ return NULL;
+
if (index > 2)
return NULL;
}
#endif
-static struct zfile *dsq (struct zfile *z, int lzx)
+static struct zfile *dsq (struct zfile *z, int lzx, int *retcode)
{
struct zfile *zi = NULL;
struct zvolume *zv = NULL;
+ if (checkwrite (z, retcode))
+ return NULL;
if (lzx) {
zv = archive_directory_lzx (z);
if (zv) {
return z;
}
-static struct zfile *wrp (struct zfile *z)
+static struct zfile *wrp (struct zfile *z, int *retcode)
{
+ if (zfile_needwrite (z)) {
+ if (retcode)
+ *retcode = -1;
+ return NULL;
+ }
return unwarp (z);
}
}
#define XZ_OUT_SIZE 10000
#define XZ_IN_SIZE 10000
-static struct zfile *xz (struct zfile *z)
+static struct zfile *xz (struct zfile *z, int *retcode)
{
static bool iscrc;
ISzAlloc allocImp;
struct zfile *zo = NULL;
uae_u8 out[XZ_OUT_SIZE], in[XZ_IN_SIZE];
+ if (checkwrite (z, retcode))
+ return NULL;
memset (&cx, 0, sizeof cx);
allocImp.Alloc = SzAlloc;
allocImp.Free = SzFree;
int i;
struct zfile *zextra[DMS_EXTRA_SIZE] = { 0 };
+ if (checkwrite (z, retcode))
+ return NULL;
if (recursive)
return NULL;
if (ext) {
if (mask & ZFD_UNPACK) {
if (index == 0) {
if (strcasecmp (ext, L"gz") == 0)
- return zfile_gunzip (z);
+ return zfile_gunzip (z, retcode);
if (strcasecmp (ext, L"adz") == 0)
- return zfile_gunzip (z);
+ return zfile_gunzip (z, retcode);
if (strcasecmp (ext, L"roz") == 0)
- return zfile_gunzip (z);
+ return zfile_gunzip (z, retcode);
if (strcasecmp (ext, L"hdz") == 0)
- return zfile_gunzip (z);
+ return zfile_gunzip (z, retcode);
if (strcasecmp (ext, L"wrp") == 0)
- return wrp (z);
+ return wrp (z, retcode);
if (strcasecmp (ext, L"xz") == 0)
- return xz (z);
+ return xz (z, retcode);
}
if (strcasecmp (ext, L"dms") == 0)
return dms (z, index, retcode);
if (mask & ZFD_UNPACK) {
if (index == 0) {
if (header[0] == 0x1f && header[1] == 0x8b)
- return zfile_gunzip (z);
+ return zfile_gunzip (z, retcode);
if (header[0] == 'P' && header[1] == 'K' && header[2] == 'D')
- return dsq (z, 0);
+ return dsq (z, 0, retcode);
if (header[0] == 0xfd && header[1] == 0x37 && header[2] == 0x7a && header[3] == 0x58 && header[4] == 0x5a && header[5] == 0)
- return xz (z);
+ return xz (z, retcode);
}
if (header[0] == 'D' && header[1] == 'M' && header[2] == 'S' && header[3] == '!')
return dms (z, index, retcode);
if (ext) {
if (mask & ZFD_UNPACK) {
if (strcasecmp (ext, L"dsq") == 0)
- return dsq (z, 1);
+ return dsq (z, 1, retcode);
}
if (mask & ZFD_ADF) {
if (strcasecmp (ext, L"adf") == 0 && !memcmp (header, "DOS", 3))
{
return _tcschr (mode, 'w') || _tcschr (mode, 'a') || _tcschr (mode, '+') || _tcschr (mode, 't');
}
+bool zfile_needwrite (struct zfile *zf)
+{
+ if (!zf->mode)
+ return false;
+ return writeneeded (zf->mode);
+}
static struct zfile *zfile_fopen_2 (const TCHAR *name, const TCHAR *mode, int mask)
{
if (stat (l->name, &st) != -1)
l->size = st.st_size;
l->f = f;
- if (writeneeded (mode) && iszip (l, ZFD_ARCHIVE)) {
- zfile_fclose (l);
- return NULL;
- }
}
return l;
}
l = zfile_fopen_2 (path, mode, mask);
if (!l)
return 0;
- if (writeneeded (mode))
- return l;
l2 = NULL;
while (cnt-- > 0) {
int rc;
*retcode = 0;
if (index > 0)
return NULL;
+ if (zfile_needwrite (zf)) {
+ if (retcode)
+ *retcode = -1;
+ return NULL;
+ }
zv = getzvolume (parent, zf, id);
if (!zv)
return NULL;
struct zfile *archive_access_arcacc_select (struct zfile *zf, unsigned int id, int *retcode)
{
+ if (zfile_needwrite (zf)) {
+ if (retcode)
+ *retcode = -1;
+ return NULL;
+ }
return zf;
}