1
0
mirror of https://github.com/XProger/OpenLara.git synced 2025-08-08 06:06:51 +02:00

rename osGetTime to osGetTimeMS for platforms

This commit is contained in:
XProger
2019-03-10 15:42:32 +03:00
parent 3241eb7948
commit 3ae71b1106
11 changed files with 22 additions and 22 deletions

View File

@@ -244,11 +244,11 @@ namespace GAPI {
LPDIRECT3DTEXTURE9 tex2D; LPDIRECT3DTEXTURE9 tex2D;
LPDIRECT3DCUBETEXTURE9 texCube; LPDIRECT3DCUBETEXTURE9 texCube;
int width, height, origWidth, origHeight; int width, height, depth, origWidth, origHeight, origDepth;
TexFormat fmt; TexFormat fmt;
uint32 opt; uint32 opt;
Texture(int width, int height, uint32 opt) : tex2D(NULL), texCube(NULL), width(width), height(height), origWidth(width), origHeight(height), fmt(FMT_RGBA), opt(opt) {} Texture(int width, int height, int depth, uint32 opt) : tex2D(NULL), texCube(NULL), width(width), height(height), depth(depth), origWidth(width), origHeight(height), origDepth(depth), fmt(FMT_RGBA), opt(opt) {}
void init(void *data) { void init(void *data) {
ASSERT((opt & OPT_PROXY) == 0); ASSERT((opt & OPT_PROXY) == 0);

View File

@@ -19,7 +19,7 @@ JavaVM *jvm;
// timing // timing
time_t startTime; time_t startTime;
int osGetTime() { int osGetTimeMS() {
timeval t; timeval t;
gettimeofday(&t, NULL); gettimeofday(&t, NULL);
return int((t.tv_sec - startTime) * 1000 + t.tv_usec / 1000); return int((t.tv_sec - startTime) * 1000 + t.tv_usec / 1000);

View File

@@ -20,7 +20,7 @@
// timing // timing
unsigned int startTime; unsigned int startTime;
int osGetTime() { int osGetTimeMS() {
timeval t; timeval t;
gettimeofday(&t, NULL); gettimeofday(&t, NULL);
return int((t.tv_sec - startTime) * 1000 + t.tv_usec / 1000); return int((t.tv_sec - startTime) * 1000 + t.tv_usec / 1000);

View File

@@ -24,7 +24,7 @@ void osJoyVibrate(int index, float L, float R) {
// TODO // TODO
} }
int osGetTime() { int osGetTimeMS() {
const int64_t kOneMillion = 1000 * 1000; const int64_t kOneMillion = 1000 * 1000;
static mach_timebase_info_data_t info; static mach_timebase_info_data_t info;

View File

@@ -18,7 +18,7 @@
// timing // timing
unsigned int startTime; unsigned int startTime;
int osGetTime() { int osGetTimeMS() {
timeval t; timeval t;
gettimeofday(&t, NULL); gettimeofday(&t, NULL);
return int((t.tv_sec - startTime) * 1000 + t.tv_usec / 1000); return int((t.tv_sec - startTime) * 1000 + t.tv_usec / 1000);
@@ -185,7 +185,7 @@ void joyInit() {
joy.fx.type = FF_RUMBLE; joy.fx.type = FF_RUMBLE;
joy.fx.replay.delay = 0; joy.fx.replay.delay = 0;
joy.vL = joy.oL = joy.vR = joy.oR = 0.0f; joy.vL = joy.oL = joy.vR = joy.oR = 0.0f;
joy.time = osGetTime(); joy.time = Core::getTime();
} }
} }
} }
@@ -222,7 +222,7 @@ void joyRumble(JoyDevice &joy) {
if (joy.oL == 0.0f && joy.vL == 0.0f && joy.oR == 0.0f && joy.vR == 0.0f) if (joy.oL == 0.0f && joy.vL == 0.0f && joy.oR == 0.0f && joy.vR == 0.0f)
return; return;
if (osGetTime() <= joy.time) if (Core::getTime() <= joy.time)
return; return;
input_event event; input_event event;
@@ -255,7 +255,7 @@ void joyRumble(JoyDevice &joy) {
joy.oL = joy.vL; joy.oL = joy.vL;
joy.oR = joy.vR; joy.oR = joy.vR;
joy.time = osGetTime() + joy.fx.replay.length; joy.time = Core::getTime() + joy.fx.replay.length;
} }
void joyUpdate() { void joyUpdate() {

View File

@@ -27,7 +27,7 @@ void osMutexUnlock(void *obj) {
// timing // timing
u64 startTick; u64 startTick;
int osGetTime() { int osGetTimeMS() {
u64 tick = armGetSystemTick(); u64 tick = armGetSystemTick();
return int(((tick - startTick) * 625 / 12) / 1000000); return int(((tick - startTick) * 625 / 12) / 1000000);
} }
@@ -187,7 +187,7 @@ int joySplitTime;
void joySplit(bool split) { void joySplit(bool split) {
joyIsSplit = split; joyIsSplit = split;
joySplitTime = osGetTime(); joySplitTime = Core::getTime();
if (split) { if (split) {
hidSetNpadJoyHoldType(HidJoyHoldType_Horizontal); hidSetNpadJoyHoldType(HidJoyHoldType_Horizontal);
hidSetNpadJoyAssignmentModeSingleByDefault(CONTROLLER_PLAYER_1); hidSetNpadJoyAssignmentModeSingleByDefault(CONTROLLER_PLAYER_1);
@@ -245,7 +245,7 @@ void joyUpdate() {
Input::setJoyPos(i, jkR, vec2(float(sR.dx), float(-sR.dy)) / 32767.0f); Input::setJoyPos(i, jkR, vec2(float(sR.dx), float(-sR.dy)) / 32767.0f);
if ((mask & (KEY_L | KEY_R)) == (KEY_L | KEY_R)) { // hold L and R to split/merge joy-con's if ((mask & (KEY_L | KEY_R)) == (KEY_L | KEY_R)) { // hold L and R to split/merge joy-con's
if (joySplitTime + 1000 < osGetTime()) { // 1 sec timer if (joySplitTime + 1000 < Core::getTime()) { // 1 sec timer
joySplit(!joyIsSplit); joySplit(!joyIsSplit);
} }
waitForSplit = true; waitForSplit = true;
@@ -253,7 +253,7 @@ void joyUpdate() {
} }
if (!waitForSplit) { if (!waitForSplit) {
joySplitTime = osGetTime(); joySplitTime = Core::getTime();
} }
} }

View File

@@ -10,7 +10,7 @@ BOOL enableRetina = YES;
int frameLimit = 58 + 4; int frameLimit = 58 + 4;
// timing // timing
int osGetTime() { int osGetTimeMS() {
static mach_timebase_info_data_t timebaseInfo; static mach_timebase_info_data_t timebaseInfo;
if (timebaseInfo.denom == 0) { if (timebaseInfo.denom == 0) {
mach_timebase_info(&timebaseInfo); mach_timebase_info(&timebaseInfo);
@@ -405,7 +405,7 @@ BOOL allowFrameUpdate = YES;
return; return;
} }
int startDrawMs = osGetTime(); int startDrawMs = Core::getTime();
NSOpenGLContext *context = [self openGLContext]; NSOpenGLContext *context = [self openGLContext];
@@ -415,7 +415,7 @@ BOOL allowFrameUpdate = YES;
[context flushBuffer]; [context flushBuffer];
int endDrawMs = osGetTime(); int endDrawMs = Core::getTime();
int deltaMs = endDrawMs - startDrawMs; int deltaMs = endDrawMs - startDrawMs;
float avgDelta = ((lastDeltaMs + deltaMs) / 2.0); float avgDelta = ((lastDeltaMs + deltaMs) / 2.0);
lastDeltaMs = deltaMs; lastDeltaMs = deltaMs;

View File

@@ -87,7 +87,7 @@ void osRWUnlockWrite(void *obj) {
int osStartTime = 0; int osStartTime = 0;
int osTimerFreq; int osTimerFreq;
int osGetTime() { int osGetTimeMS() {
u64 time; u64 time;
sceRtcGetCurrentTick(&time); sceRtcGetCurrentTick(&time);
return int(time * 1000 / osTimerFreq - osStartTime); return int(time * 1000 / osTimerFreq - osStartTime);
@@ -160,7 +160,7 @@ int main() {
joyInit(); joyInit();
osTimerFreq = sceRtcGetTickResolution(); osTimerFreq = sceRtcGetTickResolution();
osStartTime = osGetTime(); osStartTime = Core::getTime();
Game::init(); Game::init();

View File

@@ -39,7 +39,7 @@ void osMutexUnlock(void *obj) {
int osStartTime = 0; int osStartTime = 0;
int osTimerFreq; int osTimerFreq;
int osGetTime() { int osGetTimeMS() {
SceRtcTick current; SceRtcTick current;
sceRtcGetCurrentTick(&current); sceRtcGetCurrentTick(&current);
return int(current.tick * 1000 / osTimerFreq - osStartTime); return int(current.tick * 1000 / osTimerFreq - osStartTime);
@@ -191,7 +191,7 @@ int main() {
inputInit(); inputInit();
osTimerFreq = sceRtcGetTickResolution(); osTimerFreq = sceRtcGetTickResolution();
osStartTime = osGetTime(); osStartTime = Core::getTime();
Game::init("PSXDATA/LEVEL2.PSX"); Game::init("PSXDATA/LEVEL2.PSX");
// sceRazorGpuCaptureSetTrigger(100, "ux0:data/OpenLara/capture.sgx"); // sceRazorGpuCaptureSetTrigger(100, "ux0:data/OpenLara/capture.sgx");

View File

@@ -19,7 +19,7 @@
// timing // timing
unsigned int startTime; unsigned int startTime;
int osGetTime() { int osGetTimeMS() {
timeval t; timeval t;
gettimeofday(&t, NULL); gettimeofday(&t, NULL);
return int((t.tv_sec - startTime) * 1000 + t.tv_usec / 1000); return int((t.tv_sec - startTime) * 1000 + t.tv_usec / 1000);

View File

@@ -13,7 +13,7 @@
// timing // timing
unsigned int startTime; unsigned int startTime;
int osGetTime() { int osGetTimeMS() {
timeval t; timeval t;
gettimeofday(&t, NULL); gettimeofday(&t, NULL);
return int((t.tv_sec - startTime) * 1000 + t.tv_usec / 1000); return int((t.tv_sec - startTime) * 1000 + t.tv_usec / 1000);