SHARE
TWEET

SWOTOR wine patch 1.5.21

a guest Jan 5th, 2013 894 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. diff --git a/dlls/ntdll/Makefile.in b/dlls/ntdll/Makefile.in
  2. index 0047731..80d7f5a 100644
  3. --- a/dlls/ntdll/Makefile.in
  4. +++ b/dlls/ntdll/Makefile.in
  5. @@ -2,7 +2,7 @@ EXTRADEFS = -D_NTSYSTEM_
  6.  MODULE    = ntdll.dll
  7.  IMPORTLIB = ntdll
  8.  IMPORTS   = winecrt0
  9. -EXTRALIBS = @IOKITLIB@ @LIBPTHREAD@
  10. +EXTRALIBS = @IOKITLIB@ @LIBPTHREAD@ -lrt
  11.  EXTRADLLFLAGS = -nodefaultlibs -Wl,--image-base,0x7bc00000
  12.  
  13.  C_SRCS = \
  14. diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c
  15. index 01a8026..45d5d32 100644
  16. --- a/dlls/ntdll/thread.c
  17. +++ b/dlls/ntdll/thread.c
  18. @@ -21,6 +21,8 @@
  19.  #include "config.h"
  20.  #include "wine/port.h"
  21.  
  22. +#include <stdint.h>
  23. +#include <errno.h>
  24.  #include <assert.h>
  25.  #include <stdarg.h>
  26.  #include <sys/types.h>
  27. @@ -70,6 +72,71 @@ static RTL_BITMAP fls_bitmap;
  28.  static LIST_ENTRY tls_links;
  29.  static int nb_threads = 1;
  30.  
  31. +static void update_shared_data_time(void)
  32. +{
  33. +    LARGE_INTEGER now, start, irq;
  34. +
  35. +    NtQuerySystemTime( &now );
  36. +
  37. +    //FIXME("%lld\n", now.QuadPart);
  38. +    
  39. +    irq.QuadPart = (now.QuadPart - server_start_time);
  40. +
  41. +    user_shared_data->InterruptTime.High2Time = irq.HighPart;
  42. +    user_shared_data->InterruptTime.LowPart = irq.LowPart;
  43. +    user_shared_data->InterruptTime.High1Time = irq.HighPart;
  44. +
  45. +    user_shared_data->SystemTime.High2Time = now.HighPart;
  46. +    user_shared_data->SystemTime.LowPart = now.LowPart;
  47. +    user_shared_data->SystemTime.High1Time = now.HighPart;
  48. +
  49. +    start.QuadPart = irq.QuadPart / 10000;
  50. +
  51. +    user_shared_data->u.TickCount.High2Time = start.HighPart;
  52. +    user_shared_data->u.TickCount.LowPart = start.LowPart;
  53. +    user_shared_data->u.TickCount.High1Time = start.HighPart;
  54. +    user_shared_data->TickCountLowDeprecated = start.LowPart;
  55. +}
  56. +
  57. +static void add_timespec(struct timespec* dst, struct timespec* arg)
  58. +{
  59. +    dst->tv_sec += arg->tv_sec;
  60. +    dst->tv_nsec += arg->tv_nsec;
  61. +
  62. +    if(dst->tv_nsec > 999999999) {
  63. +        dst->tv_nsec -= 1000000000;
  64. +        dst->tv_sec++;
  65. +    }
  66. +}
  67. +
  68. +static void* shared_data_thread(void *thread_arg)
  69. +{
  70. +    struct timespec start, arg;
  71. +    int e;
  72. +
  73. +    e = clock_gettime(CLOCK_MONOTONIC, &start);
  74. +    if(e) {
  75. +        FIXME("Unable to get starting time: %s (%d)\n", strerror(errno), errno);
  76. +        return NULL;
  77. +    }
  78. +
  79. +    arg.tv_sec = 0;
  80. +    arg.tv_nsec = 15600000;
  81. +
  82. +    while(1) {
  83. +        update_shared_data_time();
  84. +        add_timespec(&start, &arg);
  85. +        e = clock_nanosleep(CLOCK_MONOTONIC, TIMER_ABSTIME, &start, NULL);
  86. +        if(e) {
  87. +            FIXME("clock_nanosleep failed: %s (%d)\n", strerror(e), e);
  88. +        }
  89. +    }
  90. +
  91. +    return NULL;
  92. +}
  93. +
  94. +
  95. +
  96.  /***********************************************************************
  97.   *           get_unicode_string
  98.   *
  99. @@ -199,10 +266,11 @@ HANDLE thread_init(void)
  100.      void *addr;
  101.      SIZE_T size, info_size;
  102.      HANDLE exe_file = 0;
  103. -    LARGE_INTEGER now;
  104.      NTSTATUS status;
  105.      struct ntdll_thread_data *thread_data;
  106.      static struct debug_info debug_info;  /* debug info for initial thread */
  107. +    pthread_t thread;
  108. +    int s;
  109.  
  110.      virtual_init();
  111.  
  112. @@ -298,16 +366,20 @@ HANDLE thread_init(void)
  113.      }
  114.  
  115.      /* initialize time values in user_shared_data */
  116. -    NtQuerySystemTime( &now );
  117. -    user_shared_data->SystemTime.LowPart = now.u.LowPart;
  118. -    user_shared_data->SystemTime.High1Time = user_shared_data->SystemTime.High2Time = now.u.HighPart;
  119. -    user_shared_data->u.TickCountQuad = (now.QuadPart - server_start_time) / 10000;
  120. -    user_shared_data->u.TickCount.High2Time = user_shared_data->u.TickCount.High1Time;
  121. -    user_shared_data->TickCountLowDeprecated = user_shared_data->u.TickCount.LowPart;
  122.      user_shared_data->TickCountMultiplier = 1 << 24;
  123.  
  124.      fill_cpu_info();
  125. +    update_shared_data_time();
  126.  
  127. +    fill_cpu_info();
  128. +
  129. +    if(!(s = pthread_create(&thread, NULL, &shared_data_thread, NULL))) {
  130. +        if(pthread_detach(thread))
  131. +            FIXME("Unable to detach thread\n");
  132. +    } else {
  133. +        FIXME("unable to spawn thread: %s (%d)\n", strerror(s), s);
  134. +    }
  135. +    
  136.      return exe_file;
  137.  }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top