diff --git a/Memory.xml b/Memory.xml
index f651c07df..0d3129ec7 100644
--- a/Memory.xml
+++ b/Memory.xml
@@ -1028,6 +1028,7 @@
+
@@ -3058,6 +3059,7 @@
+
diff --git a/library/include/dfhack/modules/World.h b/library/include/dfhack/modules/World.h
index c33ffed6b..7203d775f 100644
--- a/library/include/dfhack/modules/World.h
+++ b/library/include/dfhack/modules/World.h
@@ -107,6 +107,7 @@ namespace DFHack
void SetCurrentWeather(uint8_t weather);
bool ReadGameMode(t_gamemodes& rd);
bool WriteGameMode(const t_gamemodes & wr); // this is very dangerous
+ std::string ReadWorldFolder();
private:
struct Private;
Private *d;
diff --git a/library/modules/World.cpp b/library/modules/World.cpp
index 042864261..f19f94a9d 100644
--- a/library/modules/World.cpp
+++ b/library/modules/World.cpp
@@ -67,6 +67,10 @@ struct World::Private
uint32_t gamemode_offset;
uint32_t controlmode_offset;
uint32_t controlmodecopy_offset;
+
+ bool StartedFolder;
+ uint32_t folder_name_offset;
+
Process * owner;
};
@@ -106,6 +110,14 @@ World::World()
d->StartedMode = true;
}
catch(Error::All &){};
+ try
+ {
+ d->folder_name_offset = OG_World->getAddress( "save_folder" );
+ d->StartedFolder = true;
+ }
+ catch(Error::All &){};
+
+
d->Inited = true;
}
@@ -220,3 +232,12 @@ void World::SetCurrentWeather(uint8_t weather)
d->owner->write(d->weather_offset,sizeof(buf),buf);
}
}
+
+string World::ReadWorldFolder()
+{
+ if (d->Inited && d->StartedFolder)
+ {
+ return string( * ( (string*) d->folder_name_offset ) );
+ }
+ return string("");
+}