summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSergeanur <s.anureev@yandex.ua>2019-10-26 13:40:52 +0200
committerSergeanur <s.anureev@yandex.ua>2019-10-26 13:40:52 +0200
commit832572664c594e060813c46860fc71b0a2ac1710 (patch)
treea83702d5e3f0852444f488fb42f48fdbd9a7b8dc /src
parentFixed CGameLogic::PassTime types (diff)
downloadre3-832572664c594e060813c46860fc71b0a2ac1710.tar
re3-832572664c594e060813c46860fc71b0a2ac1710.tar.gz
re3-832572664c594e060813c46860fc71b0a2ac1710.tar.bz2
re3-832572664c594e060813c46860fc71b0a2ac1710.tar.lz
re3-832572664c594e060813c46860fc71b0a2ac1710.tar.xz
re3-832572664c594e060813c46860fc71b0a2ac1710.tar.zst
re3-832572664c594e060813c46860fc71b0a2ac1710.zip
Diffstat (limited to 'src')
-rw-r--r--src/core/RwTexRead.cpp18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/core/RwTexRead.cpp b/src/core/RwTexRead.cpp
index a1a7050a..6b717b34 100644
--- a/src/core/RwTexRead.cpp
+++ b/src/core/RwTexRead.cpp
@@ -1,5 +1,15 @@
+#pragma warning( push )
+#pragma warning( disable : 4005)
+#define DIRECTINPUT_VERSION 0x0800
+#include <dinput.h>
+#pragma warning( pop )
#include "common.h"
+#include "win.h"
#include "patcher.h"
+#include "Timer.h"
+
+float &texLoadTime = *(float*)0x8F1B50;
+int32 &texNumLoaded = *(int32*)0x8F252C;
RwTexture*
RwTextureGtaStreamRead(RwStream *stream)
@@ -10,11 +20,15 @@ RwTextureGtaStreamRead(RwStream *stream)
if(!RwStreamFindChunk(stream, rwID_TEXTURENATIVE, &size, &version))
return nil;
- // TODO: unused timing
+ float preloadTime = (float)CTimer::GetCurrentTimeInCycles() / (float)CTimer::GetCyclesPerMillisecond();
if(!RWSRCGLOBAL(stdFunc[rwSTANDARDNATIVETEXTUREREAD](stream, &tex, size)))
return nil;
-
+
+ if (gGameState == GS_INIT_PLAYING_GAME) {
+ texLoadTime = (texNumLoaded * texLoadTime + (float)CTimer::GetCurrentTimeInCycles() / (float)CTimer::GetCyclesPerMillisecond() - preloadTime) / (float)(texNumLoaded+1);
+ texNumLoaded++;
+ }
return tex;
}