@@ -688,6 +688,57 @@ curvehook(void)
688
688
}
689
689
#endif
690
690
691
+ unsigned __int64 rand_seed = 1 ;
692
+ float ps2randnormalize = 1 .0f /0x7FFFFFFF ;
693
+
694
+ int ps2rand ()
695
+ {
696
+ rand_seed = 0x5851F42D4C957F2D * rand_seed + 1 ;
697
+ return ((rand_seed >> 32 ) & 0x7FFFFFFF );
698
+ }
699
+
700
+ void ps2srand (unsigned int seed)
701
+ {
702
+ rand_seed = seed;
703
+ }
704
+
705
+ struct CVector { float x, y, z; };
706
+
707
+ WRAPPER void CParticle__AddParticle (int partcltype,CVector*,CVector*,void *entity,float ,uint *rwrgba,int ,int ,int ,int ) { EAXJMP (0x50D190 ); }
708
+
709
+ void
710
+ footsplash_ps2 (uchar *ebx, uchar *esp)
711
+ {
712
+ RwMatrix *mtx;
713
+ CVector *speed;
714
+ CVector vec1, vec2;
715
+ uint col;
716
+ mtx = (RwMatrix*)(ebx+4 );
717
+ speed = (CVector*)(ebx+0x78 );
718
+
719
+ vec1.x = mtx->pos .x - mtx->at .x *0 .3f + mtx->up .x *0 .3f ;
720
+ vec1.y = mtx->pos .y - mtx->at .y *0 .3f + mtx->up .y *0 .3f ;
721
+ vec1.z = mtx->pos .z - mtx->at .z *0 .3f + mtx->up .z *0 .3f - 1 .2f ;
722
+ vec2.x = speed->x *0.45 ;
723
+ vec2.y = speed->y *0.45 ;
724
+ vec2.z = (ps2rand ()&0xFFFF )/65536 .0f * 0 .02f + 0 .03f ;
725
+ col = *(uint*)0x5F85C4 ;
726
+ CParticle__AddParticle (44 , &vec1, &vec2, NULL , 0 .0f , &col, 0 , 0 , 0 , 0 );
727
+ }
728
+
729
+ void __declspec (naked)
730
+ footsplash_hook(void )
731
+ {
732
+ _asm {
733
+ push esp
734
+ push ebx
735
+ call footsplash_ps2
736
+ add esp,8
737
+ push 0x4CCDC3
738
+ retn
739
+ }
740
+ }
741
+
691
742
//
692
743
// real time reflection test; III 1.0
693
744
//
@@ -727,6 +778,9 @@ void (*InitialiseGame)(void);
727
778
void
728
779
InitialiseGame_hook (void )
729
780
{
781
+ static int x = 0 ;
782
+ assert (x == 0 );
783
+ x = 1 ;
730
784
if (isIII ())
731
785
// fall back to generic.txd when reading from dff
732
786
InjectHook (AddressByVersion<addr>(0x5AAE1B , 0x5AB0DB , 0x5AD708 , 0 , 0 , 0 ), RwTextureRead_generic);
@@ -897,9 +951,9 @@ patch(void)
897
951
InjectHook (0x405DB0 , printf, PATCH_JUMP);
898
952
899
953
// patch loadscreens
900
- Patch<uint>( 0x48D774 , 0x6024448b ); // 8B 44 24 60 - mov eax, [esp+60h ]
901
- Patch<uchar>( 0x48D778 , 0x50 ); // push eax
902
- InjectHook (0x48D779 , 0x48D79B , PATCH_JUMP);
954
+ // ff 74 24 60 push DWORD PTR [esp+0x60 ]
955
+ Patch<uint>( 0x48D774 , 0x602474ff );
956
+ InjectHook (0x48D778 , 0x48D79B , PATCH_JUMP);
903
957
904
958
// MemoryVP::InjectHook(0x48E603, RenderEffectsHook);
905
959
// MemoryVP::InjectHook(0x5219B3, CVehicleModelInfo__SetEnvironmentMapCB_hook);
@@ -911,6 +965,22 @@ patch(void)
911
965
Patch<uchar>(0x48E6A7 +1 , 3 );
912
966
Patch<uchar>(0x48E78C +1 , 3 );
913
967
968
+ static float randscl = 1 /63556 .0f ;
969
+ static float splashscl = 0 .4f ;
970
+ static float splashadd = -0 .2f ;
971
+
972
+ InjectHook (0x4CC4EA , ps2rand);
973
+ InjectHook (0x4CC514 , ps2rand);
974
+ InjectHook (0x4CC53E , ps2rand);
975
+ Patch<float *>(0x4CC4FA +2 , &randscl);
976
+ Patch<float *>(0x4CC524 +2 , &randscl);
977
+ Patch<float *>(0x4CC500 +2 , &splashscl);
978
+ Patch<float *>(0x4CC52A +2 , &splashscl);
979
+ Patch<float *>(0x4CC506 +2 , &splashadd);
980
+ Patch<float *>(0x4CC530 +2 , &splashadd);
981
+ // Nop(0x4CCD69, 5);
982
+ // Nop(0x4CCDBB, 5);
983
+ InjectHook (0x4CCC1A , footsplash_hook, PATCH_JUMP);
914
984
}
915
985
#endif
916
986
#ifndef RELEASE
@@ -928,10 +998,10 @@ patch(void)
928
998
// Patch(0x4CF47D, 0xc031); // xor eax, eax
929
999
// Nop(0x4CF47D + 2, 2);
930
1000
931
- // enable loadscreens. BREAKS FOR SOME REASON ( OLA?)
932
- // MemoryVP:: Nop(0x4A69D4, 1);
933
- // // ff 74 24 78 push DWORD PTR [esp+0x78]
934
- // MemoryVP:: Patch(0x4A69D4+1, 0x782474ff);
1001
+ // enable loadscreens. BREAKS WITH OLD OLA
1002
+ Nop (0x4A69D4 , 1 );
1003
+ // ff 74 24 78 push DWORD PTR [esp+0x78]
1004
+ Patch (0x4A69D4 +1 , 0x782474ff );
935
1005
}
936
1006
#endif
937
1007
0 commit comments