diff --git a/CMakeLists.txt b/CMakeLists.txt index bca0b72..b757f91 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -56,7 +56,7 @@ if (BUILD_FOR_NOKIA_NGAGE) "${CMAKE_CURRENT_SOURCE_DIR}/src/ngage/ngage_appview.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/src/ngage/ngage_document.cpp") - add_library(game STATIC ${project_sources} ${ngage_sources}) + add_library(game STATIC ${project_sources}) add_library(open8 STATIC ${open8_sources}) build_exe_static(game exe ${UID1} ${UID2} ${UID3} "${game_static_libs}" "${game_libs}") build_dll(open8 app ${UID1} ${UID2} ${APP_UID} "${open8_libs}") diff --git a/cmake/project_config.cmake b/cmake/project_config.cmake index 60effec..390a771 100644 --- a/cmake/project_config.cmake +++ b/cmake/project_config.cmake @@ -11,9 +11,6 @@ set(project_sources ${CMAKE_CURRENT_SOURCE_DIR}/src/lexaloffle/p8_compress.c ${CMAKE_CURRENT_SOURCE_DIR}/src/lexaloffle/pxa_compress_snippets.c) -set(ngage_sources - ${CMAKE_CURRENT_SOURCE_DIR}/src/ngage/api.cpp) - set(UID3 0x1000c37e) # game.exe UID set(APP_UID 0x100051C0) # open8.app UID set(APP_NAME "open8") diff --git a/src/api.c b/src/api.c index 9d24c45..eb6ade1 100644 --- a/src/api.c +++ b/src/api.c @@ -30,7 +30,7 @@ static fix32_t seed_lo, seed_hi; -fix32_t seconds_since_start; +static fix32_t seconds_since_start; // Auxiliary functions. @@ -1404,19 +1404,16 @@ void init_api(lua_State* L) lua_setglobal(L, "log"); } -#ifndef __SYMBIAN32__ -#include - void update_time(void) { - static clock_t start_time = 0; + static Uint64 start_time = 0; if (start_time == 0) { - start_time = clock(); + start_time = SDL_GetTicks(); } - clock_t current_time = clock(); - double elapsed_time = (double)(current_time - start_time) / CLOCKS_PER_SEC; - seconds_since_start = fix32_from_double(elapsed_time); + Uint64 current_time = SDL_GetTicks(); + Uint64 elapsed_time_ticks = current_time - start_time; + fix32_t elapsed_time = fix32_from_int(elapsed_time_ticks) / 1000; + seconds_since_start = elapsed_time; } -#endif diff --git a/src/ngage/api.cpp b/src/ngage/api.cpp deleted file mode 100644 index cad90f2..0000000 --- a/src/ngage/api.cpp +++ /dev/null @@ -1,34 +0,0 @@ -/** @file api.cpp - * - * A portable PICO-8 emulator written in C. - * - * Copyright (c) 2025, Michael Fitzmayer. All rights reserved. - * SPDX-License-Identifier: MIT - * - **/ - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#include "../api.h" - -void update_time(void) -{ - static TInt start_time = 0; - if (start_time == 0) - { - start_time = User::TickCount(); - } - - TInt current_time = User::TickCount(); - TInt elapsed_time_ticks = current_time - start_time; - fix32_t elapsed_time = fix32_from_int(elapsed_time_ticks) / 1000; - seconds_since_start = elapsed_time; -} - -#ifdef __cplusplus -} -#endif