RME icon indicating copy to clipboard operation
RME copied to clipboard

Linux build completely broken

Open pseregiet opened this issue 7 months ago • 1 comments

Code doesn't build on Linux because of few errors and even missing cpp files in the Cmake. Is the CMake not maintained at all ? I've fixed the build as best as I could and I get the editor to start up, however, when opening a new empty map the program eventually crashes. I'm trying to debug it but no luck so far with even getting a trace (it crashes on some X11 error)

Here's my diff to even get you started on Linux, but please let me know if this fork is even supported or is it completely broken and abandoned.

diff --git a/CMakeLists.txt b/CMakeLists.txt
index d2f8d6b..71184fb 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,7 +1,6 @@
 cmake_minimum_required(VERSION 3.1)
 
 project(rme)
-
 if(NOT CMAKE_BUILD_TYPE)
 	set(CMAKE_BUILD_TYPE RelWithDebInfo)
 endif()
@@ -37,4 +36,4 @@ set_target_properties(rme PROPERTIES CXX_STANDARD 17)
 set_target_properties(rme PROPERTIES CXX_STANDARD_REQUIRED ON)
 
 include_directories(${Boost_INCLUDE_DIRS} ${LibArchive_INCLUDE_DIRS} ${OPENGL_INCLUDE_DIR} ${GLUT_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIR})
-target_link_libraries(rme ${wxWidgets_LIBRARIES} ${Boost_LIBRARIES} ${LibArchive_LIBRARIES} ${OPENGL_LIBRARIES} ${GLUT_LIBRARIES} ${ZLIB_LIBRARIES})
\ No newline at end of file
+target_link_libraries(rme ${wxWidgets_LIBRARIES} ${Boost_LIBRARIES} ${LibArchive_LIBRARIES} ${OPENGL_LIBRARIES} ${GLUT_LIBRARIES} ${ZLIB_LIBRARIES})
diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt
index 421e2c0..b44c665 100644
--- a/source/CMakeLists.txt
+++ b/source/CMakeLists.txt
@@ -1,6 +1,7 @@
 set(rme_H
 ${CMAKE_CURRENT_LIST_DIR}/about_window.h
 ${CMAKE_CURRENT_LIST_DIR}/action.h
+${CMAKE_CURRENT_LIST_DIR}/add_item_window.h
 ${CMAKE_CURRENT_LIST_DIR}/application.h
 ${CMAKE_CURRENT_LIST_DIR}/artprovider.h
 ${CMAKE_CURRENT_LIST_DIR}/basemap.h
@@ -95,6 +96,8 @@ ${CMAKE_CURRENT_LIST_DIR}/templates.h
 ${CMAKE_CURRENT_LIST_DIR}/threads.h
 ${CMAKE_CURRENT_LIST_DIR}/tile.h
 ${CMAKE_CURRENT_LIST_DIR}/tileset.h
+${CMAKE_CURRENT_LIST_DIR}/tileset_window.h
+${CMAKE_CURRENT_LIST_DIR}/add_tileset_window.h
 ${CMAKE_CURRENT_LIST_DIR}/town.h
 ${CMAKE_CURRENT_LIST_DIR}/updater.h
 ${CMAKE_CURRENT_LIST_DIR}/wall_brush.h
@@ -106,6 +109,7 @@ ${CMAKE_CURRENT_LIST_DIR}/welcome_dialog.h
 set(rme_SRC
 ${CMAKE_CURRENT_LIST_DIR}/about_window.cpp
 ${CMAKE_CURRENT_LIST_DIR}/action.cpp
+${CMAKE_CURRENT_LIST_DIR}/add_item_window.cpp
 ${CMAKE_CURRENT_LIST_DIR}/application.cpp
 ${CMAKE_CURRENT_LIST_DIR}/artprovider.cpp
 ${CMAKE_CURRENT_LIST_DIR}/basemap.cpp
@@ -192,6 +196,8 @@ ${CMAKE_CURRENT_LIST_DIR}/templatemap854.cpp
 ${CMAKE_CURRENT_LIST_DIR}/templatemapclassic.cpp
 ${CMAKE_CURRENT_LIST_DIR}/tile.cpp
 ${CMAKE_CURRENT_LIST_DIR}/tileset.cpp
+${CMAKE_CURRENT_LIST_DIR}/tileset_window.cpp
+${CMAKE_CURRENT_LIST_DIR}/add_tileset_window.cpp
 ${CMAKE_CURRENT_LIST_DIR}/town.cpp
 ${CMAKE_CURRENT_LIST_DIR}/updater.cpp
 ${CMAKE_CURRENT_LIST_DIR}/wall_brush.cpp
diff --git a/source/graphics.cpp b/source/graphics.cpp
index 3c08d61..9b15a2c 100644
--- a/source/graphics.cpp
+++ b/source/graphics.cpp
@@ -1147,6 +1147,8 @@ void GameSprite::Image::createGLTexture(GLuint whatid) {
 	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, 0x812F); // GL_CLAMP_TO_EDGE
 	glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, SPRITE_PIXELS, SPRITE_PIXELS, 0, GL_RGBA, GL_UNSIGNED_BYTE, rgba);
 
+	printf("gfx: texture %u\n", whatid);
+
 	delete[] rgba;
 #undef SPRITE_SIZE
 }
