Last change
on this file since 366 was 297, checked in by rossy, 16 years ago |
some things that probably dont work
|
File size:
1.2 KB
|
Line | |
---|
1 | #include <windows.h>
|
---|
2 | #include <stdlib.h>
|
---|
3 | #include <stdarg.h>
|
---|
4 | #include <stdint.h>
|
---|
5 | #include "oni_stdio.h"
|
---|
6 |
|
---|
7 | #include "Daodan_Utility.h"
|
---|
8 | #include "BFW_Utility.h"
|
---|
9 |
|
---|
10 | void __cdecl DDrStartupMessage(const char* fmt, ...)
|
---|
11 | {
|
---|
12 | va_list ap;
|
---|
13 | va_start(ap, fmt);
|
---|
14 | char* buffer = malloc(vsnprintf(NULL, 0, fmt, ap) + 1);
|
---|
15 |
|
---|
16 | vsprintf(buffer, fmt, ap);
|
---|
17 | va_end(ap);
|
---|
18 |
|
---|
19 | if (!ONgFileStartup)
|
---|
20 | if (!(ONgFileStartup = oni_fopen("startup.txt", "w")))
|
---|
21 | return;
|
---|
22 |
|
---|
23 | oni_fprintf(ONgFileStartup, "%s\n", buffer);
|
---|
24 | free(buffer);
|
---|
25 |
|
---|
26 | oni_fflush(ONgFileStartup);
|
---|
27 | return;
|
---|
28 | }
|
---|
29 |
|
---|
30 | int64_t ONICALL DDrMachineTime_Sixtieths()
|
---|
31 | {
|
---|
32 | static int64_t LastTime, Time;
|
---|
33 | int64_t Current;
|
---|
34 |
|
---|
35 | Current = LastTime + GetTickCount();
|
---|
36 |
|
---|
37 | if (Current > Time)
|
---|
38 | {
|
---|
39 | LastTime += 1;
|
---|
40 | Current += 1;
|
---|
41 | }
|
---|
42 |
|
---|
43 | Time = Current;
|
---|
44 |
|
---|
45 | return (Time * 3) / 50;
|
---|
46 | }
|
---|
47 |
|
---|
48 | int64_t ONICALL DDrMachineTime_High()
|
---|
49 | {
|
---|
50 | // LARGE_INTEGER PerfCount;
|
---|
51 | //
|
---|
52 | // if (!QueryPerformanceCounter(&PerfCount))
|
---|
53 | // PerfCount.QuadPart = GetTickCount();
|
---|
54 | //
|
---|
55 | // return PerfCount.QuadPart;
|
---|
56 | return GetTickCount();
|
---|
57 | }
|
---|
58 |
|
---|
59 | double ONICALL DDrMachineTime_High_Frequency()
|
---|
60 | {
|
---|
61 | // LARGE_INTEGER Frequency;
|
---|
62 | //
|
---|
63 | // if (!QueryPerformanceFrequency(&Frequency))
|
---|
64 | return 1000.0;
|
---|
65 |
|
---|
66 | // return Frequency.QuadPart;
|
---|
67 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.