Author Topic: MAME Plugin Progress Thread  (Read 74674 times)

totallymaxed

  • LinuxMCE God
  • ****
  • Posts: 4660
  • Smart Home Consulting
    • View Profile
    • Dianemo - at home with technology
Re: MAME Plugin Progress Thread
« Reply #105 on: March 16, 2008, 06:02:34 pm »
Has anyone here got experience with sql2cpp? I am trying to write a metadata bootstrap utility, and i think i'm just doing some things with it very wrong...but..meh...

-Thom


Hi Thom,

I can't help with sql2cpp... but I just wanted to say that what your up to with MAME sounds fantastic... and a mammoth piece of work. I always drop by this thread now and then to see how things are progressing and am always amazed at what your doing!

Its great to see someone doing this kind of development in the community :-)

All the best

Andrew
Andy Herron,
CHT Ltd

For Dianemo/LinuxMCE consulting advice;
@herron on Twitter, totallymaxed+inquiries@gmail.com via email or PM me here.

Get Dianemo-Rpi2 ARM Licenses http://forum.linuxmce.org/index.php?topic=14026.0

Get RaspSqueeze-CEC or Raspbmc-CEC for Dianemo/LinuxMCE: http://wp.me/P4KgIc-5P

Facebook: https://www.facebook.com/pages/Dianemo-Home-Automation/226019387454465

http://www.dianemo.co.uk

tschak909

  • LinuxMCE God
  • ****
  • Posts: 5549
  • DOES work for LinuxMCE.
    • View Profile
Re: MAME Plugin Progress Thread
« Reply #106 on: March 16, 2008, 06:17:15 pm »
My current lmce_game_bootstrap code:

.cpp
Code: [Select]
//
// lmce_game_bootstrap.cpp - basic quick little utility I wrote to bootstrap the game database.
//
// Author: Thom Cherryhomes <thom.cherryhomes@localeconcept.com>
//
//

#include "lmce_game_bootstrap.h"

using namespace std;

bool get_game_list(vector<string> &v_sOutput)
{
                const char * const args[] = {"/usr/local/bin/mame", "-listfull", NULL};
string sOutput, sStdErr, sGameName;

                if (ProcessUtils::GetCommandOutput(args[0], args, sOutput, sStdErr) == 0)
{
vector<string> v_sOutputRows;
StringUtils::Tokenize(sOutput,"\n",v_sOutputRows);
for (unsigned int i=1; i < v_sOutputRows.size(); ++i) // skip over first line :-P
{
sGameName = v_sOutputRows[i].substr(0,8);
sGameName = StringUtils::TrimSpaces(sGameName);
v_sOutput.push_back(sGameName);
}

return true;
}
else
{
return false;
}

}

bool get_metadata_for(string sGameName, map <string,string> &m_sGameData)
{
const char * const args[] = {"/usr/bin/getRomInfo.pl",sGameName.c_str(),NULL};
string sOutput, sStdErr;

if (ProcessUtils::GetCommandOutput(args[0], args, sOutput, sStdErr) == 0)
{
vector<string> v_sOutputRows;
StringUtils::Tokenize(sOutput,"\n",v_sOutputRows);
if (v_sOutputRows[0] == "No Title")
{
return false;
} else
{
m_sGameData["title"] = v_sOutputRows[0];
m_sGameData["year"] = v_sOutputRows[1];
m_sGameData["manufacturer"] = v_sOutputRows[2];
m_sGameData["file"] = v_sOutputRows[3];
m_sGameData["genre"] = v_sOutputRows[4];
return true;
}
} else {
return false;
}
}

