Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also .

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also .
base repository: scummvm/scummvm
Choose a Base Repository
scummvm/scummvm
0xf1sh/scummvm
AlbanBedel/scummvm
Alphard-o/scummvm
AndywinXp/scummvm
BLooperZ/scummvm
BenCastricum/scummvm
CatalystG/scummvm
CeRiAl/scummvm
Coworker/scummvm
Cpasjuste/scummvm
Cruel/scummvm
Deledrius/scummvm
DrItanium/scummvm
DrMcCoy/scummvm
Drenn1/scummvm
Fyre91/scummvm
GNUtoo/scummvm
Henne/scummvm
Joefish/scummvm
JoshTheAggie/scummvm
LubomirR/scummvm
Lybr4/scummvm
MaddTheSane/scummvm
Marisa-Chan/scummvm
MestreLion/scummvm
MrHuu/scummvm-3ds
Nitrus/scummvm
OmerMor/scummvm
Prilkop/scummvm-pink
PyrokinesisStudio/scummvm
RichieSams/scummvm
Risca/scummvm
ShaunOfTheLive/scummvm
SimSaw/scummvm
St0rmcrow/scummvm
Strangerke/scummvm
SupSuper/scummvm
Tea23/scummvm
Templier/scummvm
Termimad/scummvm
Tkachov/scummvm
TomFrost/scummvm
VonBluebaugh/scummvm
WayneRSH/scummvm
YakBizzarro/scummvm
ZsKokos/scummvm
adventuregamestudio/scummvm
ajax16384/scummvm
albrechtf/scummvm
alcherk/scummvm
alexbevi/scummvm
angjerden/scummvm-opensky
anguslees/scummvm
antoniou79/scummvm
athrxx/scummvm
bSr43/scummvm
beholdnec/scummvm-funhouse
berenm/scummvm
bgK/scummvm
bluddy/scummvm
bluegr/scummvm
byunsangho/scummvm
chkr-private/scummvm
chrilith/scummvm
chrisws/scummvm
clone2727/scummvm
craigsc/scummvm-rg350
crazyp/scummvm
criezy/scummvm
danzat/scummvm
dhewg/scummvm
digitall/scummvm
dividedmind/scummvm
djwillis/scummvm
dmgamm/scummvm
dreammaster/scummvm
dyllad/scummvm
edheldil/scummvm
enginmanap/scummvm
eriktorbjorn/scummvm
fivearrows/scummvm
fuzzie/scummvm
gbraad/scummvm
geunyul/scummvm
gitter-badger/scummvm
giucam/scummvm
goldmojo/scummvm-rg350
goops17/scummvm
grayfoxier/scummvm
hchen1014/scummvm
heather162/scummvm
hooby3dfx/scummvm
hoteacristi/scummvm
idimiter/scummvm
infernuslord/scummvm
inisider/scummvm
jakimushka/scummvm
jammm/scummvm
jasonschroeder/scummvm
javisar/scummvm
jbanes/scummvm
jcwilk/scummvm
jenshnielsen/scummvm
jhhoward/scummvm
jiskattema/scummvm
jmglogow/scummvm
jnourry/scummvm
johndoe123/scummvm
johndrinkwater/scummvm-steamlink
juj/emscripten-scummvm
jvprat/scummvm
jweinberg/scummvm
kelmer44/scummvm
khbecker/scummvm
kintera/scummvm
klusark/scummvm
kpeatt/emscripten-scummvm
krawler602/scummvm
libretro/scummvm
lordhoto/scummvm
lukecharman/scummvm
madmoose/scummvm
mauimauer/scummvm
mborjesson/scummvm
mcb30/scummvm
mcgamez88/scummvm
mcnicholls/scummvm
megaboy/scummvm
michailBs/scummvm
midstream/scummvm
miguelgonz/scummvm
mikeconley/emscripten-scummvm
mikicompany/scummvm
mokerjoke/scummvm
monnerat/scummvm
monocodus-demonstrations/scummvm
murgo/scummvm
mynameisfashanu/scummvm
nakioman/scummvm
nexapps/scummvm
nikitin23/scummvm
norbertbajko/scummvm
nukeykt/scummvm
onlyjob/scummvm
peres/scummvm
phoenixtail26/scummvm
qwzybug/scummvm
rasky/scummvm
rayzer86/scummvm
remmythical/emscripten-scummvm
ress/scummvm
rkmarvin/scummvm
robertmegone/scummvm
rofl0r/scummvm
rolph-recto/scummvm
roman5566/scummvm
rsn8887/scummvm
rundfunk47/scummvm
sact/scummvm
salty-horse/scummvm
sathieu/scummvm
saucjedi/scummvm
scott-t/scummvm
scummvm-director/scummvm
seriesParallel/scummvm
sev-/scummvm
singron/scummvm
sirlemonhead/scummvm
skristiansson/scummvm
somaen/scummvm
ssilverm/scummvm
stevenhoefel/scummvm
superg/scummvm
swkim01/scummvm-kor
tafuri/scummvm
tcarey/scummvm-1
timofonic/scummvm
tiqpit/scummvm
tobiatesan/scummvm
tobigun/scummvm
tommimi/scummvm
tsoliman/scummvm
ttcremers/scummvm
upthorn/scummvm
vanfanel/scummvm
vcosta/scummvm
vinterstum/scummvm
vladborovtsov/scummvm
vyadh/scummvm
weakdancer/scummvm
whiterandrek/scummvm
widar/scummvm
wjp/scummvm
xesf/scummvm-asylum
yaz0r/scummvm
yinsimei/scummvm
zach-morris/scummvm
zekizeki2010/scummvm
zeldin/scummvm
Nothing to show
base: a23216fbfcbe
head repository: scummvm/scummvm
Choose a Head Repository
scummvm/scummvm
0xf1sh/scummvm
AlbanBedel/scummvm
Alphard-o/scummvm
AndywinXp/scummvm
BLooperZ/scummvm
BenCastricum/scummvm
CatalystG/scummvm
CeRiAl/scummvm
Coworker/scummvm
Cpasjuste/scummvm
Cruel/scummvm
Deledrius/scummvm
DrItanium/scummvm
DrMcCoy/scummvm
Drenn1/scummvm
Fyre91/scummvm
GNUtoo/scummvm
Henne/scummvm
Joefish/scummvm
JoshTheAggie/scummvm
LubomirR/scummvm
Lybr4/scummvm
MaddTheSane/scummvm
Marisa-Chan/scummvm
MestreLion/scummvm
MrHuu/scummvm-3ds
Nitrus/scummvm
OmerMor/scummvm
Prilkop/scummvm-pink
PyrokinesisStudio/scummvm
RichieSams/scummvm
Risca/scummvm
ShaunOfTheLive/scummvm
SimSaw/scummvm
St0rmcrow/scummvm
Strangerke/scummvm
SupSuper/scummvm
Tea23/scummvm
Templier/scummvm
Termimad/scummvm
Tkachov/scummvm
TomFrost/scummvm
VonBluebaugh/scummvm
WayneRSH/scummvm
YakBizzarro/scummvm
ZsKokos/scummvm
adventuregamestudio/scummvm
ajax16384/scummvm
albrechtf/scummvm
alcherk/scummvm
alexbevi/scummvm
angjerden/scummvm-opensky
anguslees/scummvm
antoniou79/scummvm
athrxx/scummvm
bSr43/scummvm
beholdnec/scummvm-funhouse
berenm/scummvm
bgK/scummvm
bluddy/scummvm
bluegr/scummvm
byunsangho/scummvm
chkr-private/scummvm
chrilith/scummvm
chrisws/scummvm
clone2727/scummvm
craigsc/scummvm-rg350
crazyp/scummvm
criezy/scummvm
danzat/scummvm
dhewg/scummvm
digitall/scummvm
dividedmind/scummvm
djwillis/scummvm
dmgamm/scummvm
dreammaster/scummvm
dyllad/scummvm
edheldil/scummvm
enginmanap/scummvm
eriktorbjorn/scummvm
fivearrows/scummvm
fuzzie/scummvm
gbraad/scummvm
geunyul/scummvm
gitter-badger/scummvm
giucam/scummvm
goldmojo/scummvm-rg350
goops17/scummvm
grayfoxier/scummvm
hchen1014/scummvm
heather162/scummvm
hooby3dfx/scummvm
hoteacristi/scummvm
idimiter/scummvm
infernuslord/scummvm
inisider/scummvm
jakimushka/scummvm
jammm/scummvm
jasonschroeder/scummvm
javisar/scummvm
jbanes/scummvm
jcwilk/scummvm
jenshnielsen/scummvm
jhhoward/scummvm
jiskattema/scummvm
jmglogow/scummvm
jnourry/scummvm
johndoe123/scummvm
johndrinkwater/scummvm-steamlink
juj/emscripten-scummvm
jvprat/scummvm
jweinberg/scummvm
kelmer44/scummvm
khbecker/scummvm
kintera/scummvm
klusark/scummvm
kpeatt/emscripten-scummvm
krawler602/scummvm
libretro/scummvm
lordhoto/scummvm
lukecharman/scummvm
madmoose/scummvm
mauimauer/scummvm
mborjesson/scummvm
mcb30/scummvm
mcgamez88/scummvm
mcnicholls/scummvm
megaboy/scummvm
michailBs/scummvm
midstream/scummvm
miguelgonz/scummvm
mikeconley/emscripten-scummvm
mikicompany/scummvm
mokerjoke/scummvm
monnerat/scummvm
monocodus-demonstrations/scummvm
murgo/scummvm
mynameisfashanu/scummvm
nakioman/scummvm
nexapps/scummvm
nikitin23/scummvm
norbertbajko/scummvm
nukeykt/scummvm
onlyjob/scummvm
peres/scummvm
phoenixtail26/scummvm
qwzybug/scummvm
rasky/scummvm
rayzer86/scummvm
remmythical/emscripten-scummvm
ress/scummvm
rkmarvin/scummvm
robertmegone/scummvm
rofl0r/scummvm
rolph-recto/scummvm
roman5566/scummvm
rsn8887/scummvm
rundfunk47/scummvm
sact/scummvm
salty-horse/scummvm
sathieu/scummvm
saucjedi/scummvm
scott-t/scummvm
scummvm-director/scummvm
seriesParallel/scummvm
sev-/scummvm
singron/scummvm
sirlemonhead/scummvm
skristiansson/scummvm
somaen/scummvm
ssilverm/scummvm
stevenhoefel/scummvm
superg/scummvm
swkim01/scummvm-kor
tafuri/scummvm
tcarey/scummvm-1
timofonic/scummvm
tiqpit/scummvm
tobiatesan/scummvm
tobigun/scummvm
tommimi/scummvm
tsoliman/scummvm
ttcremers/scummvm
upthorn/scummvm
vanfanel/scummvm
vcosta/scummvm
vinterstum/scummvm
vladborovtsov/scummvm
vyadh/scummvm
weakdancer/scummvm
whiterandrek/scummvm
widar/scummvm
wjp/scummvm
xesf/scummvm-asylum
yaz0r/scummvm
yinsimei/scummvm
zach-morris/scummvm
zekizeki2010/scummvm
zeldin/scummvm
Nothing to show
compare: 8cb9eebd8a8f
  • 10 commits
  • 23 files changed
  • 3 commit comments
  • 2 contributors
