Thank you to anyone who has already donated - your generous donations helped make three months of treatment possible.
My brother Nate continues to fight stage IV Hodgkin's lymphoma. He's just 31, with a wife and baby girl. They have no active income (since he's been unable to return to work), no insurance, and cannot afford the treatment he needs. Nate and his family need your help. Please consider a donation, every dollar helps. Thanks.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 |
Index: apps/codecs/libgme/nes_apu.h =================================================================== --- apps/codecs/libgme/nes_apu.h (Revision 30397) +++ apps/codecs/libgme/nes_apu.h (Arbeitskopie) @@ -88,7 +88,7 @@ // 2) Triangle, 3) Noise, 4) DMC. static inline void Apu_osc_output( struct Nes_Apu* this, int osc, struct Blip_Buffer* buf ) { - assert( (unsigned) osc < apu_osc_count ); + this->oscs [osc]->output = buf; } Index: apps/codecs/libgme/nes_vrc7_apu.h =================================================================== --- apps/codecs/libgme/nes_vrc7_apu.h (Revision 30396) +++ apps/codecs/libgme/nes_vrc7_apu.h (Arbeitskopie) @@ -36,7 +36,7 @@ void output_changed( struct Nes_Vrc7_Apu* this ); static inline void Vrc7_set_output( struct Nes_Vrc7_Apu* this, int i, struct Blip_Buffer* buf ) { - assert( (unsigned) i < vrc7_osc_count ); + this->mask |= 1 << i; // Will use OPLL_setMask to mute voices Index: apps/codecs/libgme/sms_apu.c =================================================================== --- apps/codecs/libgme/sms_apu.c (Revision 30397) +++ apps/codecs/libgme/sms_apu.c (Arbeitskopie) @@ -302,5 +302,5 @@ run_until( this, end_time ); this->last_time -= end_time; - assert( this->last_time >= 0 ); + } Index: apps/codecs/libgme/nes_namco_apu.c =================================================================== --- apps/codecs/libgme/nes_namco_apu.c (Revision 30397) +++ apps/codecs/libgme/nes_namco_apu.c (Arbeitskopie) @@ -54,7 +54,7 @@ if ( time > this->last_time ) Namco_run_until( this, time ); - assert( this->last_time >= time ); + this->last_time -= time; } Index: apps/codecs/libgme/nes_namco_apu.h =================================================================== --- apps/codecs/libgme/nes_namco_apu.h (Revision 30397) +++ apps/codecs/libgme/nes_namco_apu.h (Arbeitskopie) @@ -56,7 +56,7 @@ static inline void Namco_osc_output( struct Nes_Namco_Apu* this, int i, struct Blip_Buffer* buf ) { - assert( (unsigned) i < namco_osc_count ); + this->oscs [i].output = buf; } Index: apps/codecs/libgme/ay_apu.c =================================================================== --- apps/codecs/libgme/ay_apu.c (Revision 30396) +++ apps/codecs/libgme/ay_apu.c (Arbeitskopie) @@ -139,7 +139,7 @@ void write_data_( struct Ay_Apu* this, int addr, int data ) { - assert( (unsigned) addr < ay_reg_count ); + /* if ( (unsigned) addr >= 14 ) dprintf( "Wrote to I/O port %02X\n", (int) addr ); */ @@ -305,7 +305,7 @@ // so we can avoid using last_amp every time to calculate the delta. int delta = amp * 2 - volume; int delta_non_zero = delta != 0; - int phase = osc->phase | (osc_mode & tone_off); assert( tone_off == 0x01 ); + int phase = osc->phase | (osc_mode & tone_off); do { // run noise @@ -403,11 +403,11 @@ if ( this->env_pos >= 0 ) this->env_pos = (this->env_pos & 31) - 32; remain -= count * env_period; - assert( -remain <= env_period ); + } this->env_delay = -remain; - assert( this->env_delay > 0 ); - assert( this->env_pos < 0 ); + + this->last_time = final_end_time; } Index: apps/codecs/libgme/sgc_emu.c =================================================================== --- apps/codecs/libgme/sgc_emu.c (Revision 30399) +++ apps/codecs/libgme/sgc_emu.c (Arbeitskopie) @@ -27,7 +27,7 @@ void Sgc_init( struct Sgc_Emu* this ) { - assert( offsetof (struct header_t,copyright [32]) == header_size ); + this->sample_rate = 0; this->mute_mask_ = 0; @@ -280,7 +280,7 @@ else { struct channel_t ch = Buffer_channel( &this->stereo_buf, i ); - assert( (ch.center && ch.left && ch.right) || + (!ch.center && !ch.left && !ch.right) ); // all or nothing Sound_set_voice( this, i, ch.center, ch.left, ch.right ); } @@ -472,7 +472,7 @@ int msec = Buffer_length( &this->stereo_buf ); blip_time_t clocks_emulated = msec * this->clock_rate_ / 1000 - 100; RETURN_ERR( run_clocks( this, &clocks_emulated, msec ) ); - assert( clocks_emulated ); + Buffer_end_frame( &this->stereo_buf, clocks_emulated ); } } Index: apps/codecs/libgme/ay_apu.h =================================================================== --- apps/codecs/libgme/ay_apu.h (Revision 30396) +++ apps/codecs/libgme/ay_apu.h (Arbeitskopie) @@ -61,7 +61,7 @@ static inline void Ay_apu_set_output( struct Ay_Apu* this, int i, struct Blip_Buffer* out ) { - assert( (unsigned) i < ay_osc_count ); + this->oscs [i].output = out; } @@ -73,7 +73,7 @@ run_until( this, time ); this->last_time -= time; - assert( this->last_time >= 0 ); + } #endif Index: apps/codecs/libgme/sgc_emu.h =================================================================== --- apps/codecs/libgme/sgc_emu.h (Revision 30397) +++ apps/codecs/libgme/sgc_emu.h (Arbeitskopie) @@ -175,7 +175,7 @@ // Must be called before set_sample_rate(). static inline void Sound_set_gain( struct Sgc_Emu* this, int g ) { - assert( !this->sample_rate ); // you must set gain before setting sample rate + this->gain = g; } Index: apps/codecs/libgme/kss_scc_apu.c =================================================================== --- apps/codecs/libgme/kss_scc_apu.c (Revision 30396) +++ apps/codecs/libgme/kss_scc_apu.c (Arbeitskopie) @@ -130,8 +130,8 @@ void Scc_write( struct Scc_Apu* this, blip_time_t time, int addr, int data ) { - //assert( (unsigned) addr < reg_count ); - assert( ( addr >= 0x9800 && addr <= 0x988F ) || ( addr >= 0xB800 && addr <= 0xB8AF ) ); + // + run_until( this, time ); addr -= 0x9800; @@ -162,5 +162,5 @@ run_until( this, end_time ); this->last_time -= end_time; - assert( this->last_time >= 0 ); + } Index: apps/codecs/libgme/vgm_emu.c =================================================================== --- apps/codecs/libgme/vgm_emu.c (Revision 30397) +++ apps/codecs/libgme/vgm_emu.c (Arbeitskopie) @@ -231,7 +231,7 @@ // Clear info memset( &this->info, 0, sizeof this->info ); - assert( offsetof (struct header_t,unused2 [8]) == header_size ); + if ( new_size <= header_size ) return gme_wrong_file_type; @@ -395,7 +395,7 @@ int msec = Buffer_length( &this->stereo_buf ); blip_time_t clocks_emulated = msec * this->clock_rate_ / 1000 - 100; RETURN_ERR( run_clocks( this, &clocks_emulated, msec ) ); - assert( clocks_emulated ); + Buffer_end_frame( &this->stereo_buf, clocks_emulated ); } } @@ -572,7 +572,7 @@ // to do: timing is working mostly by luck int min_pairs = (unsigned) sample_count / 2; int vgm_time = (min_pairs << fm_time_bits) / this->fm_time_factor - 1; - assert( to_fm_time( this, vgm_time ) <= min_pairs ); + int pairs; while ( (pairs = to_fm_time( this, vgm_time )) < min_pairs ) vgm_time++; @@ -687,7 +687,7 @@ else { struct channel_t ch = Buffer_channel( &this->stereo_buf, i ); - assert( (ch.center && ch.left && ch.right) || + (!ch.center && !ch.left && !ch.right) ); // all or nothing set_voice( this, i, ch.center, ch.left, ch.right ); } Index: apps/codecs/libgme/kss_scc_apu.h =================================================================== --- apps/codecs/libgme/kss_scc_apu.h (Revision 30397) +++ apps/codecs/libgme/kss_scc_apu.h (Arbeitskopie) @@ -37,7 +37,7 @@ static inline void Scc_set_output( struct Scc_Apu* this, int index, struct Blip_Buffer* b ) { - assert( (unsigned) index < scc_osc_count ); + this->oscs [index].output = b; } Index: apps/codecs/libgme/vgm_emu.h =================================================================== --- apps/codecs/libgme/vgm_emu.h (Revision 30397) +++ apps/codecs/libgme/vgm_emu.h (Arbeitskopie) @@ -199,7 +199,7 @@ // Must be called before set_sample_rate(). static inline void Sound_set_gain( struct Vgm_Emu* this, int g ) { - assert( !this->sample_rate ); // you must set gain before setting sample rate + this->gain = g; } Index: apps/codecs/libgme/kss_emu.c =================================================================== --- apps/codecs/libgme/kss_emu.c (Revision 30397) +++ apps/codecs/libgme/kss_emu.c (Arbeitskopie) @@ -118,7 +118,7 @@ { /* warning( core.warning() ); */ memset( &this->header, 0, sizeof this->header ); - assert( offsetof (header_t,msx_audio_vol) == header_size - 1 ); + RETURN_ERR( Rom_load( &this->rom, data, size, header_base_size, &this->header, 0 ) ); RETURN_ERR( check_kss_header( this->header.tag ) ); @@ -514,7 +514,7 @@ else { struct channel_t ch = Buffer_channel( &this->stereo_buf, i ); - assert( (ch.center && ch.left && ch.right) || + (!ch.center && !ch.left && !ch.right) ); // all or nothing set_voice( this, i, ch.center, ch.left, ch.right ); } @@ -706,7 +706,7 @@ int msec = Buffer_length( &this->stereo_buf ); blip_time_t clocks_emulated = msec * this->clock_rate_ / 1000 - 100; RETURN_ERR( run_clocks( this, &clocks_emulated ) ); - assert( clocks_emulated ); + Buffer_end_frame( &this->stereo_buf, clocks_emulated ); } } Index: apps/codecs/libgme/nsfe_info.c =================================================================== --- apps/codecs/libgme/nsfe_info.c (Revision 30397) +++ apps/codecs/libgme/nsfe_info.c (Arbeitskopie) @@ -111,7 +111,7 @@ { long offset = 0; int const nsfe_info_size = 16; - assert( offsetof (struct nsfe_info_t,unused [6]) == nsfe_info_size ); + // check header byte signature [4]; Index: apps/codecs/libgme/track_filter.c =================================================================== --- apps/codecs/libgme/track_filter.c (Revision 30397) +++ apps/codecs/libgme/track_filter.c (Arbeitskopie) @@ -197,7 +197,7 @@ // fill internal buffer and check it for silence void fill_buf( struct Track_Filter* this ) { - assert( !this->buf_remain ); + if ( !this->emu_track_ended_ ) { emu_play( this, this->buf, buf_size ); @@ -221,7 +221,7 @@ } else { - assert( this->emu_time >= this->out_time ); + // prints nifty graph of how far ahead we are when searching for silence //dprintf( "%*s \n", int ((emu_time - out_time) * 7 / 44100), "*" ); Index: apps/codecs/libgme/kss_emu.h =================================================================== --- apps/codecs/libgme/kss_emu.h (Revision 30397) +++ apps/codecs/libgme/kss_emu.h (Arbeitskopie) @@ -200,7 +200,7 @@ // Must be called before set_sample_rate(). static inline void Sound_set_gain( struct Kss_Emu* this, int g ) { - assert( !this->sample_rate ); // you must set gain before setting sample rate + this->gain = g; } Index: apps/codecs/libgme/nes_fme7_apu.h =================================================================== --- apps/codecs/libgme/nes_fme7_apu.h (Revision 30397) +++ apps/codecs/libgme/nes_fme7_apu.h (Arbeitskopie) @@ -48,7 +48,7 @@ static inline void Fme7_osc_output( struct Nes_Fme7_Apu* this, int i, struct Blip_Buffer* buf ) { - assert( (unsigned) i < fme7_osc_count ); + this->oscs [i].output = buf; } @@ -83,7 +83,7 @@ if ( time > this->last_time ) Fme7_run_until( this, time ); - assert( this->last_time >= time ); + this->last_time -= time; } Index: apps/codecs/libgme/blip_buffer.c =================================================================== --- apps/codecs/libgme/blip_buffer.c (Revision 30397) +++ apps/codecs/libgme/blip_buffer.c (Arbeitskopie) @@ -35,11 +35,11 @@ #ifndef NDEBUG // right shift of negative value preserves sign buf_t_ i = -0x7FFFFFFE; - assert( (i >> 1) == -0x3FFFFFFF ); + // casting to short truncates to 16 bits and sign-extends i = 0x18000; - assert( (short) i == -0x8000 ); + #endif Blip_clear( this ); @@ -90,7 +90,7 @@ blip_resampled_time_t Blip_clock_rate_factor( struct Blip_Buffer* this, int rate ) { int factor = (int) ( this->sample_rate_ * (1LL << BLIP_BUFFER_ACCURACY) / rate); - assert( factor > 0 || !this->sample_rate_ ); // fails if clock/output ratio is too large + return (blip_resampled_time_t) factor; } @@ -110,7 +110,7 @@ void Blip_end_frame( struct Blip_Buffer* this, blip_time_t t ) { this->offset_ += t * this->factor_; - assert( Blip_samples_avail( this ) <= (int) this->buffer_size_ ); // time outside buffer length + } int Blip_count_samples( struct Blip_Buffer* this, blip_time_t t ) Index: apps/codecs/libgme/blargg_endian.h =================================================================== --- apps/codecs/libgme/blargg_endian.h (Revision 30397) +++ apps/codecs/libgme/blargg_endian.h (Arbeitskopie) @@ -56,10 +56,10 @@ #ifndef NDEBUG #if BLARGG_BIG_ENDIAN volatile int i = 1; - assert( *(volatile char*) &i == 0 ); + #elif BLARGG_LITTLE_ENDIAN volatile int i = 1; - assert( *(volatile char*) &i != 0 ); + #endif #endif } Index: apps/codecs/libgme/gbs_emu.c =================================================================== --- apps/codecs/libgme/gbs_emu.c (Revision 30397) +++ apps/codecs/libgme/gbs_emu.c (Arbeitskopie) @@ -80,7 +80,7 @@ this->m3u.size = 0; clear_track_vars( this ); - assert( offsetof (struct header_t,copyright [32]) == header_size ); + RETURN_ERR( Rom_load( &this->rom, data, size, header_size, &this->header, 0 ) ); RETURN_ERR( check_gbs_header( &this->header ) ); @@ -250,7 +250,7 @@ int msec = Buffer_length( &this->stereo_buf ); blip_time_t clocks_emulated = msec * this->clock_rate_ / 1000 - 100; RETURN_ERR( run_clocks( this, clocks_emulated ) ); - assert( clocks_emulated ); + Buffer_end_frame( &this->stereo_buf, clocks_emulated ); } } @@ -300,7 +300,7 @@ else { struct channel_t ch = Buffer_channel( &this->stereo_buf, i ); - assert( (ch.center && ch.left && ch.right) || + (!ch.center && !ch.left && !ch.right) ); // all or nothing Apu_set_output( &this->apu, i, ch.center, ch.left, ch.right ); } Index: apps/codecs/libgme/blip_buffer.h =================================================================== --- apps/codecs/libgme/blip_buffer.h (Revision 30398) +++ apps/codecs/libgme/blip_buffer.h (Arbeitskopie) @@ -70,7 +70,7 @@ static inline delta_t* delta_at( struct Blip_Buffer *this, ufixed_t f ) { - assert( (f >> fixed_bits) < (unsigned) this->buffer_size_ ); + return this->buffer_center_ + (f >> fixed_bits); } @@ -82,7 +82,7 @@ static inline void Blip_remove_silence( struct Blip_Buffer* this, int count ) { - assert( count <= Blip_samples_avail( this ) ); // tried to remove more samples than available + this->offset_ -= (blip_resampled_time_t) count << BLIP_BUFFER_ACCURACY; } Index: apps/codecs/libgme/gbs_emu.h =================================================================== --- apps/codecs/libgme/gbs_emu.h (Revision 30397) +++ apps/codecs/libgme/gbs_emu.h (Arbeitskopie) @@ -164,7 +164,7 @@ // Must be called before set_sample_rate(). static inline void Sound_set_gain( struct Gbs_Emu* this, int g ) { - assert( !this->sample_rate_ ); // you must set gain before setting sample rate + this->gain_ = g; } Index: apps/codecs/libgme/resampler.c =================================================================== --- apps/codecs/libgme/resampler.c (Revision 30397) +++ apps/codecs/libgme/resampler.c (Arbeitskopie) @@ -138,12 +138,12 @@ static inline int resample_wrapper( struct Resampler* this, dsample_t out [], int* out_size, dsample_t const in [], int in_size ) { - assert( Resampler_rate( this ) ); + dsample_t* out_ = out; int result = resample_( this, &out_, out + *out_size, in, in_size ) - in; - assert( out_ <= out + *out_size ); - assert( result <= in_size ); + + *out_size = out_ - out; return result; @@ -168,18 +168,18 @@ int sample_count = this->oversamples_per_frame - this->write_pos + resampler_extra; int new_count = this->callback( this->callback_data, blip_time, sample_count, &this->buf [this->write_pos] ); - assert( new_count < this->resampler_size ); + Blip_end_frame( blip_buf, blip_time ); - assert( Blip_samples_avail( blip_buf ) == pair_count ); + this->write_pos += new_count; - assert( (unsigned) this->write_pos <= this->buffer_size ); + int count = this->sample_buf_size; if ( count ) skip_input( this, resample_wrapper( this, this->sample_buf, &count, this->buf, this->write_pos ) ); - assert( count == this->sample_buf_size ); + mix_samples( this, blip_buf, out ); Blip_remove_samples( blip_buf, pair_count ); Index: apps/codecs/libgme/nes_vrc6_apu.c =================================================================== --- apps/codecs/libgme/nes_vrc6_apu.c (Revision 30397) +++ apps/codecs/libgme/nes_vrc6_apu.c (Arbeitskopie) @@ -74,7 +74,7 @@ if ( time > this->last_time ) Vrc6_run_until( this, time ); - assert( this->last_time >= time ); + this->last_time -= time; } Index: apps/codecs/libgme/nes_fds_apu.h =================================================================== --- apps/codecs/libgme/nes_fds_apu.h (Revision 30396) +++ apps/codecs/libgme/nes_fds_apu.h (Arbeitskopie) @@ -64,7 +64,7 @@ (void) i; #endif - assert( (unsigned) i < fds_osc_count ); + this->output_ = b; } @@ -74,7 +74,7 @@ if ( end_time > this->last_time ) Fds_run_until( this, end_time ); this->last_time -= end_time; - assert( this->last_time >= 0 ); + } void Fds_write_( struct Nes_Fds_Apu* this, unsigned addr, int data ); Index: apps/codecs/libgme/nes_vrc6_apu.h =================================================================== --- apps/codecs/libgme/nes_vrc6_apu.h (Revision 30397) +++ apps/codecs/libgme/nes_vrc6_apu.h (Arbeitskopie) @@ -48,7 +48,7 @@ static inline void Vrc6_osc_output( struct Nes_Vrc6_Apu* this, int i, struct Blip_Buffer* buf ) { - assert( (unsigned) i < vrc6_osc_count ); + this->oscs [i].output = buf; } Index: apps/codecs/libgme/hes_emu.c =================================================================== --- apps/codecs/libgme/hes_emu.c (Revision 30397) +++ apps/codecs/libgme/hes_emu.c (Arbeitskopie) @@ -78,7 +78,7 @@ this->m3u.size = 0; clear_track_vars( this ); - assert( offsetof (struct header_t,unused [4]) == header_size ); + RETURN_ERR( Rom_load( &this->rom, data, size, header_size, &this->header, unmapped ) ); RETURN_ERR( check_hes_header( this->header.tag ) ); @@ -442,7 +442,7 @@ int msec = Buffer_length( &this->stereo_buf ); blip_time_t clocks_emulated = msec * this->clock_rate_ / 1000 - 100; RETURN_ERR( run_clocks( this, &clocks_emulated ) ); - assert( clocks_emulated ); + Buffer_end_frame( &this->stereo_buf, clocks_emulated ); } } @@ -499,7 +499,7 @@ else { struct channel_t ch = Buffer_channel( &this->stereo_buf, i ); - assert( (ch.center && ch.left && ch.right) || + (!ch.center && !ch.left && !ch.right) ); // all or nothing Apu_osc_output( &this->apu, i, ch.center, ch.left, ch.right ); } Index: apps/codecs/libgme/sms_fm_apu.c =================================================================== --- apps/codecs/libgme/sms_fm_apu.c (Revision 30396) +++ apps/codecs/libgme/sms_fm_apu.c (Arbeitskopie) @@ -39,7 +39,7 @@ void fm_run_until( struct Sms_Fm_Apu* this, blip_time_t end_time ) { - assert( end_time > this->next_time ); + struct Blip_Buffer* const output = this->output_; if ( !output ) @@ -75,7 +75,7 @@ fm_run_until( this, time ); this->next_time -= time; - assert( this->next_time >= 0 ); + if ( this->output_ ) Blip_set_modified( this->output_ ); Index: apps/codecs/libgme/hes_emu.h =================================================================== --- apps/codecs/libgme/hes_emu.h (Revision 30397) +++ apps/codecs/libgme/hes_emu.h (Arbeitskopie) @@ -175,7 +175,7 @@ // Must be called before set_sample_rate(). static inline void Sound_set_gain( struct Hes_Emu* this, int g ) { - assert( !this->sample_rate_ ); // you must set gain before setting sample rate + this->gain_ = g; } Index: apps/codecs/libgme/nsf_emu.c =================================================================== --- apps/codecs/libgme/nsf_emu.c (Revision 30397) +++ apps/codecs/libgme/nsf_emu.c (Arbeitskopie) @@ -73,7 +73,7 @@ static void append_voices( struct Nsf_Emu* this, int const types [], int count ) { - assert( this->voice_count + count < max_voices ); + int i; for ( i = 0; i < count; i++ ) { this->voice_types [this->voice_count + i] = types [i]; @@ -262,7 +262,7 @@ this->voice_count = 0; clear_track_vars( this ); - assert( offsetof (struct header_t,unused [4]) == header_size ); + if ( !memcmp( data, "NESM\x1A", 5 ) ) { Nsf_disable_playlist( this, true ); @@ -495,7 +495,7 @@ else { struct channel_t ch = Buffer_channel( &this->stereo_buf, i ); - assert( (ch.center && ch.left && ch.right) || + (!ch.center && !ch.left && !ch.right) ); // all or nothing set_voice( this, i, ch.center, ch.left, ch.right ); } @@ -903,7 +903,7 @@ int msec = Buffer_length( &this->stereo_buf ); blip_time_t clocks_emulated = msec * this->clock_rate__ / 1000 - 100; RETURN_ERR( run_clocks( this, &clocks_emulated, msec ) ); - assert( clocks_emulated ); + Buffer_end_frame( &this->stereo_buf, clocks_emulated ); } } Index: apps/codecs/libgme/nsf_emu.h =================================================================== --- apps/codecs/libgme/nsf_emu.h (Revision 30397) +++ apps/codecs/libgme/nsf_emu.h (Arbeitskopie) @@ -201,7 +201,7 @@ // Must be called before set_sample_rate(). static inline void Sound_set_gain( struct Nsf_Emu* this, int g ) { - assert( !this->sample_rate ); // you must set gain before setting sample rate + this->gain = g; } Index: apps/codecs/libgme/opl_apu.h =================================================================== --- apps/codecs/libgme/opl_apu.h (Revision 30397) +++ apps/codecs/libgme/opl_apu.h (Arbeitskopie) @@ -46,7 +46,7 @@ #if defined(ROCKBOX) (void) i; #endif - assert( (unsigned) i < opl_osc_count ); + this->output_ = buf; } Index: apps/codecs/libgme/ym2612_emu.c =================================================================== --- apps/codecs/libgme/ym2612_emu.c (Revision 30397) +++ apps/codecs/libgme/ym2612_emu.c (Arbeitskopie) @@ -487,8 +487,8 @@ void impl_reset( struct Ym2612_Impl* impl ); static void impl_set_rate( struct Ym2612_Impl* impl, double sample_rate, double clock_rate ) { - assert( sample_rate ); - assert( !clock_rate || clock_rate > sample_rate ); + + int i; @@ -700,7 +700,7 @@ static inline void write0( struct Ym2612_Impl* impl, int opn_addr, int data ) { - assert( (unsigned) data <= 0xFF ); + if ( opn_addr < 0x30 ) { @@ -720,7 +720,7 @@ static inline void write1( struct Ym2612_Impl* impl, int opn_addr, int data ) { - assert( (unsigned) data <= 0xFF ); + if ( opn_addr >= 0x30 && impl->YM2612.REG [1] [opn_addr] != data ) { Index: apps/codecs/libgme/gb_oscs.c =================================================================== --- apps/codecs/libgme/gb_oscs.c (Revision 30396) +++ apps/codecs/libgme/gb_oscs.c (Arbeitskopie) @@ -379,7 +379,7 @@ void write_osc( struct Gb_Apu* this, int reg, int old_data, int data ) { int index = (reg * 3 + 3) >> 4; // avoids divide - assert( index == reg / 5 ); + reg -= index * 5; switch ( index ) { Index: apps/codecs/libgme/ay_emu.c =================================================================== --- apps/codecs/libgme/ay_emu.c (Revision 30397) +++ apps/codecs/libgme/ay_emu.c (Arbeitskopie) @@ -70,7 +70,7 @@ int offset = (int16_t) get_be16( ptr ); int pos = ptr - (byte const*) file->header; int size = file->end - (byte const*) file->header; - assert( (unsigned) pos <= (unsigned) size - 2 ); + int limit = size - min_size; if ( limit < 0 || !offset || (unsigned) (pos + offset) > (unsigned) limit ) return NULL; @@ -111,7 +111,7 @@ this->m3u.size = 0; clear_track_vars( this ); - assert( offsetof (struct header_t,track_info [2]) == header_size ); + RETURN_ERR( parse_header( in, size, &this->file ) ); @@ -316,7 +316,7 @@ else { struct channel_t ch = Buffer_channel( &this->stereo_buf, i ); - assert( (ch.center && ch.left && ch.right) || + (!ch.center && !ch.left && !ch.right) ); // all or nothing set_voice( this, i, ch.center ); } @@ -591,7 +591,7 @@ int msec = Buffer_length( &this->stereo_buf ); blip_time_t clocks_emulated = msec * this->clock_rate_ / 1000 - 100; RETURN_ERR( run_clocks( this, &clocks_emulated, msec ) ); - assert( clocks_emulated ); + Buffer_end_frame( &this->stereo_buf, clocks_emulated ); } } Index: apps/codecs/libgme/hes_cpu_run.h =================================================================== --- apps/codecs/libgme/hes_cpu_run.h (Revision 30397) +++ apps/codecs/libgme/hes_cpu_run.h (Arbeitskopie) @@ -1273,7 +1273,7 @@ illegal_encountered = true; goto loop; } - assert( false ); // catch missing 'goto loop' or accidental 'break' + int result_; handle_brk: Index: apps/codecs/libgme/z80_cpu_run.h =================================================================== --- apps/codecs/libgme/z80_cpu_run.h (Revision 30396) +++ apps/codecs/libgme/z80_cpu_run.h (Arbeitskopie) @@ -1044,7 +1044,7 @@ R8( data & 7, 0 ) &= ~(1 << (data >> 3 & 7)); goto loop; } - assert( false ); + } #undef GET_ADDR @@ -1316,7 +1316,7 @@ warning = true; goto loop; } - assert( false ); + } //////////////////////////////////////// DD/FD prefix @@ -1576,7 +1576,7 @@ warning = true; goto loop; } - assert( false ); + } // INC/DEC @@ -1666,12 +1666,12 @@ pc--; goto loop; } - assert( false ); + } } dprintf( "Unhandled main opcode: $%02X\n", opcode ); - assert( false ); + #ifdef IDLE_ADDR hit_idle_addr: Index: apps/codecs/libgme/blargg_source.h =================================================================== --- apps/codecs/libgme/blargg_source.h (Revision 30397) +++ apps/codecs/libgme/blargg_source.h (Arbeitskopie) @@ -7,8 +7,6 @@ // module. A failed requirement indicates a bug outside the module. // void #if defined(ROCKBOX) -#undef assert -#define assert( expr ) #undef require #define require( expr ) #else Index: apps/codecs/libgme/hes_apu.c =================================================================== --- apps/codecs/libgme/hes_apu.c (Revision 30397) +++ apps/codecs/libgme/hes_apu.c (Arbeitskopie) @@ -364,7 +364,7 @@ osc--; if ( end_time > osc->last_time ) run_osc( osc, &this->synth, end_time ); - assert( osc->last_time >= end_time ); + osc->last_time -= end_time; } while ( osc != this->oscs ); Index: apps/codecs/libgme/ay_emu.h =================================================================== --- apps/codecs/libgme/ay_emu.h (Revision 30397) +++ apps/codecs/libgme/ay_emu.h (Arbeitskopie) @@ -151,7 +151,7 @@ // Must be called before set_sample_rate(). static inline void Sound_set_gain( struct Ay_Emu* this, int g ) { - assert( !this->sample_rate ); // you must set gain before setting sample rate + this->gain = g; } Index: apps/codecs/libgme/nes_cpu_run.h =================================================================== --- apps/codecs/libgme/nes_cpu_run.h (Revision 30396) +++ apps/codecs/libgme/nes_cpu_run.h (Arbeitskopie) @@ -1053,7 +1053,7 @@ } goto loop; } - assert( false ); // catch missing 'goto loop' or accidental 'break' + int result_; handle_brk: Index: apps/codecs/libgme/gb_cpu_run.h =================================================================== --- apps/codecs/libgme/gb_cpu_run.h (Revision 30396) +++ apps/codecs/libgme/gb_cpu_run.h (Arbeitskopie) @@ -568,7 +568,7 @@ goto loop; } // CB op - assert( false ); // unhandled CB op + case 0x07: // RLCA cz = RG.a >> 7; @@ -1168,7 +1168,7 @@ } // If this fails then an opcode isn't handled above - assert( false ); + require( false ); stop: pc--; Index: apps/codecs/libgme/hes_cpu.h =================================================================== --- apps/codecs/libgme/hes_cpu.h (Revision 30397) +++ apps/codecs/libgme/hes_cpu.h (Arbeitskopie) @@ -113,7 +113,7 @@ static inline void Cpu_end_frame( struct Hes_Cpu* this, hes_time_t t ) { - assert( this->cpu_state == &this->cpu_state_ ); + require( this->cpu_state == &this->cpu_state_ ); this->cpu_state_.base -= t; if ( this->irq_time_ < future_time ) this->irq_time_ -= t; if ( this->end_time_ < future_time ) this->end_time_ -= t; @@ -121,8 +121,8 @@ static inline void Cpu_set_mmr( struct Hes_Cpu* this, int reg, int bank, void const* code ) { - assert( (unsigned) reg <= page_count ); // allow page past end to be set - assert( (unsigned) bank < 0x100 ); + require( (unsigned) reg <= page_count ); // allow page past end to be set + require( (unsigned) bank < 0x100 ); this->mmr [reg] = bank; byte const* p = STATIC_CAST(byte const*,code) - HES_CPU_OFFSET( reg << page_bits ); this->cpu_state->code_map [reg] = p; Index: apps/codecs/libgme/nes_vrc7_apu.c =================================================================== --- apps/codecs/libgme/nes_vrc7_apu.c (Revision 30396) +++ apps/codecs/libgme/nes_vrc7_apu.c (Arbeitskopie) @@ -56,7 +56,7 @@ Vrc7_run_until( this, time ); this->next_time -= time; - assert( this->next_time >= 0 ); + require( this->next_time >= 0 ); if ( this->osc.output ) Blip_set_modified( this->osc.output ); Index: apps/codecs/libgme/gb_apu.c =================================================================== --- apps/codecs/libgme/gb_apu.c (Revision 30396) +++ apps/codecs/libgme/gb_apu.c (Arbeitskopie) @@ -211,7 +211,7 @@ break; // run frame sequencer - assert( this->frame_period ); + require( this->frame_period ); this->frame_time += this->frame_period * clk_mul; switch ( this->frame_phase++ ) { @@ -255,10 +255,10 @@ run_until( this, end_time ); this->frame_time -= end_time; - assert( this->frame_time >= 0 ); + require( this->frame_time >= 0 ); this->last_time -= end_time; - assert( this->last_time >= 0 ); + require( this->last_time >= 0 ); } static void silence_osc( struct Gb_Apu* this, struct Gb_Osc* o ) |