bool add_to_database(map<string,string> m_sGameData, class Database_lmce_game *myDatabase)
{

// First, add the file.
string sFilename = m_sGameData["file"] + ".zip";
Row_File *pRow_File = myDatabase->Table_File->AddRow();
pRow_File->FK_GameSystem_set(GAMESYSTEM_MAME_CONST);
pRow_File->Filename_set(sFilename);
myDatabase->Table_File->Commit();

// Then, add the Title Attribute->
Row_Attribute *pRow_Attribute = myDatabase->Table_Attribute->AddRow();
pRow_Attribute->FK_AttributeType_set(ATTRIBUTETYPE_title_CONST);
pRow_Attribute->FK_GameSystem_set(GAMESYSTEM_MAME_CONST);
pRow_Attribute->Name_set(m_sGameData["title"]);
myDatabase->Table_Attribute->Commit();

// Then, add the Title Attribute to the file->
Row_File_Attribute *pRow_File_Attribute = myDatabase->File_Attribute_get()->AddRow();
pRow_File_Attribute->FK_File_set(pRow_File->PK_File_get());
pRow_File_Attribute->FK_Attribute_set(pRow_Attribute->PK_Attribute_get());
myDatabase->Table_File_Attribute->Commit();

// Then, add the Year Attribute->
pRow_Attribute = myDatabase->Table_Attribute->AddRow();
pRow_Attribute->FK_AttributeType_set(ATTRIBUTETYPE_year_CONST);
pRow_Attribute->FK_GameSystem_set(GAMESYSTEM_MAME_CONST);
pRow_Attribute->Name_set(m_sGameData["year"]);
myDatabase->Table_Attribute->Commit();

// Then, add the Year Attribute to the file->
pRow_File_Attribute = myDatabase->Table_File_Attribute->AddRow();
pRow_File_Attribute->FK_File_set(pRow_File->PK_File_get());
pRow_File_Attribute->FK_Attribute_set(pRow_Attribute->PK_Attribute_get());
myDatabase->Table_File_Attribute->Commit();

// Then, add the Manufacturer Attribute->
pRow_Attribute = myDatabase->Table_Attribute->AddRow();
pRow_Attribute->FK_AttributeType_set(ATTRIBUTETYPE_manufacturer_CONST);
pRow_Attribute->FK_GameSystem_set(GAMESYSTEM_MAME_CONST);
pRow_Attribute->Name_set(m_sGameData["manufacturer"]);
myDatabase->Table_Attribute->Commit();

// Then, add the Manufacturer Attribute to the file->
pRow_File_Attribute = myDatabase->Table_File_Attribute->AddRow();
pRow_File_Attribute->FK_File_set(pRow_File->PK_File_get());
pRow_File_Attribute->FK_Attribute_set(pRow_Attribute->PK_Attribute_get());
myDatabase->Table_File_Attribute->Commit();

// Then, add the Genre Attribute->
pRow_Attribute = myDatabase->Table_Attribute->AddRow();
pRow_Attribute->FK_AttributeType_set(ATTRIBUTETYPE_genre_CONST);
pRow_Attribute->FK_GameSystem_set(GAMESYSTEM_MAME_CONST);
pRow_Attribute->Name_set(m_sGameData["genre"]);
myDatabase->Table_Attribute->Commit();

// Then, add the Genre Attribute to the file->
pRow_File_Attribute = myDatabase->Table_File_Attribute->AddRow();
pRow_File_Attribute->FK_File_set(pRow_File->PK_File_get());
pRow_File_Attribute->FK_Attribute_set(pRow_Attribute->PK_Attribute_get());
myDatabase->File_Attribute->Commit();

// delete(pRow_File);
// delete(pRow_Attribute);
// delete(pRow_File_Attribute);

return true;

}

int main(int argc, char* argv[])
{

vector<string> v_sGameList;
map<string,string> m_sGameData;

cout << "lmce_game_bootstrap 0.1" << endl;
cout << endl << endl;

Database_lmce_game *myDatabase;
    myDatabase = new Database_lmce_game(LoggerWrapper::GetInstance());

myDatabase->Connect("localhost","root","","lmce_game",3306);

if (!get_game_list(v_sGameList)) {
cout << "Unable to retrieve game list." << endl;
return 1;
}

// Main Loop
for (unsigned int i=0; i<v_sGameList.size(); ++i)
{
if (!get_metadata_for(v_sGameList[i],m_sGameData))
{
cout << "Unable to get game data for: " << v_sGameList[i] << endl;
}
else
{
if (!add_to_database(m_sGameData,myDatabase))
{
cout << "Unable to add game data for: " << v_sGameList[i] << " to database." << endl;
}
else
{
cout << "Added " << v_sGameList[i] << " to database." << endl;
}
}
}

cout << "Complete." << endl;

}

.h
Code: [Select]
//
// lmce_game_bootstrap.h - basic quick little utility I wrote to bootstrap the game database.
//

#include <string>
#include <map>
#include <vector>
#include <iostream>

