Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void D64::extractFile(int number, string extracted, BYTE d64_array[])
- {
- fstream prg(extracted, ios::in | ios::out | ios::binary | ios::app);
- int numberEntry = 32*(number-1);
- int nextBlock = getNextBlock(d64_array);
- if(getType(d64_array, numberEntry) == 1)
- {
- if(nextBlock != 0)
- {
- numberEntry = ((nextBlock-1)*256) + ((number-9)*32);
- }
- }
- BYTE* name = getName(d64_array, numberEntry);
- int track = getTrack(d64_array, numberEntry);
- int sect = getSector(d64_array, numberEntry);
- int size = getSize(d64_array, numberEntry);
- BYTE prgArray[(size*256)+1];
- cout << "extracting " << name << " to " << extracted << endl;
- if(track >= 1 && track <= 17)
- {
- int block = 0;
- int count = 0;
- int next = 0;
- int position = 0;
- int tmp = 0;
- int loop = 254;
- int endOfFile = 1;
- int print;
- while(1)
- {
- endOfFile = (d64_array[(track1_17 * (track-1)) + (sect * sectorSize) + block]);
- if(endOfFile == 0)
- {
- loop = (d64_array[(track1_17 * (track-1)) + (sect * sectorSize) + 1 + block]);
- }
- for(int i = 0; i < loop; i++)
- {
- prgArray[i+next] = d64_array[(track1_17 * (track-1)) + (sect * sectorSize) + 2 + i + block];
- }
- if(loop != 254)
- {
- break;
- }
- tmp = position;
- position = (d64_array[(track1_17 * (track-1)) + (sect * sectorSize) + 1 + block]);
- block = block + ((position-tmp) * 256);
- cout << block << endl;
- count++;
- next = next+254;
- }
- print = (((size - 1) * 254) + (loop-1));
- for(int i = 0; i < print; i++)
- {
- prg << prgArray[i];
- }
- }
- else if(track >= 18 && track <= 24)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement