Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SS:TSE\TFE] Having problems after compiling the game for RISC-V #73

Open
Architector120 opened this issue Dec 24, 2024 · 1 comment
Open

Comments

@Architector120
Copy link

Hi, I'm trying to compile a game for a new board (Milk-V Jupiter) with a RISC-V SpacemiT K1 CPU.
Yes, I know this architecture is not currently supported by the game, but I still managed to compile it by making a few changes to the code. And as a result, after loading the game I get a black screen... what might be the cause?

Changes I made to the code to make it compile:

diff --git a/Sources/CMakeLists.txt b/Sources/CMakeLists.txt
index 72a25a5..9e3fde5 100755
--- a/Sources/CMakeLists.txt
+++ b/Sources/CMakeLists.txt
@@ -107,0 +108,3 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang" OR CMAKE_C_CO
+       if(CMAKE_SYSTEM_PROCESSOR MATCHES "riscv64")
+               add_compile_options(-march=rv64gcv)
+       endif()
diff --git a/Sources/Engine/Base/Types.h b/Sources/Engine/Base/Types.h
index e8dc080..d713892 100755
--- a/Sources/Engine/Base/Types.h
+++ b/Sources/Engine/Base/Types.h
@@ -68 +68 @@ typedef uint32_t UINT;
-    || defined(_M_IA64) || defined(__IA64__) || defined(__e2k__)
+    || defined(_M_IA64) || defined(__IA64__) || defined(__e2k__) || defined(__riscv)

Without the changes shown above, I get an error at the beginning of compilation:

architector120@milkv-jupiter:~/build/Serious-Engine/Sources$ ./build-linux64.sh
Will build with 'make -j2' ... please edit this script if incorrect.
+ rm -rf cmake-build
+ mkdir cmake-build
+ cd cmake-build
+ cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo ..
-- The C compiler identification is GNU 13.2.0
-- The CXX compiler identification is GNU 13.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Found SDL2: /usr/lib/riscv64-linux-gnu/libSDL2main.a;/usr/lib/riscv64-linux-gnu/libSDL2.so
-- Found ZLIB: /usr/lib/riscv64-linux-gnu/libz.so (found version "1.3.1")
-- Using assembler code (when available)
-- Not using i386 nasm ASM
-- Configuring done (2.8s)
-- Generating done (0.5s)
-- Build files have been written to: /home/architector120/build/Serious-Engine/Sources/cmake-build
+ echo 'ECC first'
ECC first
+ make ecc
[  0%] Generating /home/architector120/build/Serious-Engine/Sources/Ecc/Scanner.cpp
[  0%] Generating /home/architector120/build/Serious-Engine/Sources/Ecc/Parser.cpp, /home/architector120/build/Serious-Engine/Sources/Ecc/Parser.hpp
Parser.y: warning: 86 shift/reduce conflicts [-Wconflicts-sr]
Parser.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
Parser.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
Parser.y:386.4: warning: rule useless in parser due to conflicts [-Wother]
  386 |   : /* null */
      |    ^
[  0%] Generating /home/architector120/build/Serious-Engine/Sources/Ecc/Parser.h
[  0%] Building CXX object Ecc/CMakeFiles/ecc.dir/Main.cpp.o
c++: error: ‘-march=native’: ISA string must begin with rv32 or rv64
make[3]: *** [Ecc/CMakeFiles/ecc.dir/build.make:91: Ecc/CMakeFiles/ecc.dir/Main.cpp.o] Error 1
make[2]: *** [CMakeFiles/Makefile2:268: Ecc/CMakeFiles/ecc.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:275: Ecc/CMakeFiles/ecc.dir/rule] Error 2
make: *** [Makefile:247: ecc] Error 2

After compiling and adding the compiled binaries to the Steam version of the game. I launched it, and stuck on black screen with music playing in background after the game fully load...
I pressed Enter several times, and the game tries to load the first level and hangs on an endless loading screen...
Screenshot from 2024-12-24 17-30-52
Here is the console output:

rchitector120@milkv-jupiter:~/Games/Serious Sam Classic The Second Encounter$ ./Bin/ssam 
STUBBED: load window icon in /home/architector120/build/Serious-Engine/Sources/SeriousSam/MainWindow.cpp, line 168.
STUBBED: Need SDL invisible window or something in /home/architector120/build/Serious-Engine/Sources/SeriousSam/MainWindow.cpp, line 327.
STUBBED: !!! FIXME: get the code back in from Ryan's original port. in /home/architector120/build/Serious-Engine/Sources/Engine/Base/Stream.cpp, line 921.
STUBBED: co-opt the existing T-buffer support for multisampling? in /home/architector120/build/Serious-Engine/Sources/Engine/Graphics/SDL/SDLOpenGL.cpp, line 113.
STUBBED: this can't possibly be right, yeah? in /home/architector120/build/Serious-Engine/Sources/Engine/Base/SDL/SDLEvents.cpp, line 152.
STUBBED: Not 64-bit clean in /home/architector120/build/Serious-Engine/Sources/EntitiesMP/Player.es, line 6561.

I think my case is similar to this issue #64. any ideas?

@ptitSeb
Copy link
Owner

ptitSeb commented Dec 24, 2024

I have some risc-v machine, I need to try on my side to debug. It's been a long time since I worked on that engine, I need to refresh my memory...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants