summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/actions/actions.cpp83
-rw-r--r--src/actions/actions.h1
-rw-r--r--src/commands.cpp86
-rw-r--r--src/commands.h5
-rw-r--r--src/input/inputaction.h1
-rw-r--r--src/input/inputactionmap.h11
-rw-r--r--src/input/pages/other.cpp6
7 files changed, 102 insertions, 91 deletions
diff --git a/src/actions/actions.cpp b/src/actions/actions.cpp
index fd71b5bf5..3111c551f 100644
--- a/src/actions/actions.cpp
+++ b/src/actions/actions.cpp
@@ -789,4 +789,87 @@ impHandler0(uptime)
return true;
}
+#ifdef DEBUG_DUMP_LEAKS1
+static void showRes(std::string str, ResourceManager::Resources *res)
+{
+ if (!res)
+ return;
+
+ str.append(toString(res->size()));
+ if (debugChatTab)
+ debugChatTab->chatLog(str);
+ logger->log(str);
+ ResourceManager::ResourceIterator iter = res->begin();
+ const ResourceManager::ResourceIterator iter_end = res->end();
+ while (iter != iter_end)
+ {
+ if (iter->second && iter->second->getRefCount())
+ {
+ char type = ' ';
+ char isNew = 'N';
+ if (iter->second->getDumped())
+ isNew = 'O';
+ else
+ iter->second->setDumped(true);
+
+ SubImage *const subImage = dynamic_cast<SubImage *const>(
+ iter->second);
+ Image *const image = dynamic_cast<Image *const>(iter->second);
+ int id = 0;
+ if (subImage)
+ type = 'S';
+ else if (image)
+ type = 'I';
+ if (image)
+ id = image->getGLImage();
+ logger->log("Resource %c%c: %s (%d) id=%d", type,
+ isNew, iter->second->getIdPath().c_str(),
+ iter->second->getRefCount(), id);
+ }
+ ++ iter;
+ }
+}
+
+impHandler(dump)
+{
+ if (!debugChatTab)
+ return false;
+
+ ResourceManager *const resman = ResourceManager::getInstance();
+
+ if (!event.args.empty())
+ {
+ ResourceManager::Resources *res = resman->getResources();
+ // TRANSLATORS: dump command
+ showRes(_("Resource images:"), res);
+ res = resman->getOrphanedResources();
+ // TRANSLATORS: dump command
+ showRes(_("Resource orphaned images:"), res);
+ }
+ else
+ {
+ ResourceManager::Resources *res = resman->getResources();
+ // TRANSLATORS: dump command
+ debugChatTab->chatLog(_("Resource images:") + toString(res->size()));
+ res = resman->getOrphanedResources();
+ // TRANSLATORS: dump command
+ debugChatTab->chatLog(_("Resource orphaned images:")
+ + toString(res->size()));
+ }
+ return true;
+}
+
+#elif defined ENABLE_MEM_DEBUG
+impHandler0(dump)
+{
+ check_leaks();
+ return true;
+}
+#else
+impHandler0(dump)
+{
+ return true;
+}
+#endif
+
} // namespace Actions
diff --git a/src/actions/actions.h b/src/actions/actions.h
index 9258a289b..5a60e83f9 100644
--- a/src/actions/actions.h
+++ b/src/actions/actions.h
@@ -68,6 +68,7 @@ namespace Actions
decHandler(undress);
decHandler(dirs);
decHandler(uptime);
+ decHandler(dump);
} // namespace Actions
#undef decHandler
diff --git a/src/commands.cpp b/src/commands.cpp
index fe49d64d6..b1c6537f6 100644
--- a/src/commands.cpp
+++ b/src/commands.cpp
@@ -572,92 +572,6 @@ impHandler0(dumpGL)
}
#endif
-#ifdef DEBUG_DUMP_LEAKS1
-void showRes(std::string str, ResourceManager::Resources *res);
-
-void showRes(std::string str, ResourceManager::Resources *res)
-{
- if (!res)
- return;
-
- str.append(toString(res->size()));
- if (debugChatTab)
- debugChatTab->chatLog(str);
- logger->log(str);
- ResourceManager::ResourceIterator iter = res->begin();
- const ResourceManager::ResourceIterator iter_end = res->end();
- while (iter != iter_end)
- {
- if (iter->second && iter->second->getRefCount())
- {
- char type = ' ';
- char isNew = 'N';
- if (iter->second->getDumped())
- isNew = 'O';
- else
- iter->second->setDumped(true);
-
- SubImage *const subImage = dynamic_cast<SubImage *const>(
- iter->second);
- Image *const image = dynamic_cast<Image *const>(iter->second);
- int id = 0;
- if (subImage)
- type = 'S';
- else if (image)
- type = 'I';
- if (image)
- id = image->getGLImage();
- logger->log("Resource %c%c: %s (%d) id=%d", type,
- isNew, iter->second->getIdPath().c_str(),
- iter->second->getRefCount(), id);
- }
- ++ iter;
- }
-}
-
-impHandler(dump)
-{
- if (!debugChatTab)
- return false;
-
- ResourceManager *const resman = ResourceManager::getInstance();
-
- if (!event.args.empty())
- {
- ResourceManager::Resources *res = resman->getResources();
- // TRANSLATORS: dump command
- showRes(_("Resource images:"), res);
- res = resman->getOrphanedResources();
- // TRANSLATORS: dump command
- showRes(_("Resource orphaned images:"), res);
- }
- else
- {
- ResourceManager::Resources *res = resman->getResources();
- // TRANSLATORS: dump command
- debugChatTab->chatLog(_("Resource images:") + toString(res->size()));
- res = resman->getOrphanedResources();
- // TRANSLATORS: dump command
- debugChatTab->chatLog(_("Resource orphaned images:")
- + toString(res->size()));
- }
- return true;
-}
-
-#elif defined ENABLE_MEM_DEBUG
-impHandler0(dump)
-{
- check_leaks();
- return true;
-}
-#else
-impHandler0(dump)
-{
- return true;
-}
-#endif
-
-
impHandler0(dumpOGL)
{
#if defined USE_OPENGL && !defined ANDROID
diff --git a/src/commands.h b/src/commands.h
index 7e675d642..9bad6c4ab 100644
--- a/src/commands.h
+++ b/src/commands.h
@@ -58,7 +58,6 @@ namespace Commands
decHandler(error) __attribute__ ((noreturn));
decHandler(url);
decHandler(open);
- decHandler(dump);
decHandler(dumpGraphics);
decHandler(dumpEnvironment);
decHandler(dumpTests);
@@ -88,8 +87,7 @@ namespace Commands
enum
{
- COMMAND_DUMP = 0,
- COMMAND_SERVERIGNOREALL,
+ COMMAND_SERVERIGNOREALL = 0,
COMMAND_SERVERUNIGNOREALL,
COMMAND_SETDROP,
COMMAND_ERROR,
@@ -124,7 +122,6 @@ enum
static const CommandInfo commands[] =
{
- {"dump", &Commands::dump, -1, false},
{"serverignoreall", &Commands::serverIgnoreAll, -1, false},
{"serverunignoreall", &Commands::serverUnIgnoreAll, -1, false},
{"setdrop", &Commands::setDrop, -1, true},
diff --git a/src/input/inputaction.h b/src/input/inputaction.h
index 292f5a812..3d5353deb 100644
--- a/src/input/inputaction.h
+++ b/src/input/inputaction.h
@@ -393,6 +393,7 @@ namespace InputAction
ADD_ATTACK,
REMOVE_ATTACK,
ADD_IGNORE_ATTACK,
+ DUMP,
TOTAL
};
} // namespace InputAction
diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h
index 65cf48391..ff79cafb3 100644
--- a/src/input/inputactionmap.h
+++ b/src/input/inputactionmap.h
@@ -3306,7 +3306,16 @@ static const InputActionData inputActionData[InputAction::TOTAL] = {
InputAction::NO_VALUE, 50,
InputCondition::INGAME,
"addignoreattack",
- true}
+ true},
+ {"keyDump",
+ InputType::UNKNOWN, InputAction::NO_VALUE,
+ InputType::UNKNOWN, InputAction::NO_VALUE,
+ Input::GRP_DEFAULT,
+ &Actions::dump,
+ InputAction::NO_VALUE, 50,
+ InputCondition::INGAME,
+ "dump",
+ false}
};
#endif // INPUT_INPUTACTIONMAP_H
diff --git a/src/input/pages/other.cpp b/src/input/pages/other.cpp
index 4931c1216..6bafbf8c3 100644
--- a/src/input/pages/other.cpp
+++ b/src/input/pages/other.cpp
@@ -280,6 +280,12 @@ SetupActionData setupActionDataOther[] =
"",
},
{
+ // TRANSLATORS: input action name
+ N_("Dump debug information"),
+ InputAction::DUMP,
+ "",
+ },
+ {
"",
InputAction::NO_VALUE,
""