diff --git a/.github/workflows/linux-workflow.yaml b/.github/workflows/linux-workflow.yaml index c8e67b0cc1..fbb17ac238 100644 --- a/.github/workflows/linux-workflow.yaml +++ b/.github/workflows/linux-workflow.yaml @@ -20,6 +20,7 @@ jobs: make -j - name: Test Project with gTest run: ./test.sh + timeout-minutes: 5 - name: Check Clang-Formatting run: | chmod +x ./third-party/run-clang-format/run-clang-format.py diff --git a/game/kernel/kboot.cpp b/game/kernel/kboot.cpp index b9545ceaaf..9f6f6de06d 100644 --- a/game/kernel/kboot.cpp +++ b/game/kernel/kboot.cpp @@ -134,7 +134,7 @@ void KernelCheckAndDispatch() { // dispatch the kernel //(**kernel_dispatcher)(); call_goal(Ptr(kernel_dispatcher->value), 0, 0, 0, s7.offset, g_ee_main_mem); - // TODO-WINDOWS + // TODO-WINDOWS #ifdef __linux__ ClearPending(); #endif @@ -147,7 +147,7 @@ void KernelCheckAndDispatch() { #ifdef _WIN32 Sleep(1000); // todo - remove this #elif __linux__ - usleep(1000); + usleep(1000); #endif } } diff --git a/game/kernel/klisten.cpp b/game/kernel/klisten.cpp index 198858c2ca..7f990bf27e 100644 --- a/game/kernel/klisten.cpp +++ b/game/kernel/klisten.cpp @@ -71,10 +71,10 @@ void ClearPending() { Ptr msg = OutputBufArea.cast() + sizeof(GoalMessageHeader); auto size = strlen(msg.c()); // note - if size is ever greater than 2^16 this will cause an issue. - // TODO-WINDOWS - #ifdef __linux__ - SendFromBuffer(msg.c(), size); - #endif + // TODO-WINDOWS +#ifdef __linux__ + SendFromBuffer(msg.c(), size); +#endif clear_output(); } @@ -87,10 +87,10 @@ void ClearPending() { if (send_size > 64000) { send_size = 64000; } - // TODO-WINDOWS - #ifdef __linux__ - SendFromBufferD(2, 0, msg, send_size); - #endif +// TODO-WINDOWS +#ifdef __linux__ + SendFromBufferD(2, 0, msg, send_size); +#endif size -= send_size; msg += send_size; } @@ -109,9 +109,11 @@ void ClearPending() { */ void SendAck() { if (MasterDebug) { - #ifdef __linux__ - SendFromBufferD(u16(ListenerMessageKind::MSG_ACK), protoBlock.msg_id, AckBufArea + sizeof(GoalMessageHeader), strlen(AckBufArea + sizeof(GoalMessageHeader))); - #endif +#ifdef __linux__ + SendFromBufferD(u16(ListenerMessageKind::MSG_ACK), protoBlock.msg_id, + AckBufArea + sizeof(GoalMessageHeader), + strlen(AckBufArea + sizeof(GoalMessageHeader))); +#endif } } diff --git a/game/kernel/kmachine.cpp b/game/kernel/kmachine.cpp index c1d820a6e2..4752b90b93 100644 --- a/game/kernel/kmachine.cpp +++ b/game/kernel/kmachine.cpp @@ -329,10 +329,10 @@ int InitMachine() { // } if (MasterDebug) { // connect to GOAL compiler - // TODO-WINDOWS - #ifdef __linux__ - InitGoalProto(); - #endif +// TODO-WINDOWS +#ifdef __linux__ + InitGoalProto(); +#endif } printf("InitSound\n"); @@ -362,10 +362,10 @@ int ShutdownMachine() { StopIOP(); CloseListener(); ShutdownSound(); - // TODO-WINDOWS - #ifdef __linux__ - ShutdownGoalProto(); - #endif +// TODO-WINDOWS +#ifdef __linux__ + ShutdownGoalProto(); +#endif Msg(6, "kernel: machine shutdown"); return 0; } diff --git a/game/overlord/fake_iso.cpp b/game/overlord/fake_iso.cpp index 2330d732e7..91840ec4f9 100644 --- a/game/overlord/fake_iso.cpp +++ b/game/overlord/fake_iso.cpp @@ -87,7 +87,7 @@ int FS_Init(u8* buffer) { // get path to next/data/fake_iso.txt, the map file. char fakeiso_path[512]; strcpy(fakeiso_path, next_dir); - fake_iso_path = std::getenv("FAKE_ISO_PATH"); + fake_iso_path = std::getenv("FAKE_ISO_PATH"); assert(fake_iso_path); strcat(fakeiso_path, fake_iso_path); diff --git a/game/runtime.cpp b/game/runtime.cpp index 05622de93c..379898a9a1 100644 --- a/game/runtime.cpp +++ b/game/runtime.cpp @@ -11,6 +11,7 @@ #include #include #endif + #include #include "runtime.h" @@ -55,18 +56,18 @@ namespace { * SystemThread function for running the DECI2 communication with the GOAL compiler. */ -void deci2_runner(SystemThreadInterface& interfaces) { - // TODO-WINDOWS - #ifdef __linux__ +void deci2_runner(SystemThreadInterface& iface) { +// TODO-WINDOWS +#ifdef __linux__ // callback function so the server knows when to give up and shutdown - std::function shutdown_callback = [&]() { return interface.get_want_exit(); }; + std::function shutdown_callback = [&]() { return iface.get_want_exit(); }; // create and register server Deci2Server server(shutdown_callback); ee::LIBRARY_sceDeci2_register(&server); // now its ok to continue with initialization - interface.initialization_complete(); + iface.initialization_complete(); // in our own thread, wait for the EE to register the first protocol driver printf("[DECI2] waiting for EE to register protos\n"); @@ -78,7 +79,7 @@ void deci2_runner(SystemThreadInterface& interfaces) { printf("[DECI2] waiting for listener...\n"); bool saw_listener = false; - while (!interface.get_want_exit()) { + while (!iface.get_want_exit()) { if (server.check_for_listener()) { if (!saw_listener) { printf("[DECI2] Connected!\n"); @@ -91,7 +92,7 @@ void deci2_runner(SystemThreadInterface& interfaces) { usleep(50000); } } - #endif +#endif } // EE System @@ -235,10 +236,10 @@ void exec_runtime(int argc, char** argv) { // step 1: sce library prep iop::LIBRARY_INIT(); ee::LIBRARY_INIT_sceCd(); - // TODO-WINDOWS - #ifdef __linux__ +// TODO-WINDOWS +#ifdef __linux__ ee::LIBRARY_INIT_sceDeci2(); - #endif +#endif ee::LIBRARY_INIT_sceSif(); // step 2: system prep diff --git a/game/system/Deci2Server.cpp b/game/system/Deci2Server.cpp index 56122c5ae7..600f34462e 100644 --- a/game/system/Deci2Server.cpp +++ b/game/system/Deci2Server.cpp @@ -7,12 +7,10 @@ // TODO-WINDOWS #ifdef __linux__ +#include #include #include #include -#include -#include -#include #include #include @@ -20,8 +18,6 @@ #include "common/versions.h" #include "Deci2Server.h" -typedef int socklen_t; - Deci2Server::Deci2Server(std::function shutdown_callback) { buffer = new char[BUFFER_SIZE]; want_exit = std::move(shutdown_callback); @@ -56,7 +52,7 @@ bool Deci2Server::init() { return false; } - const char opt = 1; + int opt = 1; if (setsockopt(server_fd, SOL_SOCKET, SO_REUSEADDR | SO_REUSEPORT, &opt, sizeof(opt))) { printf("[Deci2Server] Failed to setsockopt 1\n"); close(server_fd); @@ -64,7 +60,7 @@ bool Deci2Server::init() { return false; } - const char one = 1; + int one = 1; if (setsockopt(server_fd, SOL_TCP, TCP_NODELAY, &one, sizeof(one))) { printf("[Deci2Server] Failed to setsockopt 2\n"); close(server_fd); diff --git a/game/system/Deci2Server.h b/game/system/Deci2Server.h index 388ee5ec7a..8695ff020d 100644 --- a/game/system/Deci2Server.h +++ b/game/system/Deci2Server.h @@ -8,7 +8,7 @@ #ifndef JAK1_DECI2SERVER_H #define JAK1_DECI2SERVER_H -#include +#include #include #include #include diff --git a/game/system/SystemThread.cpp b/game/system/SystemThread.cpp index 5159dd0920..64121c6e11 100644 --- a/game/system/SystemThread.cpp +++ b/game/system/SystemThread.cpp @@ -99,7 +99,6 @@ void SystemThread::start(std::function f) { * Join a system thread */ void SystemThread::join() { - void* x; thread.join(); running = false; } @@ -166,5 +165,5 @@ void SystemThreadInterface::report_perf_stats() { thread.last_cpu_user = current_user; thread.last_collection_nanoseconds = current_ns; } -} +} #endif \ No newline at end of file diff --git a/game/system/SystemThread.h b/game/system/SystemThread.h index c9dc513312..0a01af1837 100644 --- a/game/system/SystemThread.h +++ b/game/system/SystemThread.h @@ -10,7 +10,9 @@ #include #include #include +#include #include + #include "Timer.h" constexpr int MAX_SYSTEM_THREADS = 16; diff --git a/goalc/goos/Reader.cpp b/goalc/goos/Reader.cpp index b3d8fa6035..33fcc0a6fa 100644 --- a/goalc/goos/Reader.cpp +++ b/goalc/goos/Reader.cpp @@ -66,9 +66,7 @@ void TextStream::seek_past_whitespace_and_comments() { } } -Reader::~Reader() { - printf("destroying reader\n"); -} +Reader::~Reader() {} Reader::Reader() { // third-party library used for a fancy line in @@ -634,7 +632,6 @@ bool Reader::try_token_as_hex(const Token& tok, Object& obj) { * 64-bit signed. Won't accept values between INT64_MAX and UINT64_MAX. */ bool Reader::try_token_as_integer(const Token& tok, Object& obj) { - printf("try token as integer %ld %s\n", tok.text.size(), tok.text.c_str()); if (decimal_start(tok.text[0]) && !str_contains(tok.text, '.')) { // determine if we look like a number or not. If we look like a number, but stoll fails, // it means that the number is too big or too small, and we should error @@ -648,18 +645,13 @@ bool Reader::try_token_as_integer(const Token& tok, Object& obj) { return false; } } - - printf("going to try stoll...\n"); uint64_t v = 0; try { std::size_t end = 0; v = std::stoll(tok.text, &end); - printf("stoll didn't throw, got %ld\n", v); if (end != tok.text.size()) { - printf("didn't read whole thing\n"); return false; } - printf("returning object!\n"); obj = Object::make_integer(v); return true; } catch (std::exception& e) { @@ -667,7 +659,6 @@ bool Reader::try_token_as_integer(const Token& tok, Object& obj) { } } return false; - } bool Reader::try_token_as_char(const Token& tok, Object& obj) { diff --git a/goalc/listener/Listener.cpp b/goalc/listener/Listener.cpp index b19ddf011c..1561f39899 100644 --- a/goalc/listener/Listener.cpp +++ b/goalc/listener/Listener.cpp @@ -10,8 +10,6 @@ #include #include #include -#include -#include #include #include "Listener.h" #include "common/versions.h" @@ -74,7 +72,7 @@ bool Listener::connect_to_target(const std::string& ip, int port) { } // set nodelay, which makes small rapid messages faster, but large messages slower - const char one = 1; + int one = 1; if (setsockopt(socket_fd, SOL_TCP, TCP_NODELAY, &one, sizeof(one))) { printf("[Listener] failed to TCP_NODELAY\n"); close(socket_fd); diff --git a/test/test_kernel.cpp b/test/test_kernel.cpp index 5bc2e09670..fb4b17a4c9 100644 --- a/test/test_kernel.cpp +++ b/test/test_kernel.cpp @@ -157,7 +157,7 @@ TEST(Kernel, ftoa) { ftoa(buffer, 1., 1, ' ', 1, 0); EXPECT_EQ("1.0", std::string(buffer)); - float zero = 0.0f; + float zero = 0.0f; ftoa(buffer, 0.f / zero, 1, ' ', 4, 0); EXPECT_EQ("NaN", std::string(buffer)); diff --git a/test/test_listener_deci2.cpp b/test/test_listener_deci2.cpp index 7888a9fd87..d7b65cba2a 100644 --- a/test/test_listener_deci2.cpp +++ b/test/test_listener_deci2.cpp @@ -1,4 +1,4 @@ -#ifdef __unix__ +#ifdef __linux__ #include "gtest/gtest.h" #include "goalc/listener/Listener.h"