/* testSTK26() */ /* Rip_STK26() */ /* Depack_STK26() */ #include "globals.h" #include "extern.h" /* Soundtracker 2.6 & IceTracker 1.0 */ int16_t testSTK26 ( void ) { /* test 1 */ if ( PW_i < 1464 ) { return BAD; } /* test 2 */ PW_Start_Address = PW_i-1464; PW_WholeSampleSize = 0; for ( PW_j=0 ; PW_j<31 ; PW_j++ ) { if ( in_data[PW_Start_Address+45+30*PW_j] > 0x40 ) { /* printf ( "#1\n" );*/ return BAD; } if ( in_data[PW_Start_Address+44+30*PW_j] > 0x0F ) { /* printf ( "#2\n" );*/ return BAD; } PW_WholeSampleSize += (((in_data[PW_Start_Address+42+PW_j*30]*256)+ in_data[PW_Start_Address+43+PW_j*30])*2); } /* PW_WholeSampleSize is the whole sample size :) */ return GOOD; } void Rip_STK26 ( void ) { /* PW_WholeSampleSize is the whole sample siz */ OutputSize = (in_data[PW_Start_Address+951]*256) + 1468 + PW_WholeSampleSize; CONVERT = GOOD; if ( in_data[PW_Start_Address+1464] == 'M' ) { Save_Rip ( "Sountracker 2.6 module", STK26 ); } else { Save_Rip ( "IceTracker 1.0 modul", IceTracker ); } if ( Save_Status == GOOD ) PW_i += (OutputSize - 1470); /* 1464 should do but call it "just to be sure" :) */ } /* * STK26.c 1999 (c) Asle / ReDoX * * * handles Soundtracker 2.6 and IceTracker 1.0 file * convert them back to PTK * * Update: 19/04/00 * - forced 7F value to NTK byte * Update: 29/05/02 * - above update was bugged ... great. */ void Depack_STK26 ( void ) { uint8_t *Whatever; int32_t WholeSampleSize=0; int32_t Where=PW_Start_Address; int32_t i=0,j,k; FILE *out; if ( Save_Status == BAD ) return; sprintf ( Depacked_OutName , "%d.mod" , Cpt_Filename-1 ); out = PW_fopen ( Depacked_OutName , "w+b" ); /* read and write whole header */ fwrite ( &in_data[Where] , 952 , 1 , out ); /* get whole sample size */ for ( i=0 ; i<31 ; i++ ) WholeSampleSize += (((in_data[Where+42+i*30]*256)+in_data[Where+43+i*30])*2); /* printf ( "Whole sanple size : %ld\n" , WholeSampleSize );*/ /* generate patlist */ Whatever = (uint8_t *) malloc (1536); BZERO ( Whatever , 1536 ); Whatever[1024] = in_data[Where+950]; for ( i=0 ; i