[Scummvm-cvs-logs] SF.net SVN: scummvm:[41767] tools/branches/gsoc2009-gui/gui
Remere at users.sourceforge.net
Remere at users.sourceforge.net
Mon Jun 22 14:47:08 CEST 2009
Revision: 41767
http://scummvm.svn.sourceforge.net/scummvm/?rev=41767&view=rev
Author: Remere
Date: 2009-06-22 12:47:08 +0000 (Mon, 22 Jun 2009)
Log Message:
-----------
*Added the rest of the tools.
*Tools now contain games they support, and list is fetched automatically from all tools.
*Tools now have types to differentiate between them.
Modified Paths:
--------------
tools/branches/gsoc2009-gui/gui/pages.cpp
tools/branches/gsoc2009-gui/gui/tools.cpp
tools/branches/gsoc2009-gui/gui/tools.h
Modified: tools/branches/gsoc2009-gui/gui/pages.cpp
===================================================================
--- tools/branches/gsoc2009-gui/gui/pages.cpp 2009-06-22 12:03:58 UTC (rev 41766)
+++ tools/branches/gsoc2009-gui/gui/pages.cpp 2009-06-22 12:47:08 UTC (rev 41767)
@@ -168,59 +168,8 @@
sizer->Add(new wxStaticText(panel, wxID_ANY,
wxT("Please select for what game/engine you'd like to compress files.")));
- // This list is most likely incomplete
- wxArrayString choices;
+ wxArrayString choices = g_tools.getGameList(TOOLTYPE_COMPRESSION);
- // Many games use the same tool internally, and are grouped by tool used here
- // the array is ordered before being displayed, though
-
- // TODO: This should be moved to tools.cpp and stored in each tool instead
-
- // compress_agos
- choices.Add(wxT("Feeble Files")),
- choices.Add(wxT("Simon the Sorcerer I/II")),
-
- // compress_gob
- choices.Add(wxT("Gobliiins (all versions)")),
-
- // compress_kyra
- choices.Add(wxT("The Legend of Kyrandia")),
- choices.Add(wxT("The Legend of Kyrandia: Hand of Fate")),
- choices.Add(wxT("The Legend of Kyrandia: Malcolm's Revenge")),
- choices.Add(wxT("Lands of Lore: The Throne of Chaos")),
-
- // compress_queen
- choices.Add(wxT("Flight of the Amazon Queen")),
-
- // compress_saga
- choices.Add(wxT("SAGA: Inherit The Earth")),
- choices.Add(wxT("I Have No Mouth and I Must Scream")),
-
- // compress_scumm_bun
- choices.Add(wxT("The Secret of Monkey Island")),
- choices.Add(wxT("Monkey Island 2: LeChuck's Revenge")),
- choices.Add(wxT("The Curse of Monkey Island")),
-
- // compress_scumm_san
- // compress_scumm_sou
- // Unsure of exact games...
-
- // compress_sword1
- choices.Add(wxT("Broken Sword 1")),
-
- // compress_sword2
- choices.Add(wxT("Broken Sword 2")),
-
- // compress_touche
- choices.Add(wxT("Touche: The Adventures of the Fifth Musketeer")),
-
- // compress_tucker
- choices.Add(wxT("Bud Tucker in Double Trouble")),
-
-
- // Sort the array for display
- choices.Sort();
-
wxChoice *game = new wxChoice(panel, wxID_ANY, wxDefaultPosition, wxDefaultSize,
choices, 0, wxDefaultValidator, wxT("GameSelection"));
sizer->Add(game);
@@ -259,8 +208,7 @@
sizer->Add(new wxStaticText(panel, wxID_ANY,
wxT("Select what tool you'd like to use.")));
- // This list is most likely incomplete
- wxArrayString choices = g_tools.getToolList();
+ wxArrayString choices = g_tools.getToolList(TOOLTYPE_ALL);
// Sort the array for display (it should actually always be sorted since
// they're stored in a ordered tree but you can never be too safe)
Modified: tools/branches/gsoc2009-gui/gui/tools.cpp
===================================================================
--- tools/branches/gsoc2009-gui/gui/tools.cpp 2009-06-22 12:03:58 UTC (rev 41766)
+++ tools/branches/gsoc2009-gui/gui/tools.cpp 2009-06-22 12:47:08 UTC (rev 41767)
@@ -30,35 +30,165 @@
#include "wx/wx.h"
#endif
+#include <algorithm>
+
#include "tools.h"
Tools g_tools;
Tools::Tools() {
+ // Compression tools
+
// Compress agos also has a --mac parameter, need to add an additional page / option for this
Tool compress_agos(wxT("compress_agos"), wxT("*."));
+ compress_agos.addGame(wxT("Feeble Files")),
+ compress_agos.addGame(wxT("Simon the Sorcerer I/II")),
addTool(compress_agos);
+ // compress_gob
Tool compress_gob(wxT("compress_gob"), wxT("*.*"));
addTool(compress_gob);
+ // compress_kyra
Tool compress_kyra(wxT("compress_kyra"), wxT("*.*"));
+ compress_kyra.addGame(wxT("The Legend of Kyrandia")),
+ compress_kyra.addGame(wxT("The Legend of Kyrandia: Hand of Fate")),
+ compress_kyra.addGame(wxT("The Legend of Kyrandia: Malcolm's Revenge")),
+ compress_kyra.addGame(wxT("Lands of Lore: The Throne of Chaos")),
addTool(compress_kyra);
+
+ // compress_queen
+ Tool compress_queen(wxT("compress_queen"), wxT("queen.1"));
+ compress_queen.addGame(wxT("Flight of the Amazon Queen")),
+ addTool(compress_queen);
+
+ // compress_saga
+ Tool compress_saga(wxT("compress_saga"), wxT("*.*"));
+ compress_saga.addGame(wxT("SAGA: Inherit The Earth")),
+ compress_saga.addGame(wxT("I Have No Mouth and I Must Scream")),
+ addTool(compress_saga);
+
+ // compress_scumm_bun
+ Tool compress_scumm_bun(wxT("compress_scumm_bun"), wxT("*.*"));
+ compress_scumm_bun.addGame(wxT("The Secret of Monkey Island")),
+ compress_scumm_bun.addGame(wxT("Monkey Island 2: LeChuck's Revenge")),
+ compress_scumm_bun.addGame(wxT("The Curse of Monkey Island")),
+ addTool(compress_scumm_bun);
+
+ // compress_scumm_san
+ Tool compress_scumm_san(wxT("compress_scumm_san"), wxT("*.*"));
+ // Unsure of exact games...
+ addTool(compress_scumm_san);
+
+ // compress_scumm_sou
+ Tool compress_scumm_sou(wxT("compress_scumm_san"), wxT("*.*"));
+ // Unsure of exact games...
+ addTool(compress_scumm_sou);
+
+ // compress_sword1
+ Tool compress_sword1(wxT("compress_sword1"), wxT("*.*"));
+ compress_sword1.addGame(wxT("Broken Sword 1")),
+ addTool(compress_sword1);
+
+ // compress_sword2
+ Tool compress_sword2(wxT("compress_sword2"), wxT("*.*"));
+ compress_sword2.addGame(wxT("Broken Sword 2")),
+ addTool(compress_sword2);
+
+ // compress_touche
+ Tool compress_touche(wxT("compress_touche"), wxT("*.*"));
+ compress_touche.addGame(wxT("Touche: The Adventures of the Fifth Musketeer")),
+ addTool(compress_touche);
+
+ // compress_tucker
+ Tool compress_tucker(wxT("compress_tucker"), wxT("*.*"));
+ compress_tucker.addGame(wxT("Bud Tucker in Double Trouble")),
+ addTool(compress_tucker);
+
+ // Extraction tools
+
+ // Compress agos also has a --mac parameter, need to add an additional page / option for this
+ Tool extract_agos(wxT("extract_agos"), wxT("*."));
+ extract_agos.addGame(wxT("Feeble Files")),
+ extract_agos.addGame(wxT("Simon the Sorcerer I/II")),
+ addTool(extract_agos);
+
+ // extract_gob_stk
+ Tool extract_gob_stk(wxT("extract_gob_stk"), wxT("*.*"));
+ addTool(extract_gob_stk);
+
+ // extract_kyra
+ Tool extract_kyra(wxT("extract_kyra"), wxT("*.*"));
+ extract_kyra.addGame(wxT("The Legend of Kyrandia")),
+ extract_kyra.addGame(wxT("The Legend of Kyrandia: Hand of Fate")),
+ extract_kyra.addGame(wxT("The Legend of Kyrandia: Malcolm's Revenge")),
+ extract_kyra.addGame(wxT("Lands of Lore: The Throne of Chaos")),
+ addTool(extract_kyra);
+
+ // extract_loom_tg16
+ Tool extract_loom_tg16(wxT("extract_loom_tg16"), wxT("*.iso")); // Unsure of extension?
+ extract_loom_tg16.addGame(wxT("Loom")),
+ addTool(extract_loom_tg16);
+
+ // extract_mm_apple
+ Tool extract_mm_apple(wxT("extract_mm_apple"), wxT("*.dsk"));
+ extract_mm_apple.addGame(wxT("Maniac Mansion (Apple)")),
+ addTool(extract_mm_apple);
+
+ // extract_mm_nes
+ Tool extract_mm_c64(wxT("extract_mm_c64"), wxT("*.d64"));
+ extract_mm_c64.addGame(wxT("Maniac Mansion (Commodore 64)")),
+ addTool(extract_mm_c64);
+
+ // extract_mm_nes
+ Tool extract_mm_nes(wxT("extract_mm_nes"), wxT("*.PRG"));
+ extract_mm_nes.addGame(wxT("Maniac Mansion (NES)")),
+ addTool(extract_mm_nes);
+
+ // extract_sword2
+ Tool extract_parallaction(wxT("extract_parallaction"), wxT("*.*"));
+ extract_parallaction.addGame(wxT("Parallaction")),
+ addTool(extract_parallaction);
+
+ // extract_scumm_mac
+ Tool extract_scumm_mac(wxT("extract_scumm_mac"));
+ // Required for alot of games, but as ScummVM 0.6 + can read
+ // these files natively, it can remain an advanced option
+ addTool(extract_scumm_mac);
+
+ // extract_zak_c64
+ Tool extract_zak_c64(wxT("extract_zak_c64"), wxT(".d64"));
+ extract_zak_c64.addGame(wxT("Bud Tucker in Double Trouble")),
+ addTool(extract_zak_c64);
}
void Tools::addTool(const Tool& tool) {
tools[tool._name] = tool;
}
-wxArrayString Tools::getToolList() {
+wxArrayString Tools::getToolList(ToolType tt) const {
wxArrayString l;
for(std::map<wxString, Tool>::const_iterator iter = tools.begin(); iter != tools.end(); ++iter)
- l.Add(iter->first);
+ if(tt == TOOLTYPE_ALL || iter->second._type == tt)
+ l.Add(iter->first);
+ l.Sort();
+ std::unique(l.begin(), l.end());
return l;
}
-const Tool &Tools::operator[](const wxString& name) {
+wxArrayString Tools::getGameList(ToolType tt) const {
+ wxArrayString l;
+ for(std::map<wxString, Tool>::const_iterator iter = tools.begin(); iter != tools.end(); ++iter)
+ if(tt == TOOLTYPE_ALL || iter->second._type == tt)
+ for(wxArrayString::const_iterator citer = iter->second._games.begin(); citer != iter->second._games.end(); ++citer)
+ l.Add(*citer);
+ l.Sort();
+ std::unique(l.begin(), l.end());
+ return l;
+}
+
+const Tool &Tools::operator[](const wxString& name) const {
std::map<wxString, Tool>::const_iterator iter = tools.find(name);
wxASSERT_MSG(iter != tools.end(), wxT("All tools should be added, never try to access a tool that does not exist."));
@@ -70,15 +200,21 @@
// The Tool class
Tool::Tool() {
- // should never be called
- // required for std::map template to work
-
// Seems std is allowed to create dummy objects in maps.
//wxLogError(wxT("Created empty tool, should never happened."));
}
Tool::Tool(wxString name, wxString input_extensions) {
_name = name;
+
+ if(name.Find(wxT("extract")) != wxNOT_FOUND)
+ _type = TOOLTYPE_EXTRACTION;
+ else if(name.Find(wxT("compress")) != wxNOT_FOUND)
+ _type = TOOLTYPE_COMPRESSION;
+ else {
+ wxLogError(wxT("Tools with unknown type shouldn't exist."));
+ _type = TOOLTYPE_UNKNOWN;
+ }
// Sensible defaults
_supportedFormats = AUDIO_ALL;
@@ -88,6 +224,10 @@
_inputs.push_back(input);
}
+void Tool::addGame(const wxString &game_name) {
+ _games.Add(game_name);
+}
+
bool Tool::supportsAudioFormat(AudioFormat format) {
return (_supportedFormats & format) == format;
}
Modified: tools/branches/gsoc2009-gui/gui/tools.h
===================================================================
--- tools/branches/gsoc2009-gui/gui/tools.h 2009-06-22 12:03:58 UTC (rev 41766)
+++ tools/branches/gsoc2009-gui/gui/tools.h 2009-06-22 12:47:08 UTC (rev 41767)
@@ -37,7 +37,16 @@
AUDIO_ALL = AUDIO_VORBIS | AUDIO_FLAC | AUDIO_MP3
};
+// Different types of tools, used to differentiate them when
+// fetching lists of games & tools
+enum ToolType {
+ TOOLTYPE_COMPRESSION,
+ TOOLTYPE_EXTRACTION,
+ TOOLTYPE_UNKNOWN,
+ TOOLTYPE_ALL,
+};
+
// Describes a possible input to the tool (since some take two seperate files,
// some a dir and some a single file
struct ToolInput {
@@ -51,6 +60,8 @@
Tool();
Tool(wxString name, wxString input_extensions = wxT("*.*"));
+ void addGame(const wxString &game_name);
+
// Helpfer functions to get info about the tool
bool supportsAudioFormat(AudioFormat format);
bool pickFiles();
@@ -59,9 +70,11 @@
wxString _name;
+ ToolType _type;
AudioFormat _supportedFormats;
typedef std::vector<ToolInput> ToolInputs;
ToolInputs _inputs;
+ wxArrayString _games;
};
// Collection of all tools
@@ -69,11 +82,13 @@
public:
Tools();
- const Tool &operator[](const wxString &name);
+ const Tool &operator[](const wxString &name) const;
- // Returns all tool names in a list
+ // Returns all tool/game names in a list
// conveinent for creating the choose tool page
- wxArrayString getToolList();
+ // List will be sorted and unique
+ wxArrayString getToolList(ToolType tt) const;
+ wxArrayString getGameList(ToolType tt) const;
protected:
void addTool(const Tool &tool);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list