#include "lmce_game/Database_lmce_game.h" 
#include "lmce_game/Define_AttributeType.h"
#include "lmce_game/Define_File_Attribute.h"
#include "lmce_game/TableRow.h"
#include "lmce_game/Table_AttributeType.h" 
#include "lmce_game/Table_File_Attribute.h"
#include "lmce_game/Define_Attribute.h"   
#include "lmce_game/Define_File.h"
#include "lmce_game/Define_GameSystem.h"     
#include "lmce_game/Table_Attribute.h" 
#include "lmce_game/Table_File.h"           
#include "lmce_game/Table_GameSystem.h"

#include "PlutoUtils/ProcessUtils.h"
#include "PlutoUtils/StringUtils.h"
#include "PlutoUtils/DBHelper.h"
#include "DCE/Logger.h"

bool get_game_list(vector<string> &v_sOutput);
bool get_metadata_for(string sGameName, map <string,string> &m_sGameData);
bool add_to_database(map<string,string> m_sGameData, class Database_lmce_game *myDatabase);
int main(int argc, char* argv[]);

and I get the following compiler output:
Code: [Select]
Computing dependencies for Main.cpp done
g++ -c -I.. -I../DCE -I/usr/include/mysql -DKDE_LMCE -DDEBUG -DTHREAD_LOG -DLOG_ALL_QUERIES -I/opt/libxine1-pluto/include -I/opt/linphone-1.3.5/include  -Wall -fPIC -ggdb3  Main.cpp -o Main.o
Main.cpp: In function ‘bool add_to_database(std::map<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<const std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, Database_lmce_game*)’:
Main.cpp:68: error: ‘class Database_lmce_game’ has no member named ‘Table_File’
Main.cpp:71: error: ‘class Database_lmce_game’ has no member named ‘Table_File’
Main.cpp:74: error: ‘class Database_lmce_game’ has no member named ‘Table_Attribute’
Main.cpp:78: error: ‘class Database_lmce_game’ has no member named ‘Table_Attribute’
Main.cpp:84: error: ‘class Database_lmce_game’ has no member named ‘Table_File_Attribute’
Main.cpp:87: error: ‘class Database_lmce_game’ has no member named ‘Table_Attribute’
Main.cpp:91: error: ‘class Database_lmce_game’ has no member named ‘Table_Attribute’
Main.cpp:94: error: ‘class Database_lmce_game’ has no member named ‘Table_File_Attribute’
Main.cpp:97: error: ‘class Database_lmce_game’ has no member named ‘Table_File_Attribute’
Main.cpp:100: error: ‘class Database_lmce_game’ has no member named ‘Table_Attribute’
Main.cpp:104: error: ‘class Database_lmce_game’ has no member named ‘Table_Attribute’
Main.cpp:107: error: ‘class Database_lmce_game’ has no member named ‘Table_File_Attribute’
Main.cpp:110: error: ‘class Database_lmce_game’ has no member named ‘Table_File_Attribute’
Main.cpp:113: error: ‘class Database_lmce_game’ has no member named ‘Table_Attribute’
Main.cpp:117: error: ‘class Database_lmce_game’ has no member named ‘Table_Attribute’
Main.cpp:120: error: ‘class Database_lmce_game’ has no member named ‘Table_File_Attribute’
Main.cpp:123: error: ‘class Database_lmce_game’ has no member named ‘File_Attribute’
make: *** [Main.o] Error 1

I am losing my mind..because I SEE THE FREAKIN MEMBERS IN THERE, BUT #@)$#@)$#@)$@#) WTH?!