Commits on Apr 29, 2018
This has also been implemented for the SDL2 and macOS backends.
Thanks to the great help of @criezy, here's my implementation of an GUI
dialog that appears when an unknown game is detected.

Features:
 - Allows copying the data collected by game detector to the clipboard
 - Allows opening the bug tracker and pre-filling the form fiels

This closes https://bugs.scummvm.org/ticket/10435.
This should fix issues when the text to display in the dialog is too
big to fit on the screen.
…ize changes

Previously the dialog was not resized and was just recentered on the screen.
Now it is properly resized as well.
@@ -124,6 +124,10 @@ Common::String OSystem_MacOSX::getTextFromClipboard() {
return getTextFromClipboardMacOSX();
}

bool OSystem_MacOSX::setTextInClipboard(const Common::String &text) {
return setTextInClipboardMacOSX(text);
}

bool OSystem_MacOSX::openUrl(const Common::String &url) {
CFURLRef urlRef = CFURLCreateWithBytes (NULL, (UInt8*)url.c_str(), url.size(), kCFStringEncodingASCII, NULL);
OSStatus err = LSOpenCFURLRef(urlRef, NULL);
@@ -35,6 +35,7 @@ class OSystem_MacOSX : public OSystem_POSIX {

virtual bool hasTextInClipboard();
virtual Common::String getTextFromClipboard();
virtual bool setTextInClipboard(const Common::String &text);

virtual bool openUrl(const Common::String &url);

@@ -27,6 +27,7 @@

bool hasTextInClipboardMacOSX();
Common::String getTextFromClipboardMacOSX();
bool setTextInClipboardMacOSX(const Common::String &text);
Common::String getDesktopPathMacOSX();

#endif
@@ -24,11 +24,13 @@
#define FORBIDDEN_SYMBOL_ALLOW_ALL

#include "backends/platform/sdl/macosx/macosx_wrapper.h"
#include "common/translation.h"

#include <AppKit/NSPasteboard.h>
#include <Foundation/NSArray.h>
#include <Foundation/NSPathUtilities.h>
#include <AvailabilityMacros.h>
#include <CoreFoundation/CFString.h>

bool hasTextInClipboardMacOSX() {
return [[NSPasteboard generalPasteboard] availableTypeFromArray:[NSArray arrayWithObject:NSStringPboardType]] != nil;
@@ -40,13 +42,33 @@ bool hasTextInClipboardMacOSX() {
// Note: on OS X 10.6 and above it is recommanded to use NSPasteboardTypeString rather than NSStringPboardType.
// But since we still target older version use NSStringPboardType.
NSPasteboard *pb = [NSPasteboard generalPasteboard];
NSString* str = [pb stringForType:NSStringPboardType];
NSString *str = [pb stringForType:NSStringPboardType];
if (str == nil)
return Common::String();
// If the string cannot be represented using the requested encoding we get a null pointer below.
// This is fine as ScummVM would not know what to do with non-ASCII characters (although maybe
// we should use NSISOLatin1StringEncoding?).
return Common::String([str cStringUsingEncoding:NSASCIIStringEncoding]);

// If translations are supported, use the current TranslationManager charset and otherwise
// use ASCII. If the string cannot be represented using the requested encoding we get a null
// pointer below, which is fine as ScummVM would not know what to do with the string anyway.
#ifdef USE_TRANSLATION
NSString* encStr = [NSString stringWithCString:TransMan.getCurrentCharset().c_str() encoding:NSASCIIStringEncoding];
NSStringEncoding encoding = CFStringConvertEncodingToNSStringEncoding(CFStringConvertIANACharSetNameToEncoding((CFStringRef)encStr));
#else
NSStringEncoding encoding = NSISOLatin1StringEncoding;
#endif
return Common::String([str cStringUsingEncoding:encoding]);
}

bool setTextInClipboardMacOSX(const Common::String &text) {
NSPasteboard *pb = [NSPasteboard generalPasteboard];
[pb declareTypes:[NSArray arrayWithObject:NSStringPboardType] owner:nil];

#ifdef USE_TRANSLATION
NSString* encStr = [NSString stringWithCString:TransMan.getCurrentCharset().c_str() encoding:NSASCIIStringEncoding];
NSStringEncoding encoding = CFStringConvertEncodingToNSStringEncoding(CFStringConvertIANACharSetNameToEncoding((CFStringRef)encStr));
#else
NSStringEncoding encoding = NSISOLatin1StringEncoding;
#endif
return [pb setString:[NSString stringWithCString:text.c_str() encoding:encoding] forType:NSStringPboardType];
}

Common::String getDesktopPathMacOSX() {
@@ -33,6 +33,7 @@
#include "gui/EventRecorder.h"
#include "common/taskbar.h"
#include "common/textconsole.h"
#include "common/translation.h"

#include "backends/saves/default/default-saves.h"

@@ -502,17 +503,46 @@ Common::String OSystem_SDL::getTextFromClipboard() {

#if SDL_VERSION_ATLEAST(2, 0, 0)
char *text = SDL_GetClipboardText();
// The string returned by SDL is in UTF-8. Convert to the
// current TranslationManager encoding or ISO-8859-1.
#ifdef USE_TRANSLATION
char *conv_text = SDL_iconv_string(TransMan.getCurrentCharset().c_str(), "UTF-8", text, SDL_strlen(text) + 1);
#else
char *conv_text = SDL_iconv_string("ISO-8859-1", "UTF-8", text, SDL_strlen(text) + 1);
#endif
if (conv_text) {
SDL_free(text);
text = conv_text;
}
Common::String strText = text;
SDL_free(text);

// FIXME: The string returned by SDL is in UTF-8, it is not clear
// what encoding should be used for the returned string.
return strText;
#else
return "";
#endif
}

bool OSystem_SDL::setTextInClipboard(const Common::String &text) {
#if SDL_VERSION_ATLEAST(2, 0, 0)
// The encoding we need to use is UTF-8. Assume we currently have the
// current TranslationManager encoding or ISO-8859-1.
#ifdef USE_TRANSLATION
char *utf8_text = SDL_iconv_string("UTF-8", TransMan.getCurrentCharset().c_str(), text.c_str(), text.size() + 1);
#else
char *utf8_text = SDL_iconv_string("UTF-8", "ISO-8859-1", text.c_str(), text.size() + 1);
#endif
if (utf8_text) {
int status = SDL_SetClipboardText(utf8_text);
SDL_free(utf8_text);
return status == 0;
}
return SDL_SetClipboardText(text.c_str()) == 0;
#else
return false;
#endif
}

uint32 OSystem_SDL::getMillis(bool skipRecord) {
uint32 millis = SDL_GetTicks();

@@ -72,6 +72,7 @@ class OSystem_SDL : public ModularBackend {
// Clipboard
virtual bool hasTextInClipboard();
virtual Common::String getTextFromClipboard();
virtual bool setTextInClipboard(const Common::String &text);

virtual void setWindowCaption(const char *caption);
virtual void addSysArchivesToSearchSet(Common::SearchSet &s, int priority = 0);
@@ -514,7 +514,7 @@ GameDescriptor EngineManager::findGameInLoadedPlugins(const Common::String &game
return result;
}

GameList EngineManager::detectGames(const Common::FSList &fslist) const {
GameList EngineManager::detectGames(const Common::FSList &fslist, bool useUnknownGameDialog) const {
GameList candidates;
PluginList plugins;
PluginList::const_iterator iter;
@@ -524,7 +524,7 @@ GameList EngineManager::detectGames(const Common::FSList &fslist) const {
// Iterate over all known games and for each check if it might be
// the game in the presented directory.
for (iter = plugins.begin(); iter != plugins.end(); ++iter) {
candidates.push_back((*iter)->get<MetaEngine>().detectGames(fslist));
candidates.push_back((*iter)->get<MetaEngine>().detectGames(fslist, useUnknownGameDialog));
}
} while (PluginManager::instance().loadNextPlugin());
return candidates;
@@ -59,6 +59,10 @@ class Singleton : NonCopyable {


public:
static bool hasInstance() {
return _singleton != 0;
}

static T& instance() {
// TODO: We aren't thread safe. For now we ignore it since the
// only thing using this singleton template is the config manager,
@@ -324,8 +324,8 @@ class OSystem : Common::NonCopyable {
kFeatureDisplayLogFile,

/**
* The presence of this feature indicates whether the hasTextInClipboard()
* and getTextFromClipboard() calls are supported.
* The presence of this feature indicates whether the hasTextInClipboard(),
* getTextFromClipboard() and setTextInClipboard() calls are supported.
*
* This feature has no associated state.
*/
@@ -1335,6 +1335,17 @@ class OSystem : Common::NonCopyable {
*/
virtual Common::String getTextFromClipboard() { return ""; }

/**
* Set the content of the clipboard to the given string.
*
* The kFeatureClipboardSupport feature flag can be used to
* test whether this call has been implemented by the active
* backend.
*
* @return true if the text was properly set in the clipboard, false otherwise
*/
virtual bool setTextInClipboard(const Common::String &text) { return false; }

/**
* Open the given Url in the default browser (if available on the target
* system).
@@ -332,7 +332,7 @@ class AdlMetaEngine : public AdvancedMetaEngine {
int getMaximumSaveSlot() const { return 'O' - 'A'; }
SaveStateList listSaves(const char *target) const;
void removeSaveState(const char *target, int slot) const;
virtual ADGameDescList detectGame(const Common::FSNode &parent, const FileMap &allFiles, Common::Language language, Common::Platform platform, const Common::String &extra) const;
virtual ADGameDescList detectGame(const Common::FSNode &parent, const FileMap &allFiles, Common::Language language, Common::Platform platform, const Common::String &extra, bool useUnknownGameDialog = false) const;

bool addFileProps(const FileMap &allFiles, Common::String fname, ADFilePropertiesMap &filePropsMap) const;

@@ -511,9 +511,9 @@ bool AdlMetaEngine::addFileProps(const FileMap &allFiles, Common::String fname,
}

// Based on AdvancedMetaEngine::detectGame
ADGameDescList AdlMetaEngine::detectGame(const Common::FSNode &parent, const FileMap &allFiles, Common::Language language, Common::Platform platform, const Common::String &extra) const {
ADGameDescList AdlMetaEngine::detectGame(const Common::FSNode &parent, const FileMap &allFiles, Common::Language language, Common::Platform platform, const Common::String &extra, bool useUnknownGameDialog) const {
// We run the file-based detector first and then add to the returned list
ADGameDescList matched = AdvancedMetaEngine::detectGame(parent, allFiles, language, platform, extra);
ADGameDescList matched = AdvancedMetaEngine::detectGame(parent, allFiles, language, platform, extra, useUnknownGameDialog);

debug(3, "Starting disk image detection in dir '%s'", parent.getPath().c_str());

@@ -605,7 +605,7 @@ ADGameDescList AdlMetaEngine::detectGame(const Common::FSNode &parent, const Fil
// TODO: This could be improved to handle matched and unknown games together in a single directory
if (matched.empty()) {
if (!filesProps.empty() && gotAnyMatchesWithAllFiles) {
reportUnknown(parent, filesProps, matchedGameIds);
reportUnknown(parent, filesProps, matchedGameIds, useUnknownGameDialog);
}
}

@@ -30,6 +30,8 @@
#include "common/textconsole.h"
#include "common/translation.h"
#include "gui/EventRecorder.h"
#include "gui/gui-manager.h"
#include "engines/unknown-game-dialog.h"
#include "engines/advancedDetector.h"
#include "engines/obsolete.h"

@@ -148,7 +150,7 @@ bool cleanupPirated(ADGameDescList &matched) {
}


GameList AdvancedMetaEngine::detectGames(const Common::FSList &fslist) const {
GameList AdvancedMetaEngine::detectGames(const Common::FSList &fslist, bool useUnknownGameDialog) const {
ADGameDescList matches;
GameList detectedGames;
FileMap allFiles;
@@ -160,7 +162,7 @@ GameList AdvancedMetaEngine::detectGames(const Common::FSList &fslist) const {
composeFileHashMap(allFiles, fslist, (_maxScanDepth == 0 ? 1 : _maxScanDepth));

// Run the detector on this
matches = detectGame(fslist.begin()->getParent(), allFiles, Common::UNK_LANG, Common::kPlatformUnknown, "");
matches = detectGame(fslist.begin()->getParent(), allFiles, Common::UNK_LANG, Common::kPlatformUnknown, "", useUnknownGameDialog);

if (matches.empty()) {
// Use fallback detector if there were no matches by other means
@@ -325,37 +327,55 @@ Common::Error AdvancedMetaEngine::createInstance(OSystem *syst, Engine **engine)
return Common::kNoError;
}

void AdvancedMetaEngine::reportUnknown(const Common::FSNode &path, const ADFilePropertiesMap &filesProps, const ADGameIdList &matchedGameIds) const {
Common::String report = Common::String::format(
_("The game in '%s' seems to be an unknown %s engine game "
"variant.\n\nPlease report the following data to the ScummVM "
"team at %s along with the name of the game you tried to add and "
"its version, language, etc.:"),
path.getPath().c_str(), getName(), "https://bugs.scummvm.org/");
void AdvancedMetaEngine::reportUnknown(const Common::FSNode &path, const ADFilePropertiesMap &filesProps, const ADGameIdList &matchedGameIds, bool useUnknownGameDialog) const {
const char *reportCommon = "The game in '%s' seems to be an unknown %s engine game "
"variant.\n\nPlease report the following data to the ScummVM "
"team at %s along with the name of the game you tried to add and "
"its version, language, etc.:";
Common::String report = Common::String::format(reportCommon, path.getPath().c_str(), getName(), "https://bugs.scummvm.org/");
Common::String reportTranslated = Common::String::format(_(reportCommon), path.getPath().c_str(), getName(), "https://bugs.scummvm.org/");
Common::String bugtrackerAffectedEngine = getName();

if (matchedGameIds.size()) {
report += "\n\n";
report += _("Matched game IDs:");
reportTranslated += "\n\n";
report += "Matched game IDs:";
reportTranslated += _("Matched game IDs:");
report += " ";
reportTranslated += " ";

for (ADGameIdList::const_iterator gameId = matchedGameIds.begin(); gameId != matchedGameIds.end(); ++gameId) {
if (gameId != matchedGameIds.begin()) {
report += ", ";
reportTranslated += ", ";
}
report += *gameId;
reportTranslated += *gameId;
}
}

report += "\n\n";
reportTranslated += "\n\n";

report.wordWrap(80);
Common::String reportLog = report;
reportLog.wordWrap(80);

Common::String unknownFiles;
for (ADFilePropertiesMap::const_iterator file = filesProps.begin(); file != filesProps.end(); ++file)
report += Common::String::format(" {\"%s\", 0, \"%s\", %d},\n", file->_key.c_str(), file->_value.md5.c_str(), file->_value.size);
unknownFiles += Common::String::format(" {\"%s\", 0, \"%s\", %d},\n", file->_key.c_str(), file->_value.md5.c_str(), file->_value.size);

report += "\n";
report += unknownFiles;
reportTranslated += unknownFiles;
reportLog += unknownFiles + "\n";

g_system->logMessage(LogMessageType::kInfo, report.c_str());
// Write the original message about the unknown game to the log file
g_system->logMessage(LogMessageType::kInfo, reportLog.c_str());

// Check if the GUI is running, show the UnknownGameDialog and print the translated unknown game information
if (GUI::GuiManager::hasInstance() && g_gui.isActive() && useUnknownGameDialog == true) {
UnknownGameDialog dialog(report, reportTranslated, bugtrackerAffectedEngine);
dialog.runModal();
}
}

void AdvancedMetaEngine::composeFileHashMap(FileMap &allFiles, const Common::FSList &fslist, int depth, const Common::String &parentName) const {
@@ -428,7 +448,7 @@ bool AdvancedMetaEngine::getFileProperties(const Common::FSNode &parent, const F
return true;
}

ADGameDescList AdvancedMetaEngine::detectGame(const Common::FSNode &parent, const FileMap &allFiles, Common::Language language, Common::Platform platform, const Common::String &extra) const {
ADGameDescList AdvancedMetaEngine::detectGame(const Common::FSNode &parent, const FileMap &allFiles, Common::Language language, Common::Platform platform, const Common::String &extra, bool useUnknownGameDialog) const {
ADFilePropertiesMap filesProps;

const ADGameFileDescription *fileDesc;
@@ -553,7 +573,7 @@ ADGameDescList AdvancedMetaEngine::detectGame(const Common::FSNode &parent, cons
// We didn't find a match
if (matched.empty()) {
if (!filesProps.empty() && gotAnyMatchesWithAllFiles) {
reportUnknown(parent, filesProps, matchedGameIds);
reportUnknown(parent, filesProps, matchedGameIds, useUnknownGameDialog);
}

// Filename based fallback
@@ -278,7 +278,7 @@ class AdvancedMetaEngine : public MetaEngine {

virtual GameDescriptor findGame(const char *gameId) const;

virtual GameList detectGames(const Common::FSList &fslist) const;
virtual GameList detectGames(const Common::FSList &fslist, bool useUnknownGameDialog = false) const;

virtual Common::Error createInstance(OSystem *syst, Engine **engine) const;

@@ -313,7 +313,7 @@ class AdvancedMetaEngine : public MetaEngine {
* @param extra restrict results to specified extra string (only if kADFlagUseExtraAsHint is set)
* @return list of ADGameDescription pointers corresponding to matched games
*/
virtual ADGameDescList detectGame(const Common::FSNode &parent, const FileMap &allFiles, Common::Language language, Common::Platform platform, const Common::String &extra) const;
virtual ADGameDescList detectGame(const Common::FSNode &parent, const FileMap &allFiles, Common::Language language, Common::Platform platform, const Common::String &extra, bool useUnknownGameDialog = false) const;

/**
* Iterates over all ADFileBasedFallback records inside fileBasedFallback.
@@ -333,7 +333,7 @@ class AdvancedMetaEngine : public MetaEngine {
* Log and print a report that we found an unknown game variant, together with the file
* names, sizes and MD5 sums.
*/
void reportUnknown(const Common::FSNode &path, const ADFilePropertiesMap &filesProps, const ADGameIdList &matchedGameIds = ADGameIdList()) const;
void reportUnknown(const Common::FSNode &path, const ADFilePropertiesMap &filesProps, const ADGameIdList &matchedGameIds = ADGameIdList(), bool useUnknownGameDialog = false) const;

// TODO
void updateGameDescriptor(GameDescriptor &desc, const ADGameDescription *realDesc) const;
@@ -79,7 +79,7 @@ class MetaEngine : public PluginObject {
* (possibly empty) list of games supported by the engine which it was able
* to detect amongst the given files.
*/
virtual GameList detectGames(const Common::FSList &fslist) const = 0;
virtual GameList detectGames(const Common::FSList &fslist, bool useUnknownGameDialog = false) const = 0;

/**
* Tries to instantiate an engine instance based on the settings of
@@ -269,7 +269,7 @@ class EngineManager : public Common::Singleton<EngineManager> {
public:
GameDescriptor findGameInLoadedPlugins(const Common::String &gameName, const Plugin **plugin = NULL) const;
GameDescriptor findGame(const Common::String &gameName, const Plugin **plugin = NULL) const;
GameList detectGames(const Common::FSList &fslist) const;
GameList detectGames(const Common::FSList &fslist, bool useUnknownGameDialog = false) const;
const PluginList &getPlugins() const;
};

Showing you all comments on commits in this comparison.

@lotharsm

This comment has been minimized.

Copy link
Member Author

lotharsm commented on 4220e14 May 1, 2018

It seems that the gettext parser misses the _(reportCommon) part, since the related string is not available for translation on Weblate...

@criezy

This comment has been minimized.

Copy link
Member

criezy commented on 4220e14 May 1, 2018

Right. The parser does not know the content of reportUnknown. It needs to be marked as a translatable string with const char *reportCommon = _s(“The game in ... etc.:”) previously (using _s() marks the string for translation but does not translate it).

@lotharsm

This comment has been minimized.

Copy link
Member Author

lotharsm commented on 4220e14 May 1, 2018

Thanks, I'll fix this asap.

You can’t perform that action at this time.