Dolphin, the GameCube and Wii emulator - Forums

Full Version: [UNOFFICIAL] Ishiiruka-Dolphin Custom Version
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 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
@masterotaku: if you give more detail on the values you tweak i can see if a native modification framework can be added internally to make thos changes more user friendly.
@Ramoth: interesting will take a look.
(10-04-2015, 11:03 PM)Tino Wrote: [ -> ]@masterotaku: if you give more detail on the values you tweak i can see if a native modification framework can be added internally to make thos changes more user friendly.

OK. Here's the content of a vertex shader that controls some shadows in Zelda Majora's Mask, called "36825a742c3b0f39-vs_replace.txt":

Code:
//Zelda MM: shadow behind maks in walls, Skulltulas house.
cbuffer _Globals : register(b0)
{
 float4 cproj[4] : packoffset(c0);
 float4 cmtrl[4] : packoffset(c4);
 float4 clights[40] : packoffset(c8);
 float4 ctexmtx[24] : packoffset(c48);
 float4 ctrmtx[64] : packoffset(c72);
 float4 cnmtx[32] : packoffset(c136);
 float4 cpostmtx[64] : packoffset(c168);
 float4 cDepth : packoffset(c232);
 float4 cPLOffset[13] : packoffset(c233);
}

Texture2D<float4> StereoParams : register(t125);
Texture1D<float4> IniParams : register(t120);

