src/osd/windows/d3dhlsl.c
| r11928 | r11929 | |
| 85 | 85 | static hlsl_options g_hlsl_presets[4] = |
| 86 | 86 | { |
| 87 | 87 | { // 25% Shadow mask, 50% Scanlines, 3% Pincushion, 0 defocus, No Tint, 0.9 Exponent, 5% Floor, 25% Phosphor Return, 120% Saturation |
| 88 | | 0.25f, 320, 240, 0.09375f, 0.109375f, |
| 88 | true, |
| 89 | 0.25f, { "aperture.png" }, 320, 240, 0.09375f, 0.109375f, |
| 89 | 90 | 0.03f, 0.03f, |
| 90 | 91 | 0.5f, 1.0f, 0.5f, 1.0f, 0.0f, 0.0f, |
| 91 | 92 | { 0.0f, 0.0f, 0.0f, 0.0f }, |
| r11928 | r11929 | |
| 102 | 103 | { 0.05f,0.05f,0.05f}, |
| 103 | 104 | { 0.25f,0.25f,0.25f}, |
| 104 | 105 | 1.2f, |
| 106 | false, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0 |
| 105 | 107 | }, |
| 106 | 108 | { // 25% Shadow mask, 0% Scanlines, 3% Pincushion, 0 defocus, No Tint, 0.9 Exponent, 5% Floor, 25% Phosphor Return, 120% Saturation |
| 107 | | 0.25f, 320, 240, 0.09375f, 0.109375f, |
| 109 | true, |
| 110 | 0.25f, { "aperture.png" }, 320, 240, 0.09375f, 0.109375f, |
| 108 | 111 | 0.03f, 0.03f, |
| 109 | 112 | 0.0f, 1.0f, 0.5f, 1.0f, 0.0f, 0.0f, |
| 110 | 113 | { 0.0f, 0.0f, 0.0f, 0.0f }, |
| r11928 | r11929 | |
| 121 | 124 | { 0.05f,0.05f,0.05f}, |
| 122 | 125 | { 0.25f,0.25f,0.25f}, |
| 123 | 126 | 1.2f, |
| 127 | false, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0 |
| 124 | 128 | }, |
| 125 | 129 | { // 25% Shadow mask, 0% Scanlines, 0% Pincushion, 0 defocus, No Tint, 0.9 Exponent, 5% Floor, 25% Phosphor Return, 120% Saturation |
| 126 | | 0.25f, 320, 240, 0.09375f, 0.109375f, |
| 130 | true, |
| 131 | 0.25f, { "aperture.png" }, 320, 240, 0.09375f, 0.109375f, |
| 127 | 132 | 0.0f, 0.0f, |
| 128 | 133 | 0.0f, 1.0f, 0.5f, 1.0f, 0.0f, 0.0f, |
| 129 | 134 | { 0.0f, 0.0f, 0.0f, 0.0f }, |
| r11928 | r11929 | |
| 140 | 145 | { 0.05f,0.05f,0.05f}, |
| 141 | 146 | { 0.25f,0.25f,0.25f}, |
| 142 | 147 | 1.2f, |
| 148 | false, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0 |
| 143 | 149 | }, |
| 144 | 150 | { // 25% Shadow mask, 100% Scanlines, 15% Pincushion, 3 defocus, 24-degree Tint Out, 1.5 Exponent, 5% Floor, 70% Phosphor Return, 80% Saturation, Bad Convergence |
| 145 | | 0.25f, 320, 240, 0.09375f, 0.109375f, |
| 151 | true, |
| 152 | 0.25f, { "aperture.png" }, 320, 240, 0.09375f, 0.109375f, |
| 146 | 153 | 0.15f, 0.15f, |
| 147 | 154 | 1.0f, 1.0f, 0.5f, 1.0f, 0.0f, 0.5f, |
| 148 | 155 | { 3.0f, 3.0f, 3.0f, 3.0f }, |
| r11928 | r11929 | |
| 159 | 166 | { 0.05f,0.05f,0.05f}, |
| 160 | 167 | { 0.7f, 0.7f, 0.7f}, |
| 161 | 168 | 0.8f, |
| 169 | false, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0 |
| 162 | 170 | }, |
| 163 | 171 | }; |
| 164 | 172 | |
| r11928 | r11929 | |
| 171 | 179 | //============================================================ |
| 172 | 180 | |
| 173 | 181 | static void get_vector(const char *data, int count, float *out, int report_error); |
| 174 | | static file_error open_next(d3d_info *d3d, emu_file &file, const char *extension, int idx); |
| 182 | static file_error open_next(d3d_info *d3d, emu_file &file, const char *templ, const char *extension, int idx); |
| 175 | 183 | |
| 176 | 184 | |
| 177 | 185 | |
| r11928 | r11929 | |
| 182 | 190 | hlsl_info::hlsl_info() |
| 183 | 191 | { |
| 184 | 192 | master_enable = false; |
| 185 | | yiq_enable = false; |
| 186 | 193 | prescale_size_x = 1; |
| 187 | 194 | prescale_size_y = 1; |
| 195 | prescale_force_x = 0; |
| 196 | prescale_force_y = 0; |
| 188 | 197 | preset = -1; |
| 189 | 198 | shadow_bitmap = NULL; |
| 190 | 199 | shadow_texture = NULL; |
| 191 | 200 | registered_targets = 0; |
| 192 | 201 | options = NULL; |
| 193 | | |
| 194 | 202 | } |
| 195 | 203 | |
| 196 | 204 | |
| r11928 | r11929 | |
| 383 | 391 | int idx = cy * 2 + cx; |
| 384 | 392 | |
| 385 | 393 | emu_file file(window->machine().options().snapshot_directory(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); |
| 386 | | file_error filerr = open_next(d3d, file, "png", idx); |
| 394 | file_error filerr = open_next(d3d, file, NULL, "png", idx); |
| 387 | 395 | if (filerr != FILERR_NONE) |
| 388 | 396 | return; |
| 389 | 397 | |
| r11928 | r11929 | |
| 553 | 561 | } |
| 554 | 562 | else |
| 555 | 563 | { |
| 556 | | filerr = open_next(d3d, tempfile, "avi", 0); |
| 564 | filerr = open_next(d3d, tempfile, NULL, "avi", 0); |
| 557 | 565 | } |
| 558 | 566 | |
| 559 | 567 | // compute the frame time |
| r11928 | r11929 | |
| 592 | 600 | d3d_info *d3d = (d3d_info *)window->drawdata; |
| 593 | 601 | |
| 594 | 602 | (*d3dintf->effect.set_texture)(effect, "Diffuse", (texture == NULL) ? d3d->default_texture->d3dfinaltex : texture->d3dfinaltex); |
| 595 | | if (yiq_enable) |
| 603 | if (options->yiq_enable) |
| 596 | 604 | (*d3dintf->effect.set_texture)(yiq_encode_effect, "Diffuse", (texture == NULL) ? d3d->default_texture->d3dfinaltex : texture->d3dfinaltex); |
| 597 | 605 | else |
| 598 | 606 | (*d3dintf->effect.set_texture)(color_effect, "Diffuse", (texture == NULL) ? d3d->default_texture->d3dfinaltex : texture->d3dfinaltex); |
| r11928 | r11929 | |
| 613 | 621 | this->window = window; |
| 614 | 622 | |
| 615 | 623 | master_enable = downcast<windows_options &>(window->machine().options()).d3d_hlsl_enable(); |
| 616 | | yiq_enable = downcast<windows_options &>(window->machine().options()).screen_yiq_enable(); |
| 617 | 624 | prescale_size_x = 1; |
| 618 | 625 | prescale_size_y = 1; |
| 619 | 626 | preset = downcast<windows_options &>(window->machine().options()).d3d_hlsl_preset(); |
| 620 | | printf("%d\n", preset); |
| 621 | 627 | |
| 622 | 628 | snap_width = downcast<windows_options &>(window->machine().options()).d3d_snap_width(); |
| 623 | 629 | snap_height = downcast<windows_options &>(window->machine().options()).d3d_snap_height(); |
| r11928 | r11929 | |
| 647 | 653 | fsfx_vertices[1].y = 0.0f; |
| 648 | 654 | fsfx_vertices[2].x = 0.0f; |
| 649 | 655 | fsfx_vertices[2].y = d3d->height; |
| 650 | | fsfx_vertices[3].x = d3d->width;// - 1.5f; |
| 651 | | fsfx_vertices[3].y = 0.0f;// - 1.5f; |
| 652 | | fsfx_vertices[4].x = 0.0f;// - 1.5f; |
| 653 | | fsfx_vertices[4].y = d3d->height;// - 1.5f; |
| 654 | | fsfx_vertices[5].x = d3d->width;// - 1.5f; |
| 655 | | fsfx_vertices[5].y = d3d->height;// - 1.5f; |
| 656 | fsfx_vertices[3].x = d3d->width + 1.5f; |
| 657 | fsfx_vertices[3].y = 0.0f - 1.5f; |
| 658 | fsfx_vertices[4].x = 0.0f + 1.5f; |
| 659 | fsfx_vertices[4].y = d3d->height - 1.5f; |
| 660 | fsfx_vertices[5].x = d3d->width + 1.5f; |
| 661 | fsfx_vertices[5].y = d3d->height - 1.5f; |
| 656 | 662 | |
| 657 | 663 | fsfx_vertices[0].u0 = 0.0f; |
| 658 | 664 | fsfx_vertices[0].v0 = 0.0f; |
| r11928 | r11929 | |
| 660 | 666 | fsfx_vertices[1].v0 = 0.0f; |
| 661 | 667 | fsfx_vertices[2].u0 = 0.0f; |
| 662 | 668 | fsfx_vertices[2].v0 = 1.0f; |
| 663 | | fsfx_vertices[3].u0 = 1.0f;// + 0.5f / d3d->width; |
| 664 | | fsfx_vertices[3].v0 = 0.0f;// + 0.5f / d3d->height; |
| 665 | | fsfx_vertices[4].u0 = 0.0f;// + 0.5f / d3d->width; |
| 666 | | fsfx_vertices[4].v0 = 1.0f;// + 0.5f / d3d->height; |
| 667 | | fsfx_vertices[5].u0 = 1.0f;// + 0.5f / d3d->width; |
| 668 | | fsfx_vertices[5].v0 = 1.0f;// + 0.5f / d3d->height; |
| 669 | fsfx_vertices[3].u0 = 1.0f + 1.5f / d3d->width; |
| 670 | fsfx_vertices[3].v0 = 0.0f - 1.5f / d3d->height; |
| 671 | fsfx_vertices[4].u0 = 0.0f + 1.5f / d3d->width; |
| 672 | fsfx_vertices[4].v0 = 1.0f - 1.5f / d3d->height; |
| 673 | fsfx_vertices[5].u0 = 1.0f + 1.5f / d3d->width; |
| 674 | fsfx_vertices[5].v0 = 1.0f - 1.5f / d3d->height; |
| 669 | 675 | |
| 670 | 676 | // set the color, Z parameters to standard values |
| 671 | 677 | for (int i = 0; i < 6; i++) |
| r11928 | r11929 | |
| 706 | 712 | |
| 707 | 713 | windows_options &winoptions = downcast<windows_options &>(window->machine().options()); |
| 708 | 714 | |
| 715 | options = (hlsl_options*)global_alloc_clear(hlsl_options); |
| 716 | |
| 717 | options->params_dirty = true; |
| 718 | |
| 719 | emu_file ini_file(downcast<windows_options &>(window->machine().options()).screen_post_fx_dir(), OPEN_FLAG_READ | OPEN_FLAG_CREATE_PATHS); |
| 720 | file_error filerr = open_next((d3d_info*)window->drawdata, ini_file, downcast<windows_options &>(window->machine().options()).hlsl_ini_name(), "ini", 0); |
| 721 | |
| 722 | external_ini = false; |
| 723 | if (filerr == FILERR_NONE) |
| 724 | { |
| 725 | ini_file.seek(0, SEEK_END); |
| 726 | if (ini_file.tell() >= 1000) |
| 727 | { |
| 728 | external_ini = true; |
| 729 | ini_file.seek(0, SEEK_SET); |
| 730 | |
| 731 | int en = 0; |
| 732 | char buf[1024]; |
| 733 | ini_file.gets(buf, 1024); |
| 734 | sscanf(buf, "hlsl_enable %d\n", &en); |
| 735 | master_enable = en == 1; |
| 736 | |
| 737 | ini_file.gets(buf, 1024); |
| 738 | sscanf(buf, "hlsl_prescale_x %d\n", &prescale_force_x); |
| 739 | |
| 740 | ini_file.gets(buf, 1024); |
| 741 | sscanf(buf, "hlsl_prescale_y %d\n", &prescale_force_y); |
| 742 | |
| 743 | ini_file.gets(buf, 1024); |
| 744 | sscanf(buf, "hlsl_preset %d\n", &preset); |
| 745 | |
| 746 | ini_file.gets(buf, 1024); |
| 747 | sscanf(buf, "hlsl_snap_width %d\n", &snap_width); |
| 748 | |
| 749 | ini_file.gets(buf, 1024); |
| 750 | sscanf(buf, "hlsl_snap_height %d\n", &snap_height); |
| 751 | |
| 752 | ini_file.gets(buf, 1024); |
| 753 | sscanf(buf, "shadow_mask_alpha %f\n", &options->shadow_mask_alpha); |
| 754 | |
| 755 | ini_file.gets(buf, 1024); |
| 756 | sscanf(buf, "shadow_mask_texture %s\n", options->shadow_mask_texture); |
| 757 | |
| 758 | ini_file.gets(buf, 1024); |
| 759 | sscanf(buf, "shadow_mask_x_count %d\n", &options->shadow_mask_count_x); |
| 760 | |
| 761 | ini_file.gets(buf, 1024); |
| 762 | sscanf(buf, "shadow_mask_y_count %d\n", &options->shadow_mask_count_y); |
| 763 | |
| 764 | ini_file.gets(buf, 1024); |
| 765 | sscanf(buf, "shadow_mask_usize %f\n", &options->shadow_mask_u_size); |
| 766 | |
| 767 | ini_file.gets(buf, 1024); |
| 768 | sscanf(buf, "shadow_mask_vsize %f\n", &options->shadow_mask_v_size); |
| 769 | |
| 770 | ini_file.gets(buf, 1024); |
| 771 | sscanf(buf, "curvature %f\n", &options->curvature); |
| 772 | |
| 773 | ini_file.gets(buf, 1024); |
| 774 | sscanf(buf, "pincushion %f\n", &options->pincushion); |
| 775 | |
| 776 | ini_file.gets(buf, 1024); |
| 777 | sscanf(buf, "scanline_alpha %f\n", &options->scanline_alpha); |
| 778 | |
| 779 | ini_file.gets(buf, 1024); |
| 780 | sscanf(buf, "scanline_size %f\n", &options->scanline_scale); |
| 781 | |
| 782 | ini_file.gets(buf, 1024); |
| 783 | sscanf(buf, "scanline_height %f\n", &options->scanline_height); |
| 784 | |
| 785 | ini_file.gets(buf, 1024); |
| 786 | sscanf(buf, "scanline_bright_scale %f\n", &options->scanline_bright_scale); |
| 787 | |
| 788 | ini_file.gets(buf, 1024); |
| 789 | sscanf(buf, "scanline_bright_offset %f\n", &options->scanline_bright_offset); |
| 790 | |
| 791 | ini_file.gets(buf, 1024); |
| 792 | sscanf(buf, "scanline_jitter %f\n", &options->scanline_offset); |
| 793 | |
| 794 | ini_file.gets(buf, 1024); |
| 795 | for(int idx = 0; idx < strlen(buf); idx++) if(buf[idx] == ',') buf[idx] = ' '; |
| 796 | sscanf(buf, "defocus %f %f\n", &options->defocus[0], &options->defocus[1]); |
| 797 | |
| 798 | ini_file.gets(buf, 1024); |
| 799 | for(int idx = 0; idx < strlen(buf); idx++) if(buf[idx] == ',') buf[idx] = ' '; |
| 800 | sscanf(buf, "converge_x %f %f %f\n", &options->converge_x[0], &options->converge_x[1], &options->converge_x[2]); |
| 801 | |
| 802 | ini_file.gets(buf, 1024); |
| 803 | for(int idx = 0; idx < strlen(buf); idx++) if(buf[idx] == ',') buf[idx] = ' '; |
| 804 | sscanf(buf, "converge_y %f %f %f\n", &options->converge_y[0], &options->converge_y[1], &options->converge_y[2]); |
| 805 | |
| 806 | ini_file.gets(buf, 1024); |
| 807 | for(int idx = 0; idx < strlen(buf); idx++) if(buf[idx] == ',') buf[idx] = ' '; |
| 808 | sscanf(buf, "radial_converge_x %f %f %f\n", &options->radial_converge_x[0], &options->radial_converge_x[1], &options->radial_converge_x[2]); |
| 809 | |
| 810 | ini_file.gets(buf, 1024); |
| 811 | for(int idx = 0; idx < strlen(buf); idx++) if(buf[idx] == ',') buf[idx] = ' '; |
| 812 | sscanf(buf, "radial_converge_y %f %f %f\n", &options->radial_converge_y[0], &options->radial_converge_y[1], &options->radial_converge_y[2]); |
| 813 | |
| 814 | ini_file.gets(buf, 1024); |
| 815 | for(int idx = 0; idx < strlen(buf); idx++) if(buf[idx] == ',') buf[idx] = ' '; |
| 816 | sscanf(buf, "red_ratio %f %f %f\n", &options->red_ratio[0], &options->red_ratio[1], &options->red_ratio[2]); |
| 817 | |
| 818 | ini_file.gets(buf, 1024); |
| 819 | for(int idx = 0; idx < strlen(buf); idx++) if(buf[idx] == ',') buf[idx] = ' '; |
| 820 | sscanf(buf, "grn_ratio %f %f %f\n", &options->grn_ratio[0], &options->grn_ratio[1], &options->grn_ratio[2]); |
| 821 | |
| 822 | ini_file.gets(buf, 1024); |
| 823 | for(int idx = 0; idx < strlen(buf); idx++) if(buf[idx] == ',') buf[idx] = ' '; |
| 824 | sscanf(buf, "blu_ratio %f %f %f\n", &options->blu_ratio[0], &options->blu_ratio[1], &options->blu_ratio[2]); |
| 825 | |
| 826 | ini_file.gets(buf, 1024); |
| 827 | sscanf(buf, "saturation %f\n", &options->saturation); |
| 828 | |
| 829 | ini_file.gets(buf, 1024); |
| 830 | for(int idx = 0; idx < strlen(buf); idx++) if(buf[idx] == ',') buf[idx] = ' '; |
| 831 | sscanf(buf, "offset %f %f %f\n", &options->offset[0], &options->offset[1], &options->offset[2]); |
| 832 | |
| 833 | ini_file.gets(buf, 1024); |
| 834 | for(int idx = 0; idx < strlen(buf); idx++) if(buf[idx] == ',') buf[idx] = ' '; |
| 835 | sscanf(buf, "scale %f %f %f\n", &options->scale[0], &options->scale[1], &options->scale[2]); |
| 836 | |
| 837 | ini_file.gets(buf, 1024); |
| 838 | for(int idx = 0; idx < strlen(buf); idx++) if(buf[idx] == ',') buf[idx] = ' '; |
| 839 | sscanf(buf, "power %f %f %f\n", &options->power[0], &options->power[1], &options->power[2]); |
| 840 | |
| 841 | ini_file.gets(buf, 1024); |
| 842 | for(int idx = 0; idx < strlen(buf); idx++) if(buf[idx] == ',') buf[idx] = ' '; |
| 843 | sscanf(buf, "floor %f %f %f\n", &options->floor[0], &options->floor[1], &options->floor[2]); |
| 844 | |
| 845 | ini_file.gets(buf, 1024); |
| 846 | for(int idx = 0; idx < strlen(buf); idx++) if(buf[idx] == ',') buf[idx] = ' '; |
| 847 | sscanf(buf, "phosphor_life %f %f %f\n", &options->phosphor[0], &options->phosphor[1], &options->phosphor[2]); |
| 848 | |
| 849 | ini_file.gets(buf, 1024); |
| 850 | sscanf(buf, "yiq_enable %d\n", &en); |
| 851 | options->yiq_enable = en == 1; |
| 852 | |
| 853 | ini_file.gets(buf, 1024); |
| 854 | sscanf(buf, "yiq_cc %f\n", &options->yiq_cc); |
| 855 | |
| 856 | ini_file.gets(buf, 1024); |
| 857 | sscanf(buf, "yiq_a %f\n", &options->yiq_a); |
| 858 | |
| 859 | ini_file.gets(buf, 1024); |
| 860 | sscanf(buf, "yiq_b %f\n", &options->yiq_b); |
| 861 | |
| 862 | ini_file.gets(buf, 1024); |
| 863 | sscanf(buf, "yiq_o %f\n", &options->yiq_o); |
| 864 | |
| 865 | ini_file.gets(buf, 1024); |
| 866 | sscanf(buf, "yiq_p %f\n", &options->yiq_p); |
| 867 | |
| 868 | ini_file.gets(buf, 1024); |
| 869 | sscanf(buf, "yiq_n %f\n", &options->yiq_n); |
| 870 | |
| 871 | ini_file.gets(buf, 1024); |
| 872 | sscanf(buf, "yiq_y %f\n", &options->yiq_y); |
| 873 | |
| 874 | ini_file.gets(buf, 1024); |
| 875 | sscanf(buf, "yiq_i %f\n", &options->yiq_i); |
| 876 | |
| 877 | ini_file.gets(buf, 1024); |
| 878 | sscanf(buf, "yiq_q %f\n", &options->yiq_q); |
| 879 | |
| 880 | ini_file.gets(buf, 1024); |
| 881 | sscanf(buf, "yiq_scan_time %f\n", &options->yiq_scan_time); |
| 882 | |
| 883 | ini_file.gets(buf, 1024); |
| 884 | sscanf(buf, "yiq_phase_count %d\n", &options->yiq_phase_count); |
| 885 | } |
| 886 | } |
| 887 | |
| 709 | 888 | // experimental: load a PNG to use for vector rendering; it is treated |
| 710 | 889 | // as a brightness map |
| 711 | 890 | emu_file file(window->machine().options().art_path(), OPEN_FLAG_READ); |
| 712 | | shadow_bitmap = render_load_png(file, NULL, winoptions.screen_shadow_mask_texture(), NULL, NULL); |
| 891 | shadow_bitmap = render_load_png(file, NULL, options->shadow_mask_texture, NULL, NULL); |
| 713 | 892 | |
| 714 | 893 | // experimental: if we have a shadow bitmap, create a texture for it |
| 715 | 894 | if (shadow_bitmap != NULL) |
| r11928 | r11929 | |
| 728 | 907 | shadow_texture = texture_create(d3d, &texture, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXFORMAT(TEXFORMAT_ARGB32)); |
| 729 | 908 | } |
| 730 | 909 | |
| 731 | | options = (hlsl_options*)global_alloc_clear(hlsl_options); |
| 910 | if(!external_ini) |
| 911 | { |
| 912 | prescale_force_x = winoptions.d3d_hlsl_prescale_x(); |
| 913 | prescale_force_y = winoptions.d3d_hlsl_prescale_y(); |
| 914 | if(preset == -1) |
| 915 | { |
| 916 | options->shadow_mask_alpha = winoptions.screen_shadow_mask_alpha(); |
| 917 | options->shadow_mask_count_x = winoptions.screen_shadow_mask_count_x(); |
| 918 | options->shadow_mask_count_y = winoptions.screen_shadow_mask_count_y(); |
| 919 | options->shadow_mask_u_size = winoptions.screen_shadow_mask_u_size(); |
| 920 | options->shadow_mask_v_size = winoptions.screen_shadow_mask_v_size(); |
| 921 | options->curvature = winoptions.screen_curvature(); |
| 922 | options->pincushion = winoptions.screen_pincushion(); |
| 923 | options->scanline_alpha = winoptions.screen_scanline_amount(); |
| 924 | options->scanline_scale = winoptions.screen_scanline_scale(); |
| 925 | options->scanline_height = winoptions.screen_scanline_height(); |
| 926 | options->scanline_bright_scale = winoptions.screen_scanline_bright_scale(); |
| 927 | options->scanline_bright_offset = winoptions.screen_scanline_bright_offset(); |
| 928 | options->scanline_offset = winoptions.screen_scanline_offset(); |
| 929 | get_vector(winoptions.screen_defocus(), 2, options->defocus, TRUE); |
| 930 | get_vector(winoptions.screen_converge_x(), 3, options->converge_x, TRUE); |
| 931 | get_vector(winoptions.screen_converge_y(), 3, options->converge_y, TRUE); |
| 932 | get_vector(winoptions.screen_radial_converge_x(), 3, options->radial_converge_x, TRUE); |
| 933 | get_vector(winoptions.screen_radial_converge_y(), 3, options->radial_converge_y, TRUE); |
| 934 | get_vector(winoptions.screen_red_ratio(), 3, options->red_ratio, TRUE); |
| 935 | get_vector(winoptions.screen_grn_ratio(), 3, options->grn_ratio, TRUE); |
| 936 | get_vector(winoptions.screen_blu_ratio(), 3, options->blu_ratio, TRUE); |
| 937 | get_vector(winoptions.screen_offset(), 3, options->offset, TRUE); |
| 938 | get_vector(winoptions.screen_scale(), 3, options->scale, TRUE); |
| 939 | get_vector(winoptions.screen_power(), 3, options->power, TRUE); |
| 940 | get_vector(winoptions.screen_floor(), 3, options->floor, TRUE); |
| 941 | get_vector(winoptions.screen_phosphor(), 3, options->phosphor, TRUE); |
| 942 | options->saturation = winoptions.screen_saturation(); |
| 943 | } |
| 944 | else |
| 945 | { |
| 946 | options = &g_hlsl_presets[preset]; |
| 947 | } |
| 732 | 948 | |
| 733 | | if(preset == -1) |
| 734 | | { |
| 735 | | options->shadow_mask_alpha = winoptions.screen_shadow_mask_alpha(); |
| 736 | | options->shadow_mask_count_x = winoptions.screen_shadow_mask_count_x(); |
| 737 | | options->shadow_mask_count_y = winoptions.screen_shadow_mask_count_y(); |
| 738 | | options->shadow_mask_u_size = winoptions.screen_shadow_mask_u_size(); |
| 739 | | options->shadow_mask_v_size = winoptions.screen_shadow_mask_v_size(); |
| 740 | | options->curvature = winoptions.screen_curvature(); |
| 741 | | options->pincushion = winoptions.screen_pincushion(); |
| 742 | | options->scanline_alpha = winoptions.screen_scanline_amount(); |
| 743 | | options->scanline_scale = winoptions.screen_scanline_scale(); |
| 744 | | options->scanline_height = winoptions.screen_scanline_height(); |
| 745 | | options->scanline_bright_scale = winoptions.screen_scanline_bright_scale(); |
| 746 | | options->scanline_bright_offset = winoptions.screen_scanline_bright_offset(); |
| 747 | | options->scanline_offset = winoptions.screen_scanline_offset(); |
| 748 | | get_vector(winoptions.screen_defocus(), 2, options->defocus, TRUE); |
| 749 | | get_vector(winoptions.screen_converge_x(), 3, options->converge_x, TRUE); |
| 750 | | get_vector(winoptions.screen_converge_y(), 3, options->converge_y, TRUE); |
| 751 | | get_vector(winoptions.screen_radial_converge_x(), 3, options->radial_converge_x, TRUE); |
| 752 | | get_vector(winoptions.screen_radial_converge_y(), 3, options->radial_converge_y, TRUE); |
| 753 | | get_vector(winoptions.screen_red_ratio(), 3, options->red_ratio, TRUE); |
| 754 | | get_vector(winoptions.screen_grn_ratio(), 3, options->grn_ratio, TRUE); |
| 755 | | get_vector(winoptions.screen_blu_ratio(), 3, options->blu_ratio, TRUE); |
| 756 | | get_vector(winoptions.screen_offset(), 3, options->offset, TRUE); |
| 757 | | get_vector(winoptions.screen_scale(), 3, options->scale, TRUE); |
| 758 | | get_vector(winoptions.screen_power(), 3, options->power, TRUE); |
| 759 | | get_vector(winoptions.screen_floor(), 3, options->floor, TRUE); |
| 760 | | get_vector(winoptions.screen_phosphor(), 3, options->phosphor, TRUE); |
| 761 | | options->saturation = winoptions.screen_saturation(); |
| 949 | options->yiq_enable = winoptions.screen_yiq_enable(); |
| 950 | options->yiq_cc = winoptions.screen_yiq_cc(); |
| 951 | options->yiq_a = winoptions.screen_yiq_a(); |
| 952 | options->yiq_b = winoptions.screen_yiq_b(); |
| 953 | options->yiq_o = winoptions.screen_yiq_o(); |
| 954 | options->yiq_p = winoptions.screen_yiq_p(); |
| 955 | options->yiq_n = winoptions.screen_yiq_n(); |
| 956 | options->yiq_y = winoptions.screen_yiq_y(); |
| 957 | options->yiq_i = winoptions.screen_yiq_i(); |
| 958 | options->yiq_q = winoptions.screen_yiq_q(); |
| 959 | options->yiq_scan_time = winoptions.screen_yiq_scan_time(); |
| 960 | options->yiq_phase_count = winoptions.screen_yiq_phase_count(); |
| 762 | 961 | } |
| 763 | | else |
| 764 | | { |
| 765 | | options = &g_hlsl_presets[preset]; |
| 766 | | } |
| 767 | | |
| 768 | 962 | g_slider_list = init_slider_list(); |
| 769 | 963 | |
| 770 | 964 | const char *fx_dir = downcast<windows_options &>(window->machine().options()).screen_post_fx_dir(); |
| r11928 | r11929 | |
| 967 | 1161 | // just post-processing. |
| 968 | 1162 | curr_effect = post_effect; |
| 969 | 1163 | |
| 970 | | (*d3dintf->effect.set_float)(curr_effect, "RawWidth", (float)poly->texture->rawwidth); |
| 971 | | (*d3dintf->effect.set_float)(curr_effect, "RawHeight", (float)poly->texture->rawheight); |
| 972 | | (*d3dintf->effect.set_float)(curr_effect, "WidthRatio", 1.0f / (poly->texture->ustop - poly->texture->ustart)); |
| 973 | | (*d3dintf->effect.set_float)(curr_effect, "HeightRatio", 1.0f / (poly->texture->vstop - poly->texture->vstart)); |
| 974 | | (*d3dintf->effect.set_float)(curr_effect, "TargetWidth", (float)d3d->width); |
| 975 | | (*d3dintf->effect.set_float)(curr_effect, "TargetHeight", (float)d3d->height); |
| 976 | | (*d3dintf->effect.set_vector)(curr_effect, "Floor", 3, options->floor); |
| 977 | | (*d3dintf->effect.set_float)(curr_effect, "SnapX", snap_width); |
| 978 | | (*d3dintf->effect.set_float)(curr_effect, "SnapY", snap_height); |
| 979 | | (*d3dintf->effect.set_float)(curr_effect, "PincushionAmount", options->pincushion); |
| 980 | | (*d3dintf->effect.set_float)(curr_effect, "CurvatureAmount", options->curvature); |
| 981 | | (*d3dintf->effect.set_float)(curr_effect, "UseShadow", shadow_texture == NULL ? 0.0f : 1.0f); |
| 982 | | (*d3dintf->effect.set_texture)(curr_effect, "Shadow", shadow_texture == NULL ? NULL : shadow_texture->d3dfinaltex); |
| 983 | | (*d3dintf->effect.set_float)(curr_effect, "ShadowBrightness", options->shadow_mask_alpha); |
| 984 | | (*d3dintf->effect.set_float)(curr_effect, "ShadowMaskSizeX", (float)options->shadow_mask_count_x); |
| 985 | | (*d3dintf->effect.set_float)(curr_effect, "ShadowMaskSizeY", (float)options->shadow_mask_count_y); |
| 986 | | (*d3dintf->effect.set_float)(curr_effect, "ShadowU", options->shadow_mask_u_size); |
| 987 | | (*d3dintf->effect.set_float)(curr_effect, "ShadowV", options->shadow_mask_v_size); |
| 988 | | (*d3dintf->effect.set_float)(curr_effect, "ShadowWidth", shadow_texture == NULL ? 1.0f : (float)shadow_texture->rawwidth); |
| 989 | | (*d3dintf->effect.set_float)(curr_effect, "ShadowHeight", shadow_texture == NULL ? 1.0f : (float)shadow_texture->rawheight); |
| 990 | | (*d3dintf->effect.set_float)(curr_effect, "ScanlineAmount", options->scanline_alpha); |
| 991 | | (*d3dintf->effect.set_float)(curr_effect, "ScanlineScale", options->scanline_scale); |
| 992 | | (*d3dintf->effect.set_float)(curr_effect, "ScanlineHeight", options->scanline_height); |
| 993 | | (*d3dintf->effect.set_float)(curr_effect, "ScanlineBrightScale", options->scanline_bright_scale); |
| 994 | | (*d3dintf->effect.set_float)(curr_effect, "ScanlineBrightOffset", options->scanline_bright_offset); |
| 995 | | (*d3dintf->effect.set_float)(curr_effect, "ScanlineOffset", (poly->texture->cur_frame == 0) ? 0.0f : options->scanline_offset); |
| 996 | | (*d3dintf->effect.set_vector)(curr_effect, "Power", 3, options->power); |
| 1164 | if(options->params_dirty) |
| 1165 | { |
| 1166 | (*d3dintf->effect.set_float)(curr_effect, "RawWidth", (float)poly->texture->rawwidth); |
| 1167 | (*d3dintf->effect.set_float)(curr_effect, "RawHeight", (float)poly->texture->rawheight); |
| 1168 | (*d3dintf->effect.set_float)(curr_effect, "WidthRatio", 1.0f / (poly->texture->ustop - poly->texture->ustart)); |
| 1169 | (*d3dintf->effect.set_float)(curr_effect, "HeightRatio", 1.0f / (poly->texture->vstop - poly->texture->vstart)); |
| 1170 | (*d3dintf->effect.set_float)(curr_effect, "TargetWidth", (float)d3d->width); |
| 1171 | (*d3dintf->effect.set_float)(curr_effect, "TargetHeight", (float)d3d->height); |
| 1172 | (*d3dintf->effect.set_vector)(curr_effect, "Floor", 3, options->floor); |
| 1173 | (*d3dintf->effect.set_float)(curr_effect, "SnapX", snap_width); |
| 1174 | (*d3dintf->effect.set_float)(curr_effect, "SnapY", snap_height); |
| 1175 | (*d3dintf->effect.set_float)(curr_effect, "PincushionAmount", options->pincushion); |
| 1176 | (*d3dintf->effect.set_float)(curr_effect, "CurvatureAmount", options->curvature); |
| 1177 | (*d3dintf->effect.set_float)(curr_effect, "UseShadow", shadow_texture == NULL ? 0.0f : 1.0f); |
| 1178 | (*d3dintf->effect.set_texture)(curr_effect, "Shadow", shadow_texture == NULL ? NULL : shadow_texture->d3dfinaltex); |
| 1179 | (*d3dintf->effect.set_float)(curr_effect, "ShadowBrightness", options->shadow_mask_alpha); |
| 1180 | (*d3dintf->effect.set_float)(curr_effect, "ShadowMaskSizeX", (float)options->shadow_mask_count_x); |
| 1181 | (*d3dintf->effect.set_float)(curr_effect, "ShadowMaskSizeY", (float)options->shadow_mask_count_y); |
| 1182 | (*d3dintf->effect.set_float)(curr_effect, "ShadowU", options->shadow_mask_u_size); |
| 1183 | (*d3dintf->effect.set_float)(curr_effect, "ShadowV", options->shadow_mask_v_size); |
| 1184 | (*d3dintf->effect.set_float)(curr_effect, "ShadowWidth", shadow_texture == NULL ? 1.0f : (float)shadow_texture->rawwidth); |
| 1185 | (*d3dintf->effect.set_float)(curr_effect, "ShadowHeight", shadow_texture == NULL ? 1.0f : (float)shadow_texture->rawheight); |
| 1186 | (*d3dintf->effect.set_float)(curr_effect, "ScanlineAmount", options->scanline_alpha); |
| 1187 | (*d3dintf->effect.set_float)(curr_effect, "ScanlineScale", options->scanline_scale); |
| 1188 | (*d3dintf->effect.set_float)(curr_effect, "ScanlineHeight", options->scanline_height); |
| 1189 | (*d3dintf->effect.set_float)(curr_effect, "ScanlineBrightScale", options->scanline_bright_scale); |
| 1190 | (*d3dintf->effect.set_float)(curr_effect, "ScanlineBrightOffset", options->scanline_bright_offset); |
| 1191 | (*d3dintf->effect.set_float)(curr_effect, "ScanlineOffset", (poly->texture->cur_frame == 0) ? 0.0f : options->scanline_offset); |
| 1192 | (*d3dintf->effect.set_vector)(curr_effect, "Power", 3, options->power); |
| 1193 | } |
| 997 | 1194 | } |
| 998 | 1195 | else |
| 999 | 1196 | { |
| r11928 | r11929 | |
| 1016 | 1213 | UINT num_passes = 0; |
| 1017 | 1214 | d3d_info *d3d = (d3d_info *)window->drawdata; |
| 1018 | 1215 | |
| 1019 | | windows_options &winoptions = downcast<windows_options &>(window->machine().options()); |
| 1020 | | |
| 1021 | 1216 | if(PRIMFLAG_GET_SCREENTEX(d3d->last_texture_flags) && poly->texture != NULL) |
| 1022 | 1217 | { |
| 1023 | 1218 | screen_encountered[poly->texture->target_index] = true; |
| r11928 | r11929 | |
| 1025 | 1220 | |
| 1026 | 1221 | target_use_count[poly->texture->target_index] = 60; |
| 1027 | 1222 | |
| 1028 | | if(yiq_enable) |
| 1223 | if(options->yiq_enable) |
| 1029 | 1224 | { |
| 1030 | 1225 | /* Convert our signal into YIQ */ |
| 1031 | 1226 | curr_effect = yiq_encode_effect; |
| 1032 | 1227 | |
| 1033 | | (*d3dintf->effect.set_float)(curr_effect, "RawWidth", (float)poly->texture->rawwidth); |
| 1034 | | (*d3dintf->effect.set_float)(curr_effect, "RawHeight", (float)poly->texture->rawheight); |
| 1035 | | (*d3dintf->effect.set_float)(curr_effect, "WidthRatio", 1.0f / (poly->texture->ustop - poly->texture->ustart)); |
| 1036 | | (*d3dintf->effect.set_float)(curr_effect, "HeightRatio", 1.0f / (poly->texture->vstop - poly->texture->vstart)); |
| 1037 | | (*d3dintf->effect.set_float)(curr_effect, "TargetWidth", (float)d3d->width); |
| 1038 | | (*d3dintf->effect.set_float)(curr_effect, "TargetHeight", (float)d3d->height); |
| 1039 | | (*d3dintf->effect.set_float)(curr_effect, "CCValue", winoptions.screen_yiq_cc()); |
| 1040 | | (*d3dintf->effect.set_float)(curr_effect, "AValue", winoptions.screen_yiq_a()); |
| 1041 | | (*d3dintf->effect.set_float)(curr_effect, "BValue", (poly->texture->cur_frame == 2) ? 0.0f : ((float)poly->texture->cur_frame * winoptions.screen_yiq_b())); |
| 1042 | | (*d3dintf->effect.set_float)(curr_effect, "PValue", winoptions.screen_yiq_p()); |
| 1043 | | (*d3dintf->effect.set_float)(curr_effect, "NotchHalfWidth", winoptions.screen_yiq_n()); |
| 1044 | | (*d3dintf->effect.set_float)(curr_effect, "YFreqResponse", winoptions.screen_yiq_y()); |
| 1045 | | (*d3dintf->effect.set_float)(curr_effect, "IFreqResponse", winoptions.screen_yiq_i()); |
| 1046 | | (*d3dintf->effect.set_float)(curr_effect, "QFreqResponse", winoptions.screen_yiq_q()); |
| 1047 | | (*d3dintf->effect.set_float)(curr_effect, "ScanTime", winoptions.screen_yiq_scan_time()); |
| 1228 | if(options->params_dirty) |
| 1229 | { |
| 1230 | (*d3dintf->effect.set_float)(curr_effect, "RawWidth", (float)poly->texture->rawwidth); |
| 1231 | (*d3dintf->effect.set_float)(curr_effect, "RawHeight", (float)poly->texture->rawheight); |
| 1232 | (*d3dintf->effect.set_float)(curr_effect, "WidthRatio", 1.0f / (poly->texture->ustop - poly->texture->ustart)); |
| 1233 | (*d3dintf->effect.set_float)(curr_effect, "HeightRatio", 1.0f / (poly->texture->vstop - poly->texture->vstart)); |
| 1234 | (*d3dintf->effect.set_float)(curr_effect, "TargetWidth", (float)d3d->width); |
| 1235 | (*d3dintf->effect.set_float)(curr_effect, "TargetHeight", (float)d3d->height); |
| 1236 | (*d3dintf->effect.set_float)(curr_effect, "CCValue", options->yiq_cc); |
| 1237 | (*d3dintf->effect.set_float)(curr_effect, "AValue", options->yiq_a); |
| 1238 | (*d3dintf->effect.set_float)(curr_effect, "BValue", (poly->texture->cur_frame == 2) ? 0.0f : ((float)poly->texture->cur_frame * options->yiq_b)); |
| 1239 | (*d3dintf->effect.set_float)(curr_effect, "PValue", options->yiq_p); |
| 1240 | (*d3dintf->effect.set_float)(curr_effect, "NotchHalfWidth", options->yiq_n); |
| 1241 | (*d3dintf->effect.set_float)(curr_effect, "YFreqResponse", options->yiq_y); |
| 1242 | (*d3dintf->effect.set_float)(curr_effect, "IFreqResponse", options->yiq_i); |
| 1243 | (*d3dintf->effect.set_float)(curr_effect, "QFreqResponse", options->yiq_q); |
| 1244 | (*d3dintf->effect.set_float)(curr_effect, "ScanTime", options->yiq_scan_time); |
| 1245 | } |
| 1048 | 1246 | |
| 1049 | 1247 | HRESULT result = (*d3dintf->device.set_render_target)(d3d->device, 0, target4[poly->texture->target_index]); |
| 1050 | 1248 | |
| r11928 | r11929 | |
| 1070 | 1268 | |
| 1071 | 1269 | (*d3dintf->effect.set_texture)(curr_effect, "Composite", texture4[poly->texture->target_index]); |
| 1072 | 1270 | (*d3dintf->effect.set_texture)(curr_effect, "Diffuse", poly->texture->d3dfinaltex); |
| 1073 | | (*d3dintf->effect.set_float)(curr_effect, "RawWidth", (float)poly->texture->rawwidth); |
| 1074 | | (*d3dintf->effect.set_float)(curr_effect, "RawHeight", (float)poly->texture->rawheight); |
| 1075 | | (*d3dintf->effect.set_float)(curr_effect, "WidthRatio", 1.0f / (poly->texture->ustop - poly->texture->ustart)); |
| 1076 | | (*d3dintf->effect.set_float)(curr_effect, "HeightRatio", 1.0f / (poly->texture->vstop - poly->texture->vstart)); |
| 1077 | | (*d3dintf->effect.set_float)(curr_effect, "TargetWidth", (float)d3d->width); |
| 1078 | | (*d3dintf->effect.set_float)(curr_effect, "TargetHeight", (float)d3d->height); |
| 1079 | | (*d3dintf->effect.set_float)(curr_effect, "CCValue", winoptions.screen_yiq_cc()); |
| 1080 | | (*d3dintf->effect.set_float)(curr_effect, "AValue", winoptions.screen_yiq_a()); |
| 1081 | | (*d3dintf->effect.set_float)(curr_effect, "BValue", (poly->texture->cur_frame == 2) ? 0.0f : ((float)poly->texture->cur_frame * winoptions.screen_yiq_b())); |
| 1082 | | (*d3dintf->effect.set_float)(curr_effect, "OValue", winoptions.screen_yiq_o()); |
| 1083 | | (*d3dintf->effect.set_float)(curr_effect, "PValue", winoptions.screen_yiq_p()); |
| 1084 | | (*d3dintf->effect.set_float)(curr_effect, "NotchHalfWidth", winoptions.screen_yiq_n()); |
| 1085 | | (*d3dintf->effect.set_float)(curr_effect, "YFreqResponse", winoptions.screen_yiq_y()); |
| 1086 | | (*d3dintf->effect.set_float)(curr_effect, "IFreqResponse", winoptions.screen_yiq_i()); |
| 1087 | | (*d3dintf->effect.set_float)(curr_effect, "QFreqResponse", winoptions.screen_yiq_q()); |
| 1088 | | (*d3dintf->effect.set_float)(curr_effect, "ScanTime", winoptions.screen_yiq_scan_time()); |
| 1271 | if(options->params_dirty) |
| 1272 | { |
| 1273 | (*d3dintf->effect.set_float)(curr_effect, "RawWidth", (float)poly->texture->rawwidth); |
| 1274 | (*d3dintf->effect.set_float)(curr_effect, "RawHeight", (float)poly->texture->rawheight); |
| 1275 | (*d3dintf->effect.set_float)(curr_effect, "WidthRatio", 1.0f / (poly->texture->ustop - poly->texture->ustart)); |
| 1276 | (*d3dintf->effect.set_float)(curr_effect, "HeightRatio", 1.0f / (poly->texture->vstop - poly->texture->vstart)); |
| 1277 | (*d3dintf->effect.set_float)(curr_effect, "TargetWidth", (float)d3d->width); |
| 1278 | (*d3dintf->effect.set_float)(curr_effect, "TargetHeight", (float)d3d->height); |
| 1279 | (*d3dintf->effect.set_float)(curr_effect, "CCValue", options->yiq_cc); |
| 1280 | (*d3dintf->effect.set_float)(curr_effect, "AValue", options->yiq_a); |
| 1281 | (*d3dintf->effect.set_float)(curr_effect, "BValue", (poly->texture->cur_frame == 2) ? 0.0f : ((float)poly->texture->cur_frame * options->yiq_b)); |
| 1282 | (*d3dintf->effect.set_float)(curr_effect, "OValue", options->yiq_o); |
| 1283 | (*d3dintf->effect.set_float)(curr_effect, "PValue", options->yiq_p); |
| 1284 | (*d3dintf->effect.set_float)(curr_effect, "NotchHalfWidth", options->yiq_n); |
| 1285 | (*d3dintf->effect.set_float)(curr_effect, "YFreqResponse", options->yiq_y); |
| 1286 | (*d3dintf->effect.set_float)(curr_effect, "IFreqResponse", options->yiq_i); |
| 1287 | (*d3dintf->effect.set_float)(curr_effect, "QFreqResponse", options->yiq_q); |
| 1288 | (*d3dintf->effect.set_float)(curr_effect, "ScanTime", options->yiq_scan_time); |
| 1289 | } |
| 1089 | 1290 | |
| 1090 | 1291 | result = (*d3dintf->device.set_render_target)(d3d->device, 0, target3[poly->texture->target_index]); |
| 1091 | 1292 | |
| r11928 | r11929 | |
| 1114 | 1315 | curr_effect = color_effect; |
| 1115 | 1316 | |
| 1116 | 1317 | /* Render the initial color-convolution pass */ |
| 1117 | | (*d3dintf->effect.set_float)(curr_effect, "RawWidth", (float)poly->texture->rawwidth); |
| 1118 | | (*d3dintf->effect.set_float)(curr_effect, "RawHeight", (float)poly->texture->rawheight); |
| 1119 | | (*d3dintf->effect.set_float)(curr_effect, "WidthRatio", yiq_enable ? 1.0f : (1.0f / (poly->texture->ustop - poly->texture->ustart))); |
| 1120 | | (*d3dintf->effect.set_float)(curr_effect, "HeightRatio", yiq_enable ? 1.0f : (1.0f / (poly->texture->vstop - poly->texture->vstart))); |
| 1121 | | (*d3dintf->effect.set_float)(curr_effect, "TargetWidth", (float)d3d->width); |
| 1122 | | (*d3dintf->effect.set_float)(curr_effect, "TargetHeight", (float)d3d->height); |
| 1123 | | (*d3dintf->effect.set_float)(curr_effect, "YIQEnable", yiq_enable ? 1.0f : 0.0f); |
| 1124 | | (*d3dintf->effect.set_vector)(curr_effect, "RedRatios", 3, options->red_ratio); |
| 1125 | | (*d3dintf->effect.set_vector)(curr_effect, "GrnRatios", 3, options->grn_ratio); |
| 1126 | | (*d3dintf->effect.set_vector)(curr_effect, "BluRatios", 3, options->blu_ratio); |
| 1127 | | (*d3dintf->effect.set_vector)(curr_effect, "Offset", 3, options->offset); |
| 1128 | | (*d3dintf->effect.set_vector)(curr_effect, "Scale", 3, options->scale); |
| 1129 | | (*d3dintf->effect.set_float)(curr_effect, "Saturation", options->saturation); |
| 1318 | if(options->params_dirty) |
| 1319 | { |
| 1320 | (*d3dintf->effect.set_float)(curr_effect, "RawWidth", (float)poly->texture->rawwidth); |
| 1321 | (*d3dintf->effect.set_float)(curr_effect, "RawHeight", (float)poly->texture->rawheight); |
| 1322 | (*d3dintf->effect.set_float)(curr_effect, "WidthRatio", options->yiq_enable ? 1.0f : (1.0f / (poly->texture->ustop - poly->texture->ustart))); |
| 1323 | (*d3dintf->effect.set_float)(curr_effect, "HeightRatio", options->yiq_enable ? 1.0f : (1.0f / (poly->texture->vstop - poly->texture->vstart))); |
| 1324 | (*d3dintf->effect.set_float)(curr_effect, "TargetWidth", (float)d3d->width); |
| 1325 | (*d3dintf->effect.set_float)(curr_effect, "TargetHeight", (float)d3d->height); |
| 1326 | (*d3dintf->effect.set_float)(curr_effect, "YIQEnable", options->yiq_enable ? 1.0f : 0.0f); |
| 1327 | (*d3dintf->effect.set_vector)(curr_effect, "RedRatios", 3, options->red_ratio); |
| 1328 | (*d3dintf->effect.set_vector)(curr_effect, "GrnRatios", 3, options->grn_ratio); |
| 1329 | (*d3dintf->effect.set_vector)(curr_effect, "BluRatios", 3, options->blu_ratio); |
| 1330 | (*d3dintf->effect.set_vector)(curr_effect, "Offset", 3, options->offset); |
| 1331 | (*d3dintf->effect.set_vector)(curr_effect, "Scale", 3, options->scale); |
| 1332 | (*d3dintf->effect.set_float)(curr_effect, "Saturation", options->saturation); |
| 1333 | } |
| 1130 | 1334 | |
| 1131 | 1335 | HRESULT result = (*d3dintf->device.set_render_target)(d3d->device, 0, smalltarget0[poly->texture->target_index]); |
| 1132 | 1336 | |
| r11928 | r11929 | |
| 1151 | 1355 | curr_effect = prescale_effect; |
| 1152 | 1356 | (*d3dintf->effect.set_texture)(curr_effect, "Diffuse", smalltexture0[poly->texture->target_index]); |
| 1153 | 1357 | |
| 1154 | | (*d3dintf->effect.set_float)(curr_effect, "TargetWidth", (float)d3d->width); |
| 1155 | | (*d3dintf->effect.set_float)(curr_effect, "TargetHeight", (float)d3d->height); |
| 1156 | | (*d3dintf->effect.set_float)(curr_effect, "RawWidth", (float)poly->texture->rawwidth); |
| 1157 | | (*d3dintf->effect.set_float)(curr_effect, "RawHeight", (float)poly->texture->rawheight); |
| 1158 | | (*d3dintf->effect.set_float)(curr_effect, "WidthRatio", 1.0f / (poly->texture->ustop - poly->texture->ustart)); |
| 1159 | | (*d3dintf->effect.set_float)(curr_effect, "HeightRatio", 1.0f / (poly->texture->vstop - poly->texture->vstart)); |
| 1358 | if(options->params_dirty) |
| 1359 | { |
| 1360 | (*d3dintf->effect.set_float)(curr_effect, "TargetWidth", (float)d3d->width); |
| 1361 | (*d3dintf->effect.set_float)(curr_effect, "TargetHeight", (float)d3d->height); |
| 1362 | (*d3dintf->effect.set_float)(curr_effect, "RawWidth", (float)poly->texture->rawwidth); |
| 1363 | (*d3dintf->effect.set_float)(curr_effect, "RawHeight", (float)poly->texture->rawheight); |
| 1364 | (*d3dintf->effect.set_float)(curr_effect, "WidthRatio", 1.0f / (poly->texture->ustop - poly->texture->ustart)); |
| 1365 | (*d3dintf->effect.set_float)(curr_effect, "HeightRatio", 1.0f / (poly->texture->vstop - poly->texture->vstart)); |
| 1366 | } |
| 1160 | 1367 | |
| 1161 | 1368 | (*d3dintf->effect.begin)(curr_effect, &num_passes, 0); |
| 1162 | 1369 | |
| r11928 | r11929 | |
| 1181 | 1388 | curr_effect = deconverge_effect; |
| 1182 | 1389 | (*d3dintf->effect.set_texture)(curr_effect, "Diffuse", prescaletexture0[poly->texture->target_index]); |
| 1183 | 1390 | |
| 1184 | | (*d3dintf->effect.set_float)(curr_effect, "TargetWidth", (float)d3d->width); |
| 1185 | | (*d3dintf->effect.set_float)(curr_effect, "TargetHeight", (float)d3d->height); |
| 1186 | | (*d3dintf->effect.set_float)(curr_effect, "RawWidth", (float)poly->texture->rawwidth); |
| 1187 | | (*d3dintf->effect.set_float)(curr_effect, "RawHeight", (float)poly->texture->rawheight); |
| 1188 | | (*d3dintf->effect.set_float)(curr_effect, "WidthRatio", 1.0f / (poly->texture->ustop - poly->texture->ustart)); |
| 1189 | | (*d3dintf->effect.set_float)(curr_effect, "HeightRatio", 1.0f / (poly->texture->vstop - poly->texture->vstart)); |
| 1190 | | (*d3dintf->effect.set_vector)(curr_effect, "ConvergeX", 3, options->converge_x); |
| 1191 | | (*d3dintf->effect.set_vector)(curr_effect, "ConvergeY", 3, options->converge_y); |
| 1192 | | (*d3dintf->effect.set_vector)(curr_effect, "RadialConvergeX", 3, options->radial_converge_x); |
| 1193 | | (*d3dintf->effect.set_vector)(curr_effect, "RadialConvergeY", 3, options->radial_converge_y); |
| 1391 | if(options->params_dirty) |
| 1392 | { |
| 1393 | (*d3dintf->effect.set_float)(curr_effect, "TargetWidth", (float)d3d->width); |
| 1394 | (*d3dintf->effect.set_float)(curr_effect, "TargetHeight", (float)d3d->height); |
| 1395 | (*d3dintf->effect.set_float)(curr_effect, "RawWidth", (float)poly->texture->rawwidth); |
| 1396 | (*d3dintf->effect.set_float)(curr_effect, "RawHeight", (float)poly->texture->rawheight); |
| 1397 | (*d3dintf->effect.set_float)(curr_effect, "WidthRatio", 1.0f / (poly->texture->ustop - poly->texture->ustart)); |
| 1398 | (*d3dintf->effect.set_float)(curr_effect, "HeightRatio", 1.0f / (poly->texture->vstop - poly->texture->vstart)); |
| 1399 | (*d3dintf->effect.set_vector)(curr_effect, "ConvergeX", 3, options->converge_x); |
| 1400 | (*d3dintf->effect.set_vector)(curr_effect, "ConvergeY", 3, options->converge_y); |
| 1401 | (*d3dintf->effect.set_vector)(curr_effect, "RadialConvergeX", 3, options->radial_converge_x); |
| 1402 | (*d3dintf->effect.set_vector)(curr_effect, "RadialConvergeY", 3, options->radial_converge_y); |
| 1403 | } |
| 1194 | 1404 | |
| 1195 | 1405 | (*d3dintf->effect.begin)(curr_effect, &num_passes, 0); |
| 1196 | 1406 | |
| r11928 | r11929 | |
| 1282 | 1492 | // input texture. |
| 1283 | 1493 | curr_effect = phosphor_effect; |
| 1284 | 1494 | |
| 1285 | | (*d3dintf->effect.set_float)(curr_effect, "TargetWidth", (float)d3d->width); |
| 1286 | | (*d3dintf->effect.set_float)(curr_effect, "TargetHeight", (float)d3d->height); |
| 1287 | | (*d3dintf->effect.set_float)(curr_effect, "RawWidth", (float)poly->texture->rawwidth); |
| 1288 | | (*d3dintf->effect.set_float)(curr_effect, "RawHeight", (float)poly->texture->rawheight); |
| 1289 | | (*d3dintf->effect.set_vector)(curr_effect, "Phosphor", 3, options->phosphor); |
| 1495 | if(options->params_dirty) |
| 1496 | { |
| 1497 | (*d3dintf->effect.set_float)(curr_effect, "TargetWidth", (float)d3d->width); |
| 1498 | (*d3dintf->effect.set_float)(curr_effect, "TargetHeight", (float)d3d->height); |
| 1499 | (*d3dintf->effect.set_float)(curr_effect, "RawWidth", (float)poly->texture->rawwidth); |
| 1500 | (*d3dintf->effect.set_float)(curr_effect, "RawHeight", (float)poly->texture->rawheight); |
| 1501 | (*d3dintf->effect.set_vector)(curr_effect, "Phosphor", 3, options->phosphor); |
| 1502 | } |
| 1290 | 1503 | |
| 1291 | 1504 | (*d3dintf->effect.set_texture)(curr_effect, "Diffuse", focus_enable ? texture1[poly->texture->target_index] : texture2[poly->texture->target_index]); |
| 1292 | 1505 | (*d3dintf->effect.set_texture)(curr_effect, "LastPass", last_texture[poly->texture->target_index]); |
| r11928 | r11929 | |
| 1314 | 1527 | |
| 1315 | 1528 | (*d3dintf->effect.set_float)(curr_effect, "FixedAlpha", 1.0f); |
| 1316 | 1529 | |
| 1317 | | (*d3dintf->effect.set_texture)(curr_effect, "Diffuse", focus_enable ? texture1[poly->texture->target_index] : texture2[poly->texture->target_index]); |
| 1318 | | (*d3dintf->effect.set_texture)(curr_effect, "LastPass", focus_enable ? texture1[poly->texture->target_index] : texture2[poly->texture->target_index]); |
| 1530 | if(options->params_dirty) |
| 1531 | { |
| 1532 | (*d3dintf->effect.set_texture)(curr_effect, "Diffuse", focus_enable ? texture1[poly->texture->target_index] : texture2[poly->texture->target_index]); |
| 1533 | (*d3dintf->effect.set_texture)(curr_effect, "LastPass", focus_enable ? texture1[poly->texture->target_index] : texture2[poly->texture->target_index]); |
| 1534 | } |
| 1319 | 1535 | |
| 1320 | 1536 | result = (*d3dintf->device.set_render_target)(d3d->device, 0, last_target[poly->texture->target_index]); |
| 1321 | 1537 | if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device set_render_target call 5\n", (int)result); |
| r11928 | r11929 | |
| 1365 | 1581 | |
| 1366 | 1582 | (*d3dintf->effect.set_texture)(curr_effect, "Diffuse", texture0[poly->texture->target_index]); |
| 1367 | 1583 | |
| 1368 | | (*d3dintf->effect.set_float)(curr_effect, "SnapX", snap_width); |
| 1369 | | (*d3dintf->effect.set_float)(curr_effect, "SnapY", snap_height); |
| 1370 | 1584 | result = (*d3dintf->device.set_render_target)(d3d->device, 0, snap_target); |
| 1371 | 1585 | if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device set_render_target call\n", (int)result); |
| 1372 | 1586 | |
| r11928 | r11929 | |
| 1408 | 1622 | (*d3dintf->effect.end)(curr_effect); |
| 1409 | 1623 | |
| 1410 | 1624 | poly->texture->cur_frame++; |
| 1411 | | poly->texture->cur_frame %= winoptions.screen_yiq_phase_count(); |
| 1625 | poly->texture->cur_frame %= options->yiq_phase_count; |
| 1626 | |
| 1627 | options->params_dirty = false; |
| 1412 | 1628 | } |
| 1413 | 1629 | else |
| 1414 | 1630 | { |
| r11928 | r11929 | |
| 1598 | 1814 | int idx = registered_targets; |
| 1599 | 1815 | |
| 1600 | 1816 | // Find the nearest prescale factor that is over our screen size |
| 1601 | | int hlsl_prescale_x = 1; |
| 1602 | | while(scwidth * hlsl_prescale_x < d3d->width) hlsl_prescale_x++; |
| 1603 | | prescale_size_x = hlsl_prescale_x; |
| 1817 | int hlsl_prescale_x = prescale_force_x ? prescale_force_x : 1; |
| 1818 | if(!prescale_force_x) |
| 1819 | { |
| 1820 | while(scwidth * hlsl_prescale_x < d3d->width) hlsl_prescale_x++; |
| 1821 | prescale_size_x = hlsl_prescale_x; |
| 1822 | } |
| 1604 | 1823 | |
| 1605 | | int hlsl_prescale_y = 1; |
| 1606 | | while(scheight * hlsl_prescale_y < d3d->height) hlsl_prescale_y++; |
| 1607 | | prescale_size_y = hlsl_prescale_y; |
| 1824 | int hlsl_prescale_y = prescale_force_y ? prescale_force_y : 1; |
| 1825 | if(!prescale_force_y) |
| 1826 | { |
| 1827 | while(scheight * hlsl_prescale_y < d3d->height) hlsl_prescale_y++; |
| 1828 | prescale_size_y = hlsl_prescale_y; |
| 1829 | } |
| 1608 | 1830 | |
| 1609 | 1831 | HRESULT result = (*d3dintf->device.create_texture)(d3d->device, scwidth * hlsl_prescale_x, scheight * hlsl_prescale_y, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &texture0[idx]); |
| 1610 | 1832 | if (result != D3D_OK) |
| r11928 | r11929 | |
| 1669 | 1891 | int idx = registered_targets; |
| 1670 | 1892 | |
| 1671 | 1893 | // Find the nearest prescale factor that is over our screen size |
| 1672 | | int hlsl_prescale_x = 1; |
| 1673 | | while(texture->rawwidth * hlsl_prescale_x < d3d->width) hlsl_prescale_x++; |
| 1674 | | prescale_size_x = hlsl_prescale_x; |
| 1894 | int hlsl_prescale_x = prescale_force_x ? prescale_force_x : 1; |
| 1895 | if(!prescale_force_x) |
| 1896 | { |
| 1897 | while(texture->rawwidth * hlsl_prescale_x < d3d->width) hlsl_prescale_x++; |
| 1898 | prescale_size_x = hlsl_prescale_x; |
| 1899 | } |
| 1675 | 1900 | |
| 1676 | | int hlsl_prescale_y = 1; |
| 1677 | | while(texture->rawheight * hlsl_prescale_y < d3d->height) hlsl_prescale_y++; |
| 1678 | | prescale_size_y = hlsl_prescale_y; |
| 1901 | int hlsl_prescale_y = prescale_force_y ? prescale_force_y : 1; |
| 1902 | if(!prescale_force_y) |
| 1903 | { |
| 1904 | while(texture->rawheight * hlsl_prescale_y < d3d->height) hlsl_prescale_y++; |
| 1905 | prescale_size_y = hlsl_prescale_y; |
| 1906 | } |
| 1679 | 1907 | |
| 1680 | 1908 | HRESULT result = (*d3dintf->device.create_texture)(d3d->device, texture->rawwidth * hlsl_prescale_x, texture->rawheight * hlsl_prescale_y, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &texture0[idx]); |
| 1681 | 1909 | if (result != D3D_OK) |
| r11928 | r11929 | |
| 1735 | 1963 | if (!master_enable || !d3dintf->post_fx_available) |
| 1736 | 1964 | return; |
| 1737 | 1965 | |
| 1966 | emu_file file(downcast<windows_options &>(window->machine().options()).screen_post_fx_dir(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); |
| 1967 | file_error filerr = open_next((d3d_info*)window->drawdata, file, downcast<windows_options &>(window->machine().options()).hlsl_ini_name(), "ini", 0); |
| 1968 | |
| 1969 | if (filerr != FILERR_NONE) |
| 1970 | return; |
| 1971 | |
| 1972 | file.printf("hlsl_enable %d\n", master_enable ? 1 : 0); |
| 1973 | file.printf("hlsl_prescale_x %d\n", prescale_force_x); |
| 1974 | file.printf("hlsl_prescale_y %d\n", prescale_force_y); |
| 1975 | file.printf("hlsl_preset %d\n", preset); |
| 1976 | file.printf("hlsl_snap_width %d\n", snap_width); |
| 1977 | file.printf("hlsl_snap_height %d\n", snap_height); |
| 1978 | file.printf("shadow_mask_alpha %f\n", options->shadow_mask_alpha); |
| 1979 | file.printf("shadow_mask_texture %s\n", options->shadow_mask_texture); |
| 1980 | file.printf("shadow_mask_x_count %d\n", options->shadow_mask_count_x); |
| 1981 | file.printf("shadow_mask_y_count %d\n", options->shadow_mask_count_y); |
| 1982 | file.printf("shadow_mask_usize %f\n", options->shadow_mask_u_size); |
| 1983 | file.printf("shadow_mask_vsize %f\n", options->shadow_mask_v_size); |
| 1984 | file.printf("curvature %f\n", options->curvature); |
| 1985 | file.printf("pincushion %f\n", options->pincushion); |
| 1986 | file.printf("scanline_alpha %f\n", options->scanline_alpha); |
| 1987 | file.printf("scanline_size %f\n", options->scanline_scale); |
| 1988 | file.printf("scanline_height %f\n", options->scanline_height); |
| 1989 | file.printf("scanline_bright_scale %f\n", options->scanline_bright_scale); |
| 1990 | file.printf("scanline_bright_offset %f\n", options->scanline_bright_offset); |
| 1991 | file.printf("scanline_jitter %f\n", options->scanline_offset); |
| 1992 | file.printf("defocus %f,%f\n", options->defocus[0], options->defocus[1]); |
| 1993 | file.printf("converge_x %f,%f,%f\n", options->converge_x[0], options->converge_x[1], options->converge_x[2]); |
| 1994 | file.printf("converge_y %f,%f,%f\n", options->converge_y[0], options->converge_y[1], options->converge_y[2]); |
| 1995 | file.printf("radial_converge_x %f,%f,%f\n", options->radial_converge_x[0], options->radial_converge_x[1], options->radial_converge_x[2]); |
| 1996 | file.printf("radial_converge_y %f,%f,%f\n", options->radial_converge_y[0], options->radial_converge_y[1], options->radial_converge_y[2]); |
| 1997 | file.printf("red_ratio %f,%f,%f\n", options->red_ratio[0], options->red_ratio[1], options->red_ratio[2]); |
| 1998 | file.printf("grn_ratio %f,%f,%f\n", options->grn_ratio[0], options->grn_ratio[1], options->grn_ratio[2]); |
| 1999 | file.printf("blu_ratio %f,%f,%f\n", options->blu_ratio[0], options->blu_ratio[1], options->blu_ratio[2]); |
| 2000 | file.printf("saturation %f\n", options->saturation); |
| 2001 | file.printf("offset %f,%f,%f\n", options->offset[0], options->offset[1], options->offset[2]); |
| 2002 | file.printf("scale %f,%f,%f\n", options->scale[0], options->scale[1], options->scale[2]); |
| 2003 | file.printf("power %f,%f,%f\n", options->power[0], options->power[1], options->power[2]); |
| 2004 | file.printf("floor %f,%f,%f\n", options->floor[0], options->floor[1], options->floor[2]); |
| 2005 | file.printf("phosphor_life %f,%f,%f\n", options->phosphor[0], options->phosphor[1], options->phosphor[2]); |
| 2006 | file.printf("yiq_enable %d\n", options->yiq_enable ? 1 : 0); |
| 2007 | file.printf("yiq_cc %f\n", options->yiq_cc); |
| 2008 | file.printf("yiq_a %f\n", options->yiq_a); |
| 2009 | file.printf("yiq_b %f\n", options->yiq_b); |
| 2010 | file.printf("yiq_o %f\n", options->yiq_o); |
| 2011 | file.printf("yiq_p %f\n", options->yiq_p); |
| 2012 | file.printf("yiq_n %f\n", options->yiq_n); |
| 2013 | file.printf("yiq_y %f\n", options->yiq_y); |
| 2014 | file.printf("yiq_i %f\n", options->yiq_i); |
| 2015 | file.printf("yiq_q %f\n", options->yiq_q); |
| 2016 | file.printf("yiq_scan_time %f\n", options->yiq_scan_time); |
| 2017 | file.printf("yiq_phase_count %d\n", options->yiq_phase_count); |
| 2018 | |
| 1738 | 2019 | if (effect != NULL) |
| 1739 | 2020 | { |
| 1740 | 2021 | (*d3dintf->effect.release)(effect); |
| r11928 | r11929 | |
| 1988 | 2269 | hlsl_options *options = (hlsl_options*)arg; |
| 1989 | 2270 | if (newval != SLIDER_NOCHANGE) options->shadow_mask_count_x = newval; |
| 1990 | 2271 | if (string != NULL) string->printf("%d", options->shadow_mask_count_x); |
| 2272 | options->params_dirty = true; |
| 1991 | 2273 | return options->shadow_mask_count_x; |
| 1992 | 2274 | } |
| 1993 | 2275 | |
| r11928 | r11929 | |
| 1996 | 2278 | hlsl_options *options = (hlsl_options*)arg; |
| 1997 | 2279 | if (newval != SLIDER_NOCHANGE) options->shadow_mask_count_y = newval; |
| 1998 | 2280 | if (string != NULL) string->printf("%d", options->shadow_mask_count_y); |
| 2281 | options->params_dirty = true; |
| 1999 | 2282 | return options->shadow_mask_count_y; |
| 2000 | 2283 | } |
| 2001 | 2284 | |
| 2002 | 2285 | static INT32 slider_shadow_mask_usize(running_machine &machine, void *arg, astring *string, INT32 newval) |
| 2003 | 2286 | { |
| 2287 | ((hlsl_options*)arg)->params_dirty = true; |
| 2004 | 2288 | return slider_set(&(((hlsl_options*)arg)->shadow_mask_u_size), 1.0f / 32.0f, "%2.5f", string, newval); |
| 2005 | 2289 | } |
| 2006 | 2290 | |
| 2007 | 2291 | static INT32 slider_shadow_mask_vsize(running_machine &machine, void *arg, astring *string, INT32 newval) |
| 2008 | 2292 | { |
| 2293 | ((hlsl_options*)arg)->params_dirty = true; |
| 2009 | 2294 | return slider_set(&(((hlsl_options*)arg)->shadow_mask_v_size), 1.0f / 32.0f, "%2.5f", string, newval); |
| 2010 | 2295 | } |
| 2011 | 2296 | |
| 2012 | 2297 | static INT32 slider_curvature(running_machine &machine, void *arg, astring *string, INT32 newval) |
| 2013 | 2298 | { |
| 2299 | ((hlsl_options*)arg)->params_dirty = true; |
| 2014 | 2300 | return slider_set(&(((hlsl_options*)arg)->curvature), 0.01f, "%2.2f", string, newval); |
| 2015 | 2301 | } |
| 2016 | 2302 | |
| 2017 | 2303 | static INT32 slider_pincushion(running_machine &machine, void *arg, astring *string, INT32 newval) |
| 2018 | 2304 | { |
| 2305 | ((hlsl_options*)arg)->params_dirty = true; |
| 2019 | 2306 | return slider_set(&(((hlsl_options*)arg)->pincushion), 0.01f, "%2.2f", string, newval); |
| 2020 | 2307 | } |
| 2021 | 2308 | |
| 2022 | 2309 | static INT32 slider_scanline_alpha(running_machine &machine, void *arg, astring *string, INT32 newval) |
| 2023 | 2310 | { |
| 2311 | ((hlsl_options*)arg)->params_dirty = true; |
| 2024 | 2312 | return slider_set(&(((hlsl_options*)arg)->scanline_alpha), 0.01f, "%2.2f", string, newval); |
| 2025 | 2313 | } |
| 2026 | 2314 | |
| 2027 | 2315 | static INT32 slider_scanline_scale(running_machine &machine, void *arg, astring *string, INT32 newval) |
| 2028 | 2316 | { |
| 2317 | ((hlsl_options*)arg)->params_dirty = true; |
| 2029 | 2318 | return slider_set(&(((hlsl_options*)arg)->scanline_scale), 0.05f, "%2.2f", string, newval); |
| 2030 | 2319 | } |
| 2031 | 2320 | |
| 2032 | 2321 | static INT32 slider_scanline_height(running_machine &machine, void *arg, astring *string, INT32 newval) |
| 2033 | 2322 | { |
| 2323 | ((hlsl_options*)arg)->params_dirty = true; |
| 2034 | 2324 | return slider_set(&(((hlsl_options*)arg)->scanline_height), 0.05f, "%2.2f", string, newval); |
| 2035 | 2325 | } |
| 2036 | 2326 | |
| 2037 | 2327 | static INT32 slider_scanline_bright_scale(running_machine &machine, void *arg, astring *string, INT32 newval) |
| 2038 | 2328 | { |
| 2329 | ((hlsl_options*)arg)->params_dirty = true; |
| 2039 | 2330 | return slider_set(&(((hlsl_options*)arg)->scanline_bright_scale), 0.05f, "%2.2f", string, newval); |
| 2040 | 2331 | } |
| 2041 | 2332 | |
| 2042 | 2333 | static INT32 slider_scanline_bright_offset(running_machine &machine, void *arg, astring *string, INT32 newval) |
| 2043 | 2334 | { |
| 2335 | ((hlsl_options*)arg)->params_dirty = true; |
| 2044 | 2336 | return slider_set(&(((hlsl_options*)arg)->scanline_bright_offset), 0.05f, "%2.2f", string, newval); |
| 2045 | 2337 | } |
| 2046 | 2338 | |
| 2047 | 2339 | static INT32 slider_scanline_offset(running_machine &machine, void *arg, astring *string, INT32 newval) |
| 2048 | 2340 | { |
| 2341 | ((hlsl_options*)arg)->params_dirty = true; |
| 2049 | 2342 | return slider_set(&(((hlsl_options*)arg)->scanline_offset), 0.05f, "%2.2f", string, newval); |
| 2050 | 2343 | } |
| 2051 | 2344 | |
| 2052 | 2345 | static INT32 slider_defocus_x(running_machine &machine, void *arg, astring *string, INT32 newval) |
| 2053 | 2346 | { |
| 2347 | ((hlsl_options*)arg)->params_dirty = true; |
| 2054 | 2348 | return slider_set(&(((hlsl_options*)arg)->defocus[0]), 0.5f, "%2.1f", string, newval); |
| 2055 | 2349 | } |
| 2056 | 2350 | |
| 2057 | 2351 | static INT32 slider_defocus_y(running_machine &machine, void *arg, astring *string, INT32 newval) |
| 2058 | 2352 | { |
| 2353 | ((hlsl_options*)arg)->params_dirty = true; |
| 2059 | 2354 | return slider_set(&(((hlsl_options*)arg)->defocus[1]), 0.5f, "%2.1f", string, newval); |
| 2060 | 2355 | } |
| 2061 | 2356 | |
| 2062 | 2357 | static INT32 slider_post_defocus_x(running_machine &machine, void *arg, astring *string, INT32 newval) |
| 2063 | 2358 | { |
| 2359 | ((hlsl_options*)arg)->params_dirty = true; |
| 2064 | 2360 | return slider_set(&(((hlsl_options*)arg)->defocus[2]), 0.5f, "%2.1f", string, newval); |
| 2065 | 2361 | } |
| 2066 | 2362 | |
| 2067 | 2363 | static INT32 slider_post_defocus_y(running_machine &machine, void *arg, astring *string, INT32 newval) |
| 2068 | 2364 | { |
| 2365 | ((hlsl_options*)arg)->params_dirty = true; |
| 2069 | 2366 | return slider_set(&(((hlsl_options*)arg)->defocus[3]), 0.5f, "%2.1f", string, newval); |
| 2070 | 2367 | } |
| 2071 | 2368 | |
| 2072 | 2369 | static INT32 slider_red_converge_x(running_machine &machine, void *arg, astring *string, INT32 newval) |
| 2073 | 2370 | { |
| 2371 | ((hlsl_options*)arg)->params_dirty = true; |
| 2074 | 2372 | return slider_set(&(((hlsl_options*)arg)->converge_x[0]), 0.1f, "%3.1f", string, newval); |
| 2075 | 2373 | } |
| 2076 | 2374 | |
| 2077 | 2375 | static INT32 slider_red_converge_y(running_machine &machine, void *arg, astring *string, INT32 newval) |
| 2078 | 2376 | { |
| 2377 | ((hlsl_options*)arg)->params_dirty = true; |
| 2079 | 2378 | return slider_set(&(((hlsl_options*)arg)->converge_y[0]), 0.1f, "%3.1f", string, newval); |
| 2080 | 2379 | } |
| 2081 | 2380 | |
| 2082 | 2381 | static INT32 slider_green_converge_x(running_machine &machine, void *arg, astring *string, INT32 newval) |
| 2083 | 2382 | { |
| 2383 | ((hlsl_options*)arg)->params_dirty = true; |
| 2084 | 2384 | return slider_set(&(((hlsl_options*)arg)->converge_x[1]), 0.1f, "%3.1f", string, newval); |
| 2085 | 2385 | } |
| 2086 | 2386 | |
| 2087 | 2387 | static INT32 slider_green_converge_y(running_machine &machine, void *arg, astring *string, INT32 newval) |
| 2088 | 2388 | { |
| 2389 | ((hlsl_options*)arg)->params_dirty = true; |
| 2089 | 2390 | return slider_set(&(((hlsl_options*)arg)->converge_y[1]), 0.1f, "%3.1f", string, newval); |
| 2090 | 2391 | } |
| 2091 | 2392 | |
| 2092 | 2393 | static INT32 slider_blue_converge_x(running_machine &machine, void *arg, astring *string, INT32 newval) |
| 2093 | 2394 | { |
| 2395 | ((hlsl_options*)arg)->params_dirty = true; |
| 2094 | 2396 | return slider_set(&(((hlsl_options*)arg)->converge_x[2]), 0.1f, "%3.1f", string, newval); |
| 2095 | 2397 | } |
| 2096 | 2398 | |
| 2097 | 2399 | static INT32 slider_blue_converge_y(running_machine &machine, void *arg, astring *string, INT32 newval) |
| 2098 | 2400 | { |
| 2401 | ((hlsl_options*)arg)->params_dirty = true; |
| 2099 | 2402 | return slider_set(&(((hlsl_options*)arg)->converge_y[2]), 0.1f, "%3.1f", string, newval); |
| 2100 | 2403 | } |
| 2101 | 2404 | |
| 2102 | 2405 | static INT32 slider_red_radial_converge_x(running_machine &machine, void *arg, astring *string, INT32 newval) |
| 2103 | 2406 | { |
| 2407 | ((hlsl_options*)arg)->params_dirty = true; |
| 2104 | 2408 | return slider_set(&(((hlsl_options*)arg)->radial_converge_x[0]), 0.1f, "%3.1f", string, newval); |
| 2105 | 2409 | } |
| 2106 | 2410 | |
| 2107 | 2411 | static INT32 slider_red_radial_converge_y(running_machine &machine, void *arg, astring *string, INT32 newval) |
| 2108 | 2412 | { |
| 2413 | ((hlsl_options*)arg)->params_dirty = true; |
| 2109 | 2414 | return slider_set(&(((hlsl_options*)arg)->radial_converge_y[0]), 0.1f, "%3.1f", string, newval); |
| 2110 | 2415 | } |
| 2111 | 2416 | |
| 2112 | 2417 | static INT32 slider_green_radial_converge_x(running_machine &machine, void *arg, astring *string, INT32 newval) |
| 2113 | 2418 | { |
| 2419 | ((hlsl_options*)arg)->params_dirty = true; |
| 2114 | 2420 | return slider_set(&(((hlsl_options*)arg)->radial_converge_x[1]), 0.1f, "%3.1f", string, newval); |
| 2115 | 2421 | } |
| 2116 | 2422 | |
| 2117 | 2423 | static INT32 slider_green_radial_converge_y(running_machine &machine, void *arg, astring *string, INT32 newval) |
| 2118 | 2424 | { |
| 2425 | ((hlsl_options*)arg)->params_dirty = true; |
| 2119 | 2426 | return slider_set(&(((hlsl_options*)arg)->radial_converge_y[1]), 0.1f, "%3.1f", string, newval); |
| 2120 | 2427 | } |
| 2121 | 2428 | |
| 2122 | 2429 | static INT32 slider_blue_radial_converge_x(running_machine &machine, void *arg, astring *string, INT32 newval) |
| 2123 | 2430 | { |
| 2431 | ((hlsl_options*)arg)->params_dirty = true; |
| 2124 | 2432 | return slider_set(&(((hlsl_options*)arg)->radial_converge_x[2]), 0.1f, "%3.1f", string, newval); |
| 2125 | 2433 | } |
| 2126 | 2434 | |
| 2127 | 2435 | static INT32 slider_blue_radial_converge_y(running_machine &machine, void *arg, astring *string, INT32 newval) |
| 2128 | 2436 | { |
| 2437 | ((hlsl_options*)arg)->params_dirty = true; |
| 2129 | 2438 | return slider_set(&(((hlsl_options*)arg)->radial_converge_y[2]), 0.1f, "%3.1f", string, newval); |
| 2130 | 2439 | } |
| 2131 | 2440 | |
| 2132 | 2441 | static INT32 slider_red_from_r(running_machine &machine, void *arg, astring *string, INT32 newval) |
| 2133 | 2442 | { |
| 2443 | ((hlsl_options*)arg)->params_dirty = true; |
| 2134 | 2444 | return slider_set(&(((hlsl_options*)arg)->red_ratio[0]), 0.005f, "%2.3f", string, newval); |
| 2135 | 2445 | } |
| 2136 | 2446 | |
| 2137 | 2447 | static INT32 slider_red_from_g(running_machine &machine, void *arg, astring *string, INT32 newval) |
| 2138 | 2448 | { |
| 2449 | ((hlsl_options*)arg)->params_dirty = true; |
| 2139 | 2450 | return slider_set(&(((hlsl_options*)arg)->red_ratio[1]), 0.005f, "%2.3f", string, newval); |
| 2140 | 2451 | } |
| 2141 | 2452 | |
| 2142 | 2453 | static INT32 slider_red_from_b(running_machine &machine, void *arg, astring *string, INT32 newval) |
| 2143 | 2454 | { |
| 2455 | ((hlsl_options*)arg)->params_dirty = true; |
| 2144 | 2456 | return slider_set(&(((hlsl_options*)arg)->red_ratio[2]), 0.005f, "%2.3f", string, newval); |
| 2145 | 2457 | } |
| 2146 | 2458 | |
| 2147 | 2459 | static INT32 slider_green_from_r(running_machine &machine, void *arg, astring *string, INT32 newval) |
| 2148 | 2460 | { |
| 2461 | ((hlsl_options*)arg)->params_dirty = true; |
| 2149 | 2462 | return slider_set(&(((hlsl_options*)arg)->grn_ratio[0]), 0.005f, "%2.3f", string, newval); |
| 2150 | 2463 | } |
| 2151 | 2464 | |
| 2152 | 2465 | static INT32 slider_green_from_g(running_machine &machine, void *arg, astring *string, INT32 newval) |
| 2153 | 2466 | { |
| 2467 | ((hlsl_options*)arg)->params_dirty = true; |
| 2154 | 2468 | return slider_set(&(((hlsl_options*)arg)->grn_ratio[1]), 0.005f, "%2.3f", string, newval); |
| 2155 | 2469 | } |
| 2156 | 2470 | |
| 2157 | 2471 | static INT32 slider_green_from_b(running_machine &machine, void *arg, astring *string, INT32 newval) |
| 2158 | 2472 | { |
| 2473 | ((hlsl_options*)arg)->params_dirty = true; |
| 2159 | 2474 | return slider_set(&(((hlsl_options*)arg)->grn_ratio[2]), 0.005f, "%2.3f", string, newval); |
| 2160 | 2475 | } |
| 2161 | 2476 | |
| 2162 | 2477 | static INT32 slider_blue_from_r(running_machine &machine, void *arg, astring *string, INT32 newval) |
| 2163 | 2478 | { |
| 2479 | ((hlsl_options*)arg)->params_dirty = true; |
| 2164 | 2480 | return slider_set(&(((hlsl_options*)arg)->blu_ratio[0]), 0.005f, "%2.3f", string, newval); |
| 2165 | 2481 | } |
| 2166 | 2482 | |
| 2167 | 2483 | static INT32 slider_blue_from_g(running_machine &machine, void *arg, astring *string, INT32 newval) |
| 2168 | 2484 | { |
| 2485 | ((hlsl_options*)arg)->params_dirty = true; |
| 2169 | 2486 | return slider_set(&(((hlsl_options*)arg)->blu_ratio[1]), 0.005f, "%2.3f", string, newval); |
| 2170 | 2487 | } |
| 2171 | 2488 | |
| 2172 | 2489 | static INT32 slider_blue_from_b(running_machine &machine, void *arg, astring *string, INT32 newval) |
| 2173 | 2490 | { |
| 2491 | ((hlsl_options*)arg)->params_dirty = true; |
| 2174 | 2492 | return slider_set(&(((hlsl_options*)arg)->blu_ratio[2]), 0.005f, "%2.3f", string, newval); |
| 2175 | 2493 | } |
| 2176 | 2494 | |
| 2177 | 2495 | static INT32 slider_red_offset(running_machine &machine, void *arg, astring *string, INT32 newval) |
| 2178 | 2496 | { |
| 2497 | ((hlsl_options*)arg)->params_dirty = true; |
| 2179 | 2498 | return slider_set(&(((hlsl_options*)arg)->offset[0]), 0.01f, "%2.2f", string, newval); |
| 2180 | 2499 | } |
| 2181 | 2500 | |
| 2182 | 2501 | static INT32 slider_green_offset(running_machine &machine, void *arg, astring *string, INT32 newval) |
| 2183 | 2502 | { |
| 2503 | ((hlsl_options*)arg)->params_dirty = true; |
| 2184 | 2504 | return slider_set(&(((hlsl_options*)arg)->offset[1]), 0.01f, "%2.2f", string, newval); |
| 2185 | 2505 | } |
| 2186 | 2506 | |
| 2187 | 2507 | static INT32 slider_blue_offset(running_machine &machine, void *arg, astring *string, INT32 newval) |
| 2188 | 2508 | { |
| 2509 | ((hlsl_options*)arg)->params_dirty = true; |
| 2189 | 2510 | return slider_set(&(((hlsl_options*)arg)->offset[2]), 0.01f, "%2.2f", string, newval); |
| 2190 | 2511 | } |
| 2191 | 2512 | |
| 2192 | 2513 | static INT32 slider_red_scale(running_machine &machine, void *arg, astring *string, INT32 newval) |
| 2193 | 2514 | { |
| 2515 | ((hlsl_options*)arg)->params_dirty = true; |
| 2194 | 2516 | return slider_set(&(((hlsl_options*)arg)->scale[0]), 0.01f, "%2.2f", string, newval); |
| 2195 | 2517 | } |
| 2196 | 2518 | |
| 2197 | 2519 | static INT32 slider_green_scale(running_machine &machine, void *arg, astring *string, INT32 newval) |
| 2198 | 2520 | { |
| 2521 | ((hlsl_options*)arg)->params_dirty = true; |
| 2199 | 2522 | return slider_set(&(((hlsl_options*)arg)->scale[1]), 0.01f, "%2.2f", string, newval); |
| 2200 | 2523 | } |
| 2201 | 2524 | |
| 2202 | 2525 | static INT32 slider_blue_scale(running_machine &machine, void *arg, astring *string, INT32 newval) |
| 2203 | 2526 | { |
| 2527 | ((hlsl_options*)arg)->params_dirty = true; |
| 2204 | 2528 | return slider_set(&(((hlsl_options*)arg)->scale[2]), 0.01f, "%2.2f", string, newval); |
| 2205 | 2529 | } |
| 2206 | 2530 | |
| 2207 | 2531 | static INT32 slider_red_power(running_machine &machine, void *arg, astring *string, INT32 newval) |
| 2208 | 2532 | { |
| 2533 | ((hlsl_options*)arg)->params_dirty = true; |
| 2209 | 2534 | return slider_set(&(((hlsl_options*)arg)->power[0]), 0.05f, "%2.2f", string, newval); |
| 2210 | 2535 | } |
| 2211 | 2536 | |
| 2212 | 2537 | static INT32 slider_green_power(running_machine &machine, void *arg, astring *string, INT32 newval) |
| 2213 | 2538 | { |
| 2539 | ((hlsl_options*)arg)->params_dirty = true; |
| 2214 | 2540 | return slider_set(&(((hlsl_options*)arg)->power[1]), 0.05f, "%2.2f", string, newval); |
| 2215 | 2541 | } |
| 2216 | 2542 | |
| 2217 | 2543 | static INT32 slider_blue_power(running_machine &machine, void *arg, astring *string, INT32 newval) |
| 2218 | 2544 | { |
| 2545 | ((hlsl_options*)arg)->params_dirty = true; |
| 2219 | 2546 | return slider_set(&(((hlsl_options*)arg)->power[2]), 0.05f, "%2.2f", string, newval); |
| 2220 | 2547 | } |
| 2221 | 2548 | |
| 2222 | 2549 | static INT32 slider_red_floor(running_machine &machine, void *arg, astring *string, INT32 newval) |
| 2223 | 2550 | { |
| 2551 | ((hlsl_options*)arg)->params_dirty = true; |
| 2224 | 2552 | return slider_set(&(((hlsl_options*)arg)->floor[0]), 0.01f, "%2.2f", string, newval); |
| 2225 | 2553 | } |
| 2226 | 2554 | |
| 2227 | 2555 | static INT32 slider_green_floor(running_machine &machine, void *arg, astring *string, INT32 newval) |
| 2228 | 2556 | { |
| 2557 | ((hlsl_options*)arg)->params_dirty = true; |
| 2229 | 2558 | return slider_set(&(((hlsl_options*)arg)->floor[1]), 0.01f, "%2.2f", string, newval); |
| 2230 | 2559 | } |
| 2231 | 2560 | |
| 2232 | 2561 | static INT32 slider_blue_floor(running_machine &machine, void *arg, astring *string, INT32 newval) |
| 2233 | 2562 | { |
| 2563 | ((hlsl_options*)arg)->params_dirty = true; |
| 2234 | 2564 | return slider_set(&(((hlsl_options*)arg)->floor[2]), 0.01f, "%2.2f", string, newval); |
| 2235 | 2565 | } |
| 2236 | 2566 | |
| 2237 | 2567 | static INT32 slider_red_phosphor_life(running_machine &machine, void *arg, astring *string, INT32 newval) |
| 2238 | 2568 | { |
| 2569 | ((hlsl_options*)arg)->params_dirty = true; |
| 2239 | 2570 | return slider_set(&(((hlsl_options*)arg)->phosphor[0]), 0.01f, "%2.2f", string, newval); |
| 2240 | 2571 | } |
| 2241 | 2572 | |
| 2242 | 2573 | static INT32 slider_green_phosphor_life(running_machine &machine, void *arg, astring *string, INT32 newval) |
| 2243 | 2574 | { |
| 2575 | ((hlsl_options*)arg)->params_dirty = true; |
| 2244 | 2576 | return slider_set(&(((hlsl_options*)arg)->phosphor[1]), 0.01f, "%2.2f", string, newval); |
| 2245 | 2577 | } |
| 2246 | 2578 | |
| 2247 | 2579 | static INT32 slider_blue_phosphor_life(running_machine &machine, void *arg, astring *string, INT32 newval) |
| 2248 | 2580 | { |
| 2581 | ((hlsl_options*)arg)->params_dirty = true; |
| 2249 | 2582 | return slider_set(&(((hlsl_options*)arg)->phosphor[2]), 0.01f, "%2.2f", string, newval); |
| 2250 | 2583 | } |
| 2251 | 2584 | |
| 2252 | 2585 | static INT32 slider_saturation(running_machine &machine, void *arg, astring *string, INT32 newval) |
| 2253 | 2586 | { |
| 2587 | ((hlsl_options*)arg)->params_dirty = true; |
| 2254 | 2588 | return slider_set(&(((hlsl_options*)arg)->saturation), 0.01f, "%2.2f", string, newval); |
| 2255 | 2589 | } |
| 2256 | 2590 | |
| r11928 | r11929 | |
| 2346 | 2680 | // scheme |
| 2347 | 2681 | //------------------------------------------------- |
| 2348 | 2682 | |
| 2349 | | static file_error open_next(d3d_info *d3d, emu_file &file, const char *extension, int idx) |
| 2683 | static file_error open_next(d3d_info *d3d, emu_file &file, const char *templ, const char *extension, int idx) |
| 2350 | 2684 | { |
| 2351 | 2685 | UINT32 origflags = file.openflags(); |
| 2352 | 2686 | |
| 2353 | 2687 | // handle defaults |
| 2354 | | const char *snapname = d3d->window->machine().options().snap_name(); |
| 2688 | const char *snapname = templ ? templ : d3d->window->machine().options().snap_name(); |
| 2355 | 2689 | |
| 2356 | 2690 | if (snapname == NULL || snapname[0] == 0) |
| 2357 | 2691 | snapname = "%g/%i"; |