[mythtv] MythGame bug
David Härdeman
david at 2gen.com
Mon Mar 14 23:49:54 UTC 2005
On Sun, Mar 13, 2005 at 06:58:41PM -0800, Joe Votour wrote:
>I knew that I forgot to post something to the list
>after 0.17 came out...
>
>Actually, if "system" isn't part of the categories for
>me, then MythGame crashes.
>
>Also, if you don't put "date" in the categories, then
>you'll see a date value of "0" for every game.
>
>Perhaps if I get some time, I'll take a look at it,
>but no guarantees.
>
>-- Joe
Attached is a patch which fixes this for me. It ends up having to touch
quite a lot of files, and the fix is more of a bandaid (as the proper
fix IMHO would be to remove all the instances of
"setting-parameters-via-parent" stuff from mythgame, but that is a much
larger change).
Since a "proper" fix will be much more upsetting, I suggest that this
one is applied to CVS after it gets some testing.
Joe, can you test if it fixes the problems you're seeing?
Regards,
David
patch diffstats:
atarihandler.cpp | 5 ++++
atarihandler.h | 1
atarirominfo.h | 11 ++++++++-
gamehandler.cpp | 25 +++++++++++++++++++++
gamehandler.h | 3 ++
gametree.cpp | 60 ++++++++++++++++++++++++++++++++--------------------
mamehandler.cpp | 5 ++++
mamehandler.h | 1
neshandler.cpp | 5 ++++
neshandler.h | 1
nesrominfo.h | 9 +++++++
odyssey2handler.cpp | 5 ++++
odyssey2handler.h | 1
odyssey2rominfo.h | 9 +++++++
pchandler.cpp | 5 ++++
pchandler.h | 1
sneshandler.cpp | 5 ++++
sneshandler.h | 1
18 files changed, 129 insertions(+), 24 deletions(-)
-------------- next part --------------
? attic
? mythgame-nosystem-v0.patch
? old
? test.patch
Index: atarihandler.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythgame/mythgame/atarihandler.cpp,v
retrieving revision 1.2
diff -u -u -r1.2 atarihandler.cpp
--- atarihandler.cpp 24 Feb 2005 21:21:37 -0000 1.2
+++ atarihandler.cpp 14 Mar 2005 23:41:57 -0000
@@ -117,6 +117,11 @@
return new AtariRomInfo(*parent);
}
+RomInfo* AtariHandler::create_rominfo()
+{
+ return new AtariRomInfo();
+}
+
bool AtariHandler::IsValidRom(QString Path)
{
// Anything better out there?
Index: atarihandler.h
===================================================================
RCS file: /var/lib/mythcvs/mythgame/mythgame/atarihandler.h,v
retrieving revision 1.1
diff -u -u -r1.1 atarihandler.h
--- atarihandler.h 27 May 2004 01:43:25 -0000 1.1
+++ atarihandler.h 14 Mar 2005 23:41:57 -0000
@@ -23,6 +23,7 @@
void edit_system_settings(RomInfo* romdata);
void processGames();
RomInfo* create_rominfo(RomInfo* parent);
+ RomInfo* create_rominfo();
static AtariHandler* getHandler();
Index: atarirominfo.h
===================================================================
RCS file: /var/lib/mythcvs/mythgame/mythgame/atarirominfo.h,v
retrieving revision 1.1
diff -u -u -r1.1 atarirominfo.h
--- atarirominfo.h 27 May 2004 01:43:25 -0000 1.1
+++ atarirominfo.h 14 Mar 2005 23:41:57 -0000
@@ -7,7 +7,16 @@
class AtariRomInfo : public RomInfo
{
public:
- AtariRomInfo(const RomInfo &lhs) :
+ AtariRomInfo(QString lromname = "",
+ QString lsystem = "",
+ QString lgamename ="",
+ QString lgenre = "",
+ int lyear = 0,
+ bool limage_searched = false) :
+ RomInfo(lromname, lsystem, lgamename, lgenre, lyear,
+ limage_searched)
+ {}
+ AtariRomInfo(const RomInfo &lhs) :
RomInfo(lhs) {}
virtual ~AtariRomInfo() {}
Index: gamehandler.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythgame/mythgame/gamehandler.cpp,v
retrieving revision 1.12
diff -u -u -r1.12 gamehandler.cpp
--- gamehandler.cpp 27 May 2004 01:43:25 -0000 1.12
+++ gamehandler.cpp 14 Mar 2005 23:41:57 -0000
@@ -82,6 +82,23 @@
return handler;
}
+GameHandler* GameHandler::GetHandler(QString sysname)
+{
+ if (!sysname || sysname.isEmpty())
+ return NULL;
+ checkHandlers();
+ GameHandler *handler = handlers->first();
+ while(handler)
+ {
+ if(sysname == handler->Systemname())
+ {
+ return handler;
+ }
+ handler = handlers->next();
+ }
+ return handler;
+}
+
void GameHandler::Launchgame(RomInfo *romdata)
{
GameHandler *handler;
@@ -111,6 +128,14 @@
return NULL;
}
+RomInfo* GameHandler::CreateRomInfo(QString sysname)
+{
+ GameHandler *handler;
+ if((handler = GetHandler(sysname)))
+ return handler->create_rominfo();
+ return NULL;
+}
+
void GameHandler::registerHandler(GameHandler *handler)
{
handlers->append(handler);
Index: gamehandler.h
===================================================================
RCS file: /var/lib/mythcvs/mythgame/mythgame/gamehandler.h,v
retrieving revision 1.9
diff -u -u -r1.9 gamehandler.h
--- gamehandler.h 24 Feb 2005 21:21:37 -0000 1.9
+++ gamehandler.h 14 Mar 2005 23:41:57 -0000
@@ -25,16 +25,19 @@
static void EditSettings(RomInfo *romdata);
static void EditSystemSettings(RomInfo *romdata);
static RomInfo* CreateRomInfo(RomInfo* parent);
+ static RomInfo* CreateRomInfo(QString sysname);
virtual void start_game(RomInfo *romdata) = 0;
virtual void edit_settings(RomInfo *romdata) = 0;
virtual void edit_system_settings(RomInfo *romdata) = 0;
virtual void processGames() = 0;
virtual RomInfo* create_rominfo(RomInfo* parent) = 0;
+ virtual RomInfo* create_rominfo() = 0;
QString Systemname() const { return systemname; }
protected:
static GameHandler* GetHandler(RomInfo *rominfo);
+ static GameHandler* GetHandler(QString sysname);
QString systemname;
};
Index: gametree.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythgame/mythgame/gametree.cpp,v
retrieving revision 1.9
diff -u -u -r1.9 gametree.cpp
--- gametree.cpp 24 Feb 2005 21:21:37 -0000 1.9
+++ gametree.cpp 14 Mar 2005 23:41:57 -0000
@@ -137,30 +137,43 @@
{
game_shot->SetImage(imagename);
}
+ game_title->SetText(curitem->rominfo->Gamename());
+ game_system->SetText(curitem->rominfo->System());
+ int year = curitem->rominfo->Year();
+ if (year != 0)
+ game_year->SetText(QString::number(year));
+ game_genre->SetText(curitem->rominfo->Genre());
+ if (curitem->rominfo->Favorite())
+ game_favorite->SetText("Yes");
+ else
+ game_favorite->SetText("No");
+
}
-
- for (QStringList::Iterator field = m_pathlist.begin();
- field != m_pathlist.end(); ++field)
+ else
{
- if (*field == "system")
- game_system->SetText(curitem->rominfo->System());
- else if (*field == "year")
+ for (QStringList::Iterator field = m_pathlist.begin();
+ field != m_pathlist.end(); ++field)
{
- int year = curitem->rominfo->Year();
- if (year == 0)
- game_year->SetText("");
- else
- game_year->SetText(QString::number(year));
- }
- else if (*field == "genre")
- game_genre->SetText(curitem->rominfo->Genre());
- else if (*field == "gamename")
- {
- game_title->SetText(curitem->rominfo->Gamename());
- if (curitem->rominfo->Favorite())
- game_favorite->SetText("Yes");
- else
- game_favorite->SetText("No");
+ if (*field == "system")
+ game_system->SetText(curitem->rominfo->System());
+ else if (*field == "year")
+ {
+ int year = curitem->rominfo->Year();
+ if (year == 0)
+ game_year->SetText("");
+ else
+ game_year->SetText(QString::number(year));
+ }
+ else if (*field == "genre")
+ game_genre->SetText(curitem->rominfo->Genre());
+ else if (*field == "gamename")
+ {
+ game_title->SetText(curitem->rominfo->Gamename());
+ if (curitem->rominfo->Favorite())
+ game_favorite->SetText("Yes");
+ else
+ game_favorite->SetText("No");
+ }
}
}
}
@@ -245,7 +258,7 @@
if (showfavs == "1")
whereClause += " AND favorite=1";
- QString thequery = QString("SELECT DISTINCT %1 FROM gamemetadata "
+ QString thequery = QString("SELECT DISTINCT %1, system FROM gamemetadata "
"WHERE %2 ORDER BY %3;")
.arg(column).arg(whereClause).arg(column);
@@ -272,9 +285,10 @@
continue;
RomInfo* rinfo;
+
if (isleaf)
{
- rinfo = GameHandler::CreateRomInfo(item->rominfo);
+ rinfo = GameHandler::CreateRomInfo(query.value(1).toString());
rinfo->setField(column, current);
rinfo->fillData();
}
Index: mamehandler.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythgame/mythgame/mamehandler.cpp,v
retrieving revision 1.34
diff -u -u -r1.34 mamehandler.cpp
--- mamehandler.cpp 24 Feb 2005 21:21:38 -0000 1.34
+++ mamehandler.cpp 14 Mar 2005 23:41:57 -0000
@@ -1081,6 +1081,11 @@
return new MameRomInfo(*parent);
}
+RomInfo* MameHandler::create_rominfo()
+{
+ return new MameRomInfo();
+}
+
bool MameHandler::LoadCatfile(map<QString, QString>* pCatMap)
{
QString CatFile = gContext->GetSetting("XMameCatFile");
Index: mamehandler.h
===================================================================
RCS file: /var/lib/mythcvs/mythgame/mythgame/mamehandler.h,v
retrieving revision 1.9
diff -u -u -r1.9 mamehandler.h
--- mamehandler.h 13 Mar 2004 08:28:17 -0000 1.9
+++ mamehandler.h 14 Mar 2005 23:41:57 -0000
@@ -26,6 +26,7 @@
void edit_settings(RomInfo *romdata);
void edit_system_settings(RomInfo *romdata);
RomInfo* create_rominfo(RomInfo* parent);
+ RomInfo* create_rominfo();
QString Systemname() { return systemname; }
void processGames();
Index: neshandler.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythgame/mythgame/neshandler.cpp,v
retrieving revision 1.9
diff -u -u -r1.9 neshandler.cpp
--- neshandler.cpp 24 Feb 2005 21:21:39 -0000 1.9
+++ neshandler.cpp 14 Mar 2005 23:41:58 -0000
@@ -116,6 +116,11 @@
return new NesRomInfo(*parent);
}
+RomInfo* NesHandler::create_rominfo()
+{
+ return new NesRomInfo();
+}
+
bool NesHandler::IsNesRom(QString Path)
{
bool NesRom = false;
Index: neshandler.h
===================================================================
RCS file: /var/lib/mythcvs/mythgame/mythgame/neshandler.h,v
retrieving revision 1.4
diff -u -u -r1.4 neshandler.h
--- neshandler.h 29 Jul 2003 02:02:40 -0000 1.4
+++ neshandler.h 14 Mar 2005 23:41:58 -0000
@@ -23,6 +23,7 @@
void edit_system_settings(RomInfo* romdata);
void processGames();
RomInfo* create_rominfo(RomInfo* parent);
+ RomInfo* create_rominfo();
static NesHandler* getHandler();
static const char* Magic;
Index: nesrominfo.h
===================================================================
RCS file: /var/lib/mythcvs/mythgame/mythgame/nesrominfo.h,v
retrieving revision 1.1
diff -u -u -r1.1 nesrominfo.h
--- nesrominfo.h 10 Feb 2003 15:53:00 -0000 1.1
+++ nesrominfo.h 14 Mar 2005 23:41:58 -0000
@@ -7,6 +7,15 @@
class NesRomInfo : public RomInfo
{
public:
+ NesRomInfo(QString lromname = "",
+ QString lsystem = "",
+ QString lgamename ="",
+ QString lgenre = "",
+ int lyear = 0,
+ bool limage_searched = false) :
+ RomInfo(lromname, lsystem, lgamename, lgenre, lyear,
+ limage_searched)
+ {}
NesRomInfo(const RomInfo &lhs) :
RomInfo(lhs) {}
virtual ~NesRomInfo() {}
Index: odyssey2handler.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythgame/mythgame/odyssey2handler.cpp,v
retrieving revision 1.2
diff -u -u -r1.2 odyssey2handler.cpp
--- odyssey2handler.cpp 24 Feb 2005 21:21:39 -0000 1.2
+++ odyssey2handler.cpp 14 Mar 2005 23:41:58 -0000
@@ -116,6 +116,11 @@
return new Odyssey2RomInfo(*parent);
}
+RomInfo* Odyssey2Handler::create_rominfo()
+{
+ return new Odyssey2RomInfo();
+}
+
bool Odyssey2Handler::IsValidRom(QString Path)
{
// Anything better out there?
Index: odyssey2handler.h
===================================================================
RCS file: /var/lib/mythcvs/mythgame/mythgame/odyssey2handler.h,v
retrieving revision 1.1
diff -u -u -r1.1 odyssey2handler.h
--- odyssey2handler.h 27 May 2004 01:43:26 -0000 1.1
+++ odyssey2handler.h 14 Mar 2005 23:41:58 -0000
@@ -23,6 +23,7 @@
void edit_system_settings(RomInfo* romdata);
void processGames();
RomInfo* create_rominfo(RomInfo* parent);
+ RomInfo* create_rominfo();
static Odyssey2Handler* getHandler();
Index: odyssey2rominfo.h
===================================================================
RCS file: /var/lib/mythcvs/mythgame/mythgame/odyssey2rominfo.h,v
retrieving revision 1.1
diff -u -u -r1.1 odyssey2rominfo.h
--- odyssey2rominfo.h 27 May 2004 01:43:26 -0000 1.1
+++ odyssey2rominfo.h 14 Mar 2005 23:41:58 -0000
@@ -7,6 +7,15 @@
class Odyssey2RomInfo : public RomInfo
{
public:
+ Odyssey2RomInfo(QString lromname = "",
+ QString lsystem = "",
+ QString lgamename ="",
+ QString lgenre = "",
+ int lyear = 0,
+ bool limage_searched = false) :
+ RomInfo(lromname, lsystem, lgamename, lgenre, lyear,
+ limage_searched)
+ {}
Odyssey2RomInfo(const RomInfo &lhs) :
RomInfo(lhs) {}
virtual ~Odyssey2RomInfo() {}
Index: pchandler.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythgame/mythgame/pchandler.cpp,v
retrieving revision 1.4
diff -u -u -r1.4 pchandler.cpp
--- pchandler.cpp 24 Feb 2005 21:21:39 -0000 1.4
+++ pchandler.cpp 14 Mar 2005 23:41:58 -0000
@@ -136,5 +136,10 @@
return new PCRomInfo(*parent);
}
+PCRomInfo* PCHandler::create_rominfo()
+{
+ return new PCRomInfo();
+}
+
PCHandler* PCHandler::pInstance = 0;
Index: pchandler.h
===================================================================
RCS file: /var/lib/mythcvs/mythgame/mythgame/pchandler.h,v
retrieving revision 1.3
diff -u -u -r1.3 pchandler.h
--- pchandler.h 29 Jul 2003 02:02:40 -0000 1.3
+++ pchandler.h 14 Mar 2005 23:41:58 -0000
@@ -20,6 +20,7 @@
void edit_settings(RomInfo *romdata);
void edit_system_settings(RomInfo *romdata);
PCRomInfo* create_rominfo(RomInfo* parent);
+ PCRomInfo* create_rominfo();
void processGames();
static PCHandler* getHandler(void);
Index: sneshandler.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythgame/mythgame/sneshandler.cpp,v
retrieving revision 1.9
diff -u -u -r1.9 sneshandler.cpp
--- sneshandler.cpp 24 Feb 2005 21:21:39 -0000 1.9
+++ sneshandler.cpp 14 Mar 2005 23:41:58 -0000
@@ -488,6 +488,11 @@
return new SnesRomInfo(*parent);
}
+RomInfo* SnesHandler::create_rominfo()
+{
+ return new SnesRomInfo();
+}
+
bool SnesHandler::VerifyZipRomHeader(unzFile zf, unsigned int offset, unsigned int &bytesRead, RomHeader* Header)
{
char buffer[4];
Index: sneshandler.h
===================================================================
RCS file: /var/lib/mythcvs/mythgame/mythgame/sneshandler.h,v
retrieving revision 1.3
diff -u -u -r1.3 sneshandler.h
--- sneshandler.h 29 Jul 2003 02:02:40 -0000 1.3
+++ sneshandler.h 14 Mar 2005 23:41:58 -0000
@@ -39,6 +39,7 @@
void edit_settings(RomInfo *romdata);
void edit_system_settings(RomInfo *romdata);
RomInfo* create_rominfo(RomInfo* parent);
+ RomInfo* create_rominfo();
void processGames();
void processGames(bool);
More information about the mythtv-dev
mailing list