mirror of
https://github.com/1dot13/source.git
synced 2026-07-29 13:52:17 +02:00
Fixes (by The_Bob):
- Fixed index out of bounds in get items assignment check - Fixed attachment popup not allowing more than one of the same attachment - Improved timer control sanity check code - Added timer adjustment for variable CPU frequency - Added shortcut: ctrl+left-click on attachment to remove and drop it in sector inventory git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8400 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -286,15 +286,17 @@ static inline bool TimerSanityCheck() {
|
||||
UINT32 GetNextCounterDoneTime(void)
|
||||
{
|
||||
QueryPerformanceCounter(&gliPerfCount);
|
||||
|
||||
if (TimerSanityCheck() == false) {
|
||||
// timer has gone off the rails, try to reset and hope for the best.
|
||||
gliPerfCountNext.QuadPart = gliPerfCount.QuadPart + 25;
|
||||
}
|
||||
|
||||
gliTimestampDiff = gliPerfCountNext.QuadPart - gliPerfCount.QuadPart;
|
||||
gliWaitTime = (gliTimestampDiff * FREQUENCY_CONST) / gliPerfFreq.QuadPart;
|
||||
|
||||
// if the wait time is too long/short, re-evaluate the timer and try waiting 125ms
|
||||
if (gliWaitTime > 15 * FREQUENCY_CONST) {
|
||||
gliWaitTime = 125; // in mili-seconds
|
||||
|
||||
QueryPerformanceFrequency(&gliPerfFreq);
|
||||
gliPerfCountNext.QuadPart = gliPerfCount.QuadPart + ((125 * gliPerfFreq.QuadPart) / 1000000);
|
||||
}
|
||||
|
||||
return (UINT32)((gliWaitTime > 0) ? gliWaitTime : 0);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user