void main(
 float4 v0 : COLOR0,
 float2 v1 : TEXCOORD0,
 float4 v2 : BLENDINDICES0,
 float4 v3 : POSITION0,
 out float4 o0 : SV_Position0,
 out float4 o1 : COLOR0,
 out float4 o2 : COLOR1,
 out float4 o3 : TEXCOORD0,
 out float4 o4 : TEXCOORD1)
{
 float4 r0,r1;
 uint4 bitmask, uiDest;
 float4 fDest;

 float4 iniparams = IniParams.Load(0);
 
 r0.x = 255 * v2.x;
 r0.x = (int)r0.x;
 r0.yz = (int2)r0.xx + int2(1,2);
 r1.x = dot(ctrmtx[r0.x].xyzw, v3.xyzw);
 r1.y = dot(ctrmtx[r0.y].xyzw, v3.xyzw);
 r1.z = dot(ctrmtx[r0.z].xyzw, v3.xyzw);
 r1.w = 1;
 r0.x = dot(cproj[0].xyzw, r1.xyzw)*iniparams.x;
 r0.y = dot(cproj[1].xyzw, r1.xyzw)*iniparams.y;
 r0.z = dot(cproj[3].xyzw, r1.xyzw);
 r0.w = dot(cproj[2].xyzw, r1.xyzw);
 o3.xy = r1.xy;
 o4.w = r1.z;
 o0.xy = r0.zz * cDepth.zw + r0.xy;
 r0.x = cDepth.y * r0.w;
 r0.y = cDepth.x + -1;
 r0.x = r0.y * r0.z + r0.x;
 o0.z = -r0.x;
 o0.w = r0.z;
 o3.zw = r0.wz;
 o1.xyzw = v0.xyzw;
 o2.xyzw = v0.xyzw;
 o4.xyz = float3(0,0,0);
 return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.20789
//
//   using 3Dmigoto v1.2.1 on Thu Sep 03 21:58:09 2015
//
//
// Buffer Definitions:
//
// cbuffer $Globals
// {
//
//   float4 cproj[4];                   // Offset:    0 Size:    64
//   float4 cmtrl[4];                   // Offset:   64 Size:    64 [unused]
//   float4 clights[40];                // Offset:  128 Size:   640 [unused]
//   float4 ctexmtx[24];                // Offset:  768 Size:   384 [unused]
//   float4 ctrmtx[64];                 // Offset: 1152 Size:  1024
//   float4 cnmtx[32];                  // Offset: 2176 Size:   512 [unused]
//   float4 cpostmtx[64];               // Offset: 2688 Size:  1024 [unused]
//   float4 cDepth;                     // Offset: 3712 Size:    16
//   float4 cPLOffset[13];              // Offset: 3728 Size:   208 [unused]
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// $Globals                          cbuffer      NA          NA    0        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// COLOR                    0   xyzw        0     NONE   float   xyzw
// TEXCOORD                 0   xy          1     NONE   float      
// BLENDINDICES             0   xyzw        2     NONE   float   x  
// POSITION                 0   xyzw        3     NONE   float   xyzw
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Position              0   xyzw        0      POS   float   xyzw
// COLOR                    0   xyzw        1     NONE   float   xyzw
// COLOR                    1   xyzw        2     NONE   float   xyzw
// TEXCOORD                 0   xyzw        3     NONE   float   xyzw
// TEXCOORD                 1   xyzw        4     NONE   float   xyzw
//
vs_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb0[233], dynamicIndexed
dcl_input v0.xyzw
dcl_input v2.x
dcl_input v3.xyzw
dcl_output_siv o0.xyzw, position
dcl_output o1.xyzw
dcl_output o2.xyzw
dcl_output o3.xyzw
dcl_output o4.xyzw
dcl_temps 2
mul r0.x, v2.x, l(255.000000)
ftoi r0.x, r0.x
iadd r0.yz, r0.xxxx, l(0, 1, 2, 0)
dp4 r1.x, cb0[r0.x + 72].xyzw, v3.xyzw
dp4 r1.y, cb0[r0.y + 72].xyzw, v3.xyzw
dp4 r1.z, cb0[r0.z + 72].xyzw, v3.xyzw
mov r1.w, l(1.000000)
dp4 r0.x, cb0[0].xyzw, r1.xyzw
dp4 r0.y, cb0[1].xyzw, r1.xyzw
dp4 r0.z, cb0[3].xyzw, r1.xyzw
dp4 r0.w, cb0[2].xyzw, r1.xyzw
mov o3.xy, r1.xyxx
mov o4.w, r1.z
mad o0.xy, r0.zzzz, cb0[232].zwzz, r0.xyxx
mul r0.x, r0.w, cb0[232].y
add r0.y, l(-1.000000), cb0[232].x
mad r0.x, r0.y, r0.z, r0.x
mov o0.z, -r0.x
mov o0.w, r0.z
mov o3.zw, r0.wwwz
mov o1.xyzw, v0.xyzw
mov o2.xyzw, v0.xyzw
mov o4.xyz, l(0,0,0,0)
ret
// Approximately 24 instruction slots used

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/

The ASM code at the bottom doesn't need to be touched. Only the HLSL part.

The important (and almost only) lines that I modified for the aspect ratio correction are these:
Code:
r0.x = dot(cproj[0].xyzw, r1.xyzw)*iniparams.x;
r0.y = dot(cproj[1].xyzw, r1.xyzw)*iniparams.y;

"iniparams.x" and "iniparams.y" are variables that I defined in the "d3dx.ini" file that comes with 3Dmigoto. I use a variable so I can change its value in real time with a hotkey, for aspect ratio changes in real time. However, that makes it work only with 3D Vision.

If I put the value manually, like "r0.x = dot(cproj[0].xyzw, r1.xyzw)*0.75;" (correction from 4:3 to 16:9. Lower values for wider aspect ratios), it works for all users even if they don't have 3D Vision.

The thing is that all vertex shaders that I modified for aspect ratio mods needed exactly the same changes. The "r0.x = dot(cproj[0].xyzw, r1.xyzw);r0.y = dot(cproj[1].xyzw, r1.xyzw);r0.z = dot(cproj[3].xyzw, r1.xyzw);r0.w = dot(cproj[2].xyzw, r1.xyzw);" lines are always there. So if I had access to the source of the projection, I would be able to change all shaders at the same time.

Ideally, it would be like an improved widescreen hack that works with every game and leaves the HUD and menu elements with the correct aspect ratio. If it were done that way, I don't know if I would still need to make exceptions to some shaders (in some cases, some shaders needed to apply to the entire screen and not be corrected. Exceptions that do need 3D Vision to work because they use variables).
Hey Tino, I found another game with weird depth access Geist . So, while your in a cutscene, ssao/SSGi works perfectly fine as it should, but while in gameplay, it only shadows a weird line in the middle of the screen and not the environment. o.o

EDIT: It got much weirder. I'll post a video in a second.
@rlaugh0095: one of the post processing shaders is called Depth please select that shader and send a screenshot of the output
Tino ive got a question. would the changes made to this version of the emulator cause TAS to desync? Cause i want to make TAS but play it back using ishiiruka so that i can have that glorious quality.
@CowlScatman: no idea never tested, you will help me if you test and let me kenow if you have any issues
(10-06-2015, 02:52 AM)Tino Wrote: [ -> ]@CowlScatman: no idea never tested, you will help me if you test and let me kenow if you have any issues

i maid a quick TAS this morning using ishiiruka and when i tried to play it back it just gave me a buzzing sound. Im gonna try it without the shaders enabled.
Okay so the emulator itself just doesnt want to play back TAS input apparently. The game screen just turns white and buzzes as soon as i click it.
Pages: 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