Hi guys. I have been playing around with building the latest DROD 5 source code so that I can have it run on the Raspberry Pi under Raspbian OS.
It has been a learning experience for me and I am so close to getting everything working! But I am stuck at an error at runtime that I can't solve.
You can see in the screenshot attached the stage I am at right now. A windows opens with the Door.png graphic, but then I get an error dialog saying "
DROD couldn't load certain files that it needs. Try closing other applications to make more memory available. It's also possible that files are missing or corrupted, and reinstalling DROD would fix this problem."
I tried adding some cout statements to the code to see up to which point initialisation fails. Eventually, I was able to deduce that it fails when loading a certain bitmap resource when loading the GameScreen class. I added some cout lines to the CWidget:Load() method in Widget.cpp around line 455.
if (!pSurface){
std::cout << "Failed to load bitmap: " << this->imageFilenames[wIndex].c_str() << std::endl;
return false;
}
else{
std::cout << "Bitmap loaded successfully:" << this->imageFilenames[wIndex].c_str() << std::endl;
}
Compiling and running this gives what is shown in the terminal window in the screenshot:
Failed to load bitmap: Fog1
The error is the same when using the Data folder from both full and demo versions of DROD:TSS.
Is it an error with a library? It seems strange because other resources are loading fine.
If it helps, below is the process that I followed.
Building DROD
First I cloned the official github repository, then I manually downloaded and compiled the libraries that were listed in the instructions for compiling DROD for Windows.
Compiling and building the dependencies from source was surprisingly a breeze since it is so optimised for Linux. It was a much less painful experience for me than compiling for Windows!
Once they were compiled, included and linked correctly, I encountered relatively few errors trying to build the whole project. Firstly I had to modify the architecture flags so that they were optimised for the Raspberry Pi 3. Inside the ninjamaker file in the Master/Linux directory I added a new entry called [arm] inside archflags around line 15.
archflags=(
[x86_64]="-m64"
[i686]="-m32 -march=i686"
[arm]="-mfpu=crypto-neon-fp-armv8 -march=armv8-a+crc -mcpu=cortex-a53"
)
Then I changed the options[arch] parameter accordingly around line 60
options[arch]=arm
This time after running ./ninjamaker and ./build, most C++ files are compiling successfully!
Compiling
I then encountered some compiler errors in BackEndLib/PortsBase.h and DROD/RoomWidget.cpp
In PortsBase.h an error was being raised saying "
Unknown byte order. Please add your system above"
. Running lscpu in the terminal reveals that the system is little endian, so I modified line 81 like so:
# if (defined(WIN32) || defined(__i386__) || defined(__x86_64__) || defined(__ARM__))
Then I added a define statement at the top of PortsBase.h
#define __ARM__
In RoomWidget.cpp there was an error in line 7706 "
narrowing conversion of 'M_NONE' from 'unsigned int' to 'int'"
. M_NONE is the enum equivalent of -1 according to MonsterType.h so I changed the code like so
case -1: return false; //Don't show anything if player is not being shown.
Now everything is compiling successfully. Hooray!
Linking
This was mostly straightforward. The build system found nearly all of the external dependencies that I built from source in /usr/local/.
I encountered an error linking metakit: "
ld: cannot find -lmk4"
. I couldn't figure out how to compile metakit as a static library, so I added a "
-Wl,-Bdynamic"
flag before the "
-lmk4"
flag in my ninjamaker file around line 190.
staticlibs = ... -ltheora -lvorbisfile -lvorbis -logg -ljpeg -Wl,Bdynamic -lmk4 $(${PKG_CONFIG} --libs freetype2 libpng libcurl expat jsoncpp zlib)
Finally everything is linking and building correctly, and I get an executable!
Running
I navigate to the Master/Linux/builds/custom.release.arm/ folder and copy the Data directory from my full copy of DROD:TSS. Running the game using ./drod in the terminal leads me up to the current point in the screenshot.