Reduce dependency on libgcc

This commit is contained in:
UnknownShadow200 2024-08-10 15:29:00 +10:00
parent 666449416a
commit 8b08fe3abb
2 changed files with 12 additions and 5 deletions

View File

@ -31,8 +31,8 @@ jobs:
cd src cd src
PATH=$PATH:/usr/local/compiler/target/bin PATH=$PATH:/usr/local/compiler/target/bin
i386-apple-darwin8-clang *.c Window_cocoa.m ${{ env.COMMON_FLAGS }} $LATEST_FLAG -o cc-mac32-gl1 -framework Cocoa -framework OpenGL -framework IOKit -lobjc -lgcc_s.1 i386-apple-darwin8-clang *.c Window_cocoa.m ${{ env.COMMON_FLAGS }} $LATEST_FLAG -o cc-mac32-gl1 -framework Cocoa -framework OpenGL -framework IOKit -lobjc -static-libgcc
i386-apple-darwin8-clang *.c Window_cocoa.m ${{ env.COMMON_FLAGS }} $LATEST_FLAG -DCC_GFX_BACKEND=CC_GFX_BACKEND_GL2 -o cc-mac32-gl2 -framework Cocoa -framework OpenGL -framework IOKit -lobjc -lgcc_s.1 i386-apple-darwin8-clang *.c Window_cocoa.m ${{ env.COMMON_FLAGS }} $LATEST_FLAG -DCC_GFX_BACKEND=CC_GFX_BACKEND_GL2 -o cc-mac32-gl2 -framework Cocoa -framework OpenGL -framework IOKit -lobjc -static-libgcc
- uses: ./.github/actions/notify_failure - uses: ./.github/actions/notify_failure

View File

@ -636,13 +636,20 @@ static void LimitFPS(void) {
#else #else
static float gfx_targetTime, gfx_actualTime; static float gfx_targetTime, gfx_actualTime;
static CC_INLINE float ElapsedMilliseconds(cc_uint64 beg, cc_uint64 end) {
cc_uint64 elapsed = Stopwatch_ElapsedMicroseconds(beg, end);
if (elapsed > 5000000) elapsed = 5000000;
return (int)elapsed / 1000.0f;
}
/* Examines difference between expected and actual frame times, */ /* Examines difference between expected and actual frame times, */
/* then sleeps if actual frame time is too fast */ /* then sleeps if actual frame time is too fast */
static void LimitFPS(void) { static void LimitFPS(void) {
cc_uint64 frameEnd, sleepEnd; cc_uint64 frameEnd, sleepEnd;
frameEnd = Stopwatch_Measure(); frameEnd = Stopwatch_Measure();
gfx_actualTime += Stopwatch_ElapsedMicroseconds(frameStart, frameEnd) / 1000.0f; gfx_actualTime += ElapsedMilliseconds(frameStart, frameEnd);
gfx_targetTime += gfx_minFrameMs; gfx_targetTime += gfx_minFrameMs;
/* going faster than FPS limit - sleep to slow down */ /* going faster than FPS limit - sleep to slow down */
@ -654,7 +661,7 @@ static void LimitFPS(void) {
/* duration can significantly deviate from requested time */ /* duration can significantly deviate from requested time */
/* (e.g. requested 4ms, but actually slept for 8ms) */ /* (e.g. requested 4ms, but actually slept for 8ms) */
sleepEnd = Stopwatch_Measure(); sleepEnd = Stopwatch_Measure();
gfx_actualTime += Stopwatch_ElapsedMicroseconds(frameEnd, sleepEnd) / 1000.0f; gfx_actualTime += ElapsedMilliseconds(frameEnd, sleepEnd);
} }
/* reset accumulated time to avoid excessive FPS drift */ /* reset accumulated time to avoid excessive FPS drift */
@ -728,7 +735,7 @@ static CC_INLINE void Game_RenderFrame(void) {
/* avoid large delta with suspended process */ /* avoid large delta with suspended process */
if (elapsed > 5000000) elapsed = 5000000; if (elapsed > 5000000) elapsed = 5000000;
double deltaD = elapsed / (1000.0 * 1000.0); double deltaD = (int)elapsed / (1000.0 * 1000.0);
float delta = (float)deltaD; float delta = (float)deltaD;
Window_ProcessEvents(delta); Window_ProcessEvents(delta);