/* (31 mar 2003) */ /* testAmBk() */ /* Rip_AmBk() */ /* Depack_AmBk() */ #include "globals.h" #include "extern.h" short testAmBk ( void ) { if (PW_i + 68 > PW_in_size) { return BAD; } /* test #1 */ PW_Start_Address = PW_i; if ((in_data[PW_Start_Address+4] != 0x00)|| (in_data[PW_Start_Address+5] != 0x03)|| (in_data[PW_Start_Address+6] != 0x00)|| (in_data[PW_Start_Address+7] > 0x01)|| (in_data[PW_Start_Address+12]!= 'M')|| (in_data[PW_Start_Address+13]!= 'u')|| (in_data[PW_Start_Address+14]!= 's')|| (in_data[PW_Start_Address+15]!= 'i')|| (in_data[PW_Start_Address+16]!= 'c')|| (in_data[PW_Start_Address+17]!= ' ')|| (in_data[PW_Start_Address+18]!= ' ')|| (in_data[PW_Start_Address+19]!= ' ')) { /*printf ( "#1 Start:%ld\n" , PW_Start_Address );*/ return BAD; } /* get the whole size */ PW_k = (in_data[PW_Start_Address+9]*256*256)+(in_data[PW_Start_Address+10]*256)+in_data[PW_Start_Address+11]+12; if ( PW_k+PW_Start_Address > PW_in_size ) { /*printf ( "#1 Start:%ld\n" , PW_Start_Address );*/ return BAD; } return GOOD; } /* Rip_AmBk */ void Rip_AmBk ( void ) { /* PW_k is already the whole file size */ OutputSize = PW_k; CONVERT = GOOD; Save_Rip ( "AMOS Bank (AmBk)", AmBk ); if ( Save_Status == GOOD ) PW_i += 4; } /* * ambk.c mar 2003 (c) Asle / ReDoX * * based in Kyz description ... thx !. * */ void Depack_AmBk ( void ) { /*Uchar c1,c2,c3,c4;*/ Uchar *Whatever,*address; Uchar poss[37][2]; /*Uchar Note,Smp,Fx,FxVal;*/ long i,j,k; long Where = PW_Start_Address; long INST_HDATA_ADDY,SONGS_DATA_ADDY,PAT_DATA_ADDY;/*,INST_DATA_ADDY;*/ long BANK_LEN; long smps_addys[31],smp_sizes[31]; FILE *out; if ( Save_Status == BAD ) return; sprintf ( Depacked_OutName , "%ld.mod" , Cpt_Filename-1 ); out = PW_fopen ( Depacked_OutName , "w+b" ); fillPTKtable(poss); Whatever = (Uchar *) malloc (1024); BZERO (Whatever,1024); BANK_LEN = ((in_data[Where + 0x09]*256*256)+ (in_data[Where + 0x0a]*256)+ in_data[Where + 0x0b]) + 0x0c; INST_HDATA_ADDY = ((in_data[Where + 0x14]*256*256*256)+ (in_data[Where + 0x15]*256*256)+ (in_data[Where + 0x16]*256)+ in_data[Where + 0x17]) + 0x14; SONGS_DATA_ADDY = ((in_data[Where + 0x18]*256*256*256)+ (in_data[Where + 0x19]*256*256)+ (in_data[Where + 0x1A]*256)+ in_data[Where + 0x1B]) + 0x14; PAT_DATA_ADDY = ((in_data[Where + 0x1C]*256*256*256)+ (in_data[Where + 0x1D]*256*256)+ (in_data[Where + 0x1E]*256)+ in_data[Where + 0x1F]) +0x14; /* title stuff */ Where = PW_Start_Address + SONGS_DATA_ADDY; j = in_data[Where]*256 + in_data[Where+1]; /* number of songs */ if ( j > 1 ) { printf ( "\n!!! unsupported feature in depack_AmBk() - send this file to asle@free.fr !\n" ); return; } j = ((in_data[Where+2]*256*256*256)+(in_data[Where+3]*256*256)+(in_data[Where+4]*256)+in_data[Where+5]); fwrite ( &in_data[Where + j + 0x0c], 16, 1, out ); fwrite ( Whatever, 4, 1, out ); Where = PW_Start_Address + INST_HDATA_ADDY; /*printf ( "\naddy of instrument headers : %ld\n", Where );*/ /* samples header + data */ j = (in_data[Where]*256) + in_data[Where+1]; /* nbr of samples */ /*printf ( "nbr of samples : %ld\n", j );*/ Where += 2; for ( i=0 ; i