| 605 | } |
| 606 | |
| 607 | static void LoadFM2_binarychunk(MovieData& movieData, EMUFILE* fp, int size) |
| 608 | { |
| 609 | int recordsize = 1; //1 for the command |
| 610 | if(movieData.fourscore) |
| 611 | recordsize += 4; //4 joysticks |
| 612 | else |
| 613 | { |
| 614 | for(int i=0;i<2;i++) |
| 615 | { |
| 616 | switch(movieData.ports[i]) |
| 617 | { |
| 618 | case SI_GAMEPAD: recordsize++; break; |
| 619 | case SI_ZAPPER: recordsize+=12; break; |
| 620 | } |
| 621 | } |
| 622 | } |
| 623 | |
| 624 | //find out how much remains in the file |
| 625 | int curr = fp->ftell(); |
| 626 | fp->fseek(0,SEEK_END); |
| 627 | int end = fp->ftell(); |
| 628 | int flen = end-curr; |
| 629 | fp->fseek(curr,SEEK_SET); |
| 630 | |
| 631 | //the amount todo is the min of the limiting size we received and the remaining contents of the file |
| 632 | int todo = std::min<int>(size, flen); |
| 633 | |
| 634 | int numRecords = todo/recordsize; |
| 635 | if (movieData.loadFrameCount!=-1 && movieData.loadFrameCount<numRecords) |
| 636 | numRecords=movieData.loadFrameCount; |
| 637 | |
| 638 | movieData.records.resize(numRecords); |
| 639 | for(int i=0;i<numRecords;i++) |
| 640 | { |
| 641 | movieData.records[i].parseBinary(&movieData,fp); |
| 642 | } |
| 643 | } |
| 644 | |
| 645 | //yuck... another custom text parser. |
| 646 | bool LoadFM2(MovieData& movieData, EMUFILE* fp, int size, bool stopAfterHeader) |
no test coverage detected