diff --git a/source/light_drawer.cpp b/source/light_drawer.cpp
index 33122ef..c88f96c 100644
--- a/source/light_drawer.cpp
+++ b/source/light_drawer.cpp
@@ -143,8 +143,13 @@ void LightDrawer::clear() noexcept {
 }
 
 void LightDrawer::createGLTexture() {
+	texture = 0xdeadbeef;
 	glGenTextures(1, &texture);
-	ASSERT(texture == 0);
+	printf("tex: %u\n", texture);
+	auto code = glGetError();
+	fprintf(stderr, "OpenGL error: %d, %u\n", code, texture);
+
+	//ASSERT(texture == 0);
 }
 
 void LightDrawer::unloadGLTexture() {
diff --git a/source/map_drawer.cpp b/source/map_drawer.cpp
index 7cf6539..8ebf916 100644
--- a/source/map_drawer.cpp
+++ b/source/map_drawer.cpp
@@ -178,6 +178,13 @@ void MapDrawer::SetupGL() {
 	glPushMatrix();
 	glLoadIdentity();
 	glTranslatef(0.375f, 0.375f, 0.0f);
+
+	printf("SetupGL()\n");
+
+	GLuint texture = 0xdeadbeef;
+	glGenTextures(1, &texture);
+	auto code = glGetError();
+	fprintf(stderr, "OpenGL status: %d, %x\n", code, texture);
 }
 
 void MapDrawer::Release() {
@@ -1456,7 +1463,7 @@ void MapDrawer::WriteTooltip(Item* item, std::ostringstream& stream, bool isHous
 		stream << "text: " << text << "\n";
 	}
 	if (tp) {
-		Position& dest = tp->getDestination();
+		auto dest = tp->getDestination();
 		stream << "destination: " << dest.x << ", " << dest.y << ", " << dest.z << "\n";
 	}
 }
@@ -1870,7 +1877,7 @@ void MapDrawer::AddLight(TileLocation* location) {
 		return;
 	}
 
-	auto& position = location->getPosition();
+	auto position = location->getPosition();
 
 	if (tile->ground) {
 		if (tile->ground->hasLight()) {
diff --git a/source/old_properties_window.cpp b/source/old_properties_window.cpp
index ddbcd28..a7b27c4 100644
--- a/source/old_properties_window.cpp
+++ b/source/old_properties_window.cpp
@@ -771,7 +771,7 @@ void OldPropertiesWindow::OnClickOK(wxCommandEvent& WXUNUSED(event)) {
 				}
 			}
 
-			Outfit& newOutfit = Outfit();
+			auto newOutfit = Outfit();
 			if (podium) {
 				int newLookType = look_type->GetValue();
 				int newMount = look_mount->GetValue();
diff --git a/source/palette_brushlist.cpp b/source/palette_brushlist.cpp
index 9d555e3..3f5994d 100644
--- a/source/palette_brushlist.cpp
+++ b/source/palette_brushlist.cpp
@@ -255,7 +255,7 @@ void BrushPalettePanel::OnClickAddItemToTileset(wxCommandEvent& WXUNUSED(event))
 	if (!choicebook) {
 		return;
 	}
-	std::string tilesetName = choicebook->GetPageText(choicebook->GetSelection());
+	std::string tilesetName = choicebook->GetPageText(choicebook->GetSelection()).ToStdString();
 
 	auto _it = g_materials.tilesets.find(tilesetName);
 	if (_it != g_materials.tilesets.end()) {

pseregiet avatar Jan 23 '24 18:01 pseregiet