:(

-Thom

Zaerc

  • Alumni
  • LinuxMCE God
  • *
  • Posts: 2256
  • Department of Redundancy Department.
    • View Profile
Re: MAME Plugin Progress Thread
« Reply #107 on: March 16, 2008, 07:20:47 pm »
Just for the people that might run into this as well (we've already sorted this in the chatroom).

Turned out that the "Table_File", "Table_Attribute" and "Table_File_Attribute" members are all defined as private, the accessor functions "File_get()", "Attribute_get()" and "File_Attribute_get()" had to be used instead.
"Change is inevitable. Progress is optional."
-- Anonymous


tschak909

  • LinuxMCE God
  • ****
  • Posts: 5549
  • DOES work for LinuxMCE.
    • View Profile
Re: MAME Plugin Progress Thread
« Reply #108 on: March 24, 2008, 01:24:51 am »
Okay, a status update...

I finally have the Media Sort/Type/Filter/Genre bits working correctly. It took me four weeks to find the culprit...

Even though you can have your pluto_media information set up correctly telling which attributes to search/sort by, and made sure they are all mapped, the File Browser will not provide a working set of buttons below, or on the Options screen in UI1 UNLESS you modify OrbiterGen to state that this media type is searchable, the offending line is line 1596 of OrbiterGen.cpp

Code: [Select]
int iPK_MediaType_Searchable[] = {MEDIATYPE_pluto_StoredAudio_CONST,MEDIATYPE_pluto_StoredVideo_CONST,MEDIATYPE_pluto_Pictures_CONST,MEDIATYPE_np_Game_CONST,MEDIATYPE_misc_DocViewer_CONST,MEDIATYPE_misc_Playlist_CONST,MEDIATYPE_pluto_Game_CONST};

This needs to be filled with a value from Define_Mediatype.h from pluto_main ... and this code needs to be changed to populate the orbiter grids for all the media types that have DCE devices on the other end.. bmac2 seems to think the DCEAware column may help here... maybe...

Point being now, that this is one more notch down and the plugin is ready for alpha release.

-Thom

tschak909

  • LinuxMCE God
  • ****
  • Posts: 5549
  • DOES work for LinuxMCE.
    • View Profile
Re: MAME Plugin Progress Thread
« Reply #109 on: March 30, 2008, 10:12:19 pm »
Lots of little things... am currently trying to however try and figure out how to get the orbiter to re-order the windows on screen after a Jump Position in Playlist command.

Currently the Media Plugin does the right thing, and re-spawns mame..however it seems apparent that Orbiter isn't designed for a situation where a window may disappear from the window ordering outside of orbiter's control (when a window appears and then disappears...)

when I click the orbiter to get a menu, and click back, the orbiter promptly reparents the window and resizes appropriately..so I am trying to find a way to trigger that action....

-Thom

tschak909

  • LinuxMCE God
  • ****
  • Posts: 5549
  • DOES work for LinuxMCE.
    • View Profile
Re: MAME Plugin Progress Thread
« Reply #110 on: March 31, 2008, 08:48:44 am »
I have implemented the first bits of a proof of concept for a second system.. Atari 800/5200.

I have made a video demonstrating it, playing both Ballblazer and Star Raiders (For you, Matthew...)

http://www.youtube.com/watch?v=Xx25HgCQt_U

-Thom

Matthew

  • Douchebag
  • Addicted
  • *
  • Posts: 567
    • View Profile
Re: MAME Plugin Progress Thread
« Reply #111 on: March 31, 2008, 08:14:04 pm »
I have implemented the first bits of a proof of concept for a second system.. Atari 800/5200.

I have made a video demonstrating it, playing both Ballblazer and Star Raiders (For you, Matthew...)

http://www.youtube.com/watch?v=Xx25HgCQt_U

Thanks for the shout-out :). I might just get my old Atari joystick out of storage for Star Raiders, now that I can rip it in half in front of a 50" screen and 5.1 surround! I'll let y'all know when I've got an Orbiter running on an Atari 800...

skatingn330

  • Regular Poster
  • **
  • Posts: 39
    • View Profile
Re: MAME Plugin Progress Thread
« Reply #112 on: April 05, 2008, 05:59:06 pm »
I use the wireless xbox 360 controller for all my roms i play on my windows box, are we going to be able to use this controller?? is there a linux driver or something?

http://www.bestbuy.com/site/olspage.jsp?skuId=8221471&st=xbox+360+controller&type=product&id=1166839533325

Its great, you can have up to 4 controllers with one recevier, just like the xbox360.
Asus m3n78-pro
AMD Phenom 9950 Quad-Core 2.60 GHz
250 gig sata drive x2
Sata Dvd-rw
4 gigs ram
usb-uirt
LinuxMCE 7.10 32 bit
Vista eternity 32 bit

tschak909

  • LinuxMCE God
  • ****
  • Posts: 5549
  • DOES work for LinuxMCE.
    • View Profile
Re: MAME Plugin Progress Thread
« Reply #113 on: April 05, 2008, 07:11:22 pm »
don't have one, so i don't even know if it's physically interfaceable.

-THom

bmac2

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: MAME Plugin Progress Thread
« Reply #114 on: May 06, 2008, 10:58:30 pm »
http://wiki.linuxmce.org/index.php/Mame_installation

there is the directions of how to install the mame system on lmce.  Still a test thing, but works great.  Please test and let me know of any issues with the install or TSCHAK with any problems.

bmac2

tschak909

  • LinuxMCE God
  • ****
  • Posts: 5549
  • DOES work for LinuxMCE.
    • View Profile
Re: MAME Plugin Progress Thread
« Reply #115 on: May 16, 2008, 08:26:15 am »
As some of you may have seen, bmac2 and I worked together (with posde editing), to produce a set of installation instructions for the bold to install my MAME media type on the 0710 release.

The UI for the 0710 is not complete, the 0710 sqlcvs database does not have the designer changes I have been documenting in my screencasts over the last few weeks. But now that the UI work is relatively complete, I will be downloading an Autobuild from our build server, so that the UI changes I have been making can be fully tested. I will also build a copy of the nokia orbiter to test from my pad as well.

I am a bit nervous about doing this, because I know Pluto is working on a number of changes to the system to support both embedded operation, as well as skin modificaitons etc in designer for NuForce stuff....so I don't know how the stability of my system will be affected, but we'll see...

But hopefully, with everything working, I can test the UI together with the plugin completely for the first time, iron out any designer bugs, and then work on the final bits of features that I want for the 0806 release:

* Bookmarks
* stable moving of games from one MD to another
* cleaning up the database, making the metadata more presentable
* investigating what will need to really be done to support multiple emulator types.

I know I haven't written in a while, but I've been busy, mostly dealing with trying to come to grips with getting things like the package server set up, so that I can make test packages of mame stuff before release, and trying to get all the HADesigner stuff squared away (and dealing with sqlcvs in the middle of it all)

but i wanted everyone to know, that it's all proceeding quite nicely...and if you haven't seen them, go look at the HADesigner screencasts! they are a wonderful insight into creating a new UI for Orbiter:
http://forum.linuxmce.org/index.php?topic=5059.0

Ciao for now,
-Thom

tschak909

  • LinuxMCE God
  • ****
  • Posts: 5549
  • DOES work for LinuxMCE.
    • View Profile
Re: MAME Plugin Progress Thread
« Reply #116 on: July 28, 2008, 01:36:28 am »
An Update...

After a bit of work, I have the first implementation of Bookmarks working.

What does this mean?

The bookmarks functionality present in both audio and video has now been extended to Games. This means that you can save your place in a game, and come back to it later.

I have a demonstration video of it, here:

http://www.localeconcept.com/private/bookmarks.ogg

The implementation is still very buggy, but I have proven that it can be done. Please note, that not all games under MAME support proper state saving/loading, and a lot of games will crash. Which ones? typically the games that have been in the MAME code-base longer will have a much higher chance of properly saving their state.

As soon as I fix a few XSendEvent issues, I will be uploading the code to the charon-merge SVN.

-Thom

hari

  • Administrator
  • LinuxMCE God
  • *****
  • Posts: 2428
    • View Profile
    • ago control
Re: MAME Plugin Progress Thread
« Reply #117 on: July 28, 2008, 05:03:02 pm »
*deep breath*

GUY YOU ROCK :-)

best regards,
Hari
rock your home - http://www.agocontrol.com home automation

cirion

  • Guru
  • ****
  • Posts: 353
    • View Profile
Re: MAME Plugin Progress Thread
« Reply #118 on: July 29, 2008, 10:06:46 am »
I use the wireless xbox 360 controller for all my roms i play on my windows box, are we going to be able to use this controller?? is there a linux driver or something?

http://www.bestbuy.com/site/olspage.jsp?skuId=8221471&st=xbox+360+controller&type=product&id=1166839533325

Its great, you can have up to 4 controllers with one recevier, just like the xbox360.

Yes there is a driver for linux :)
http://pingus.seul.org/~grumbel/xboxdrv/

tschak909

  • LinuxMCE God
  • ****
  • Posts: 5549
  • DOES work for LinuxMCE.
    • View Profile
Re: MAME Plugin Progress Thread
« Reply #119 on: July 29, 2008, 04:29:47 pm »
can you please build a template for it? we have a joystick category now.

-Thom