#include #include #include #include #include "oni_stdio.h" #include "Daodan_Utility.h" #include "BFW_Utility.h" const double fps = 60.0; void __cdecl DDrStartupMessage(const char* fmt, ...) { va_list ap; va_start(ap, fmt); char* buffer = malloc(vsnprintf(NULL, 0, fmt, ap) + 1); vsprintf(buffer, fmt, ap); va_end(ap); if (!ONgFileStartup) if (!(ONgFileStartup = oni_fopen("startup.txt", "w"))) return; oni_fprintf(ONgFileStartup, "%s\n", buffer); free(buffer); oni_fflush(ONgFileStartup); return; } /* int64_t ONICALL DDrMachineTime_Sixtieths() { static int64_t LastTime, Time; int64_t Current; Current = LastTime + GetTickCount(); if (Current > Time) { LastTime += 1; Current += 1; } Time = Current; return (Time * 3) / 50; } */ int64_t ONICALL DDrMachineTime_Sixtieths() { static uint32_t startticks = 0; double ticks = 0; if (startticks) ticks = GetTickCount() - startticks; else startticks = GetTickCount(); return (int64_t)(ticks / 1000.0 * fps); } int64_t ONICALL DDrMachineTime_High() { // LARGE_INTEGER PerfCount; // // if (!QueryPerformanceCounter(&PerfCount)) // PerfCount.QuadPart = GetTickCount(); // // return PerfCount.QuadPart; return GetTickCount(); } double ONICALL DDrMachineTime_High_Frequency() { // LARGE_INTEGER Frequency; // // if (!QueryPerformanceFrequency(&Frequency)) return 1000.0; // return Frequency.QuadPart; }