com.miami.romeo.xmame
Class Xmame

java.lang.Object
  extended bycom.miami.romeo.xmame.Xmame

public class Xmame
extends java.lang.Object

Xmame.
This class dialogs with the xmame executable. It can retrieve data (ie list of games) and run a game.

Version:
$Revision: 1.7 $Date: 2003/12/29 22:59:53 $
Author:
$author: Stefano Bolli

Constructor Summary
Xmame(Romeo romeo)
          Constructor
 
Method Summary
 java.lang.String[] getClones(java.lang.String[] romName, java.lang.String[] listOfClones)
          This method compares the list of games with the list of clones.
 java.lang.String[] getClonesOfGame(java.lang.String xmamePath, java.lang.String gameName)
          This method retrieves the clones of a given game.
 java.lang.String getDetailedInfo(java.lang.String xmamePath, java.lang.String gameName)
          This method retrieves detailed info for a given game running the command "xmame -ld gamename".
 java.lang.String[] getDigitalSoundPlugins(java.lang.String xmamePath)
          This method removes all unuseful stuff (ie copyright lines (Open GL), etc.) from the list of the available sound-dsp plugins.
 java.lang.String[] getFavoriteRoms(java.lang.String[] romName, java.lang.String listPath)
          This method returns an array of favorite/non-favorite games.
 java.lang.String[] getGameSamples(java.lang.String xmamePath, java.lang.String gameName)
          This method lists used audio samples for a given game running the command "xmame -ls gamename".
 java.lang.String[] getNumberOfPlayedMatches(java.lang.String[] romName, java.lang.String listPath)
          This method returns an array with numbers of played matches for each game.
 java.lang.String getRealCommand(java.lang.String cmd)
           
 java.lang.String getRomColors(java.lang.String xmamePath, java.lang.String romName)
          This method returns a string containing the number of colors used by a rom running the command "xmame -listcolors romname".
 java.lang.String[] getRomDescriptions(java.lang.String[] listFull)
          This method retrieves game descriptions.
 java.lang.String[] getRomManufacturers(java.lang.String[] listOfGames)
          This method retrieves the manufacturer for each game.
 java.lang.String[] getRomNames(java.lang.String[] listFull)
          This method retrieves game names.
 java.lang.String[] getRomsUsingSamples(java.lang.String xmamePath, java.lang.String[] romName)
          This method retrieves the list of games that use audio samples.
 java.lang.String[] getRomYears(java.lang.String[] listOfGames)
          This method retrieves the list of the production year for each game.
 java.lang.String[] getSoundMixerPlugins(java.lang.String xmamePath)
          This method removes all unuseful stuff (ie copyright lines (Open GL), etc.) from the list of the available sound-mixer plugins.
 java.lang.String[] getSourceFiles(java.lang.String xmamePath)
          This method retrieves list of source files running the command "xmame -lsf".
 java.lang.String getVersion(java.lang.String xmamePath)
          This method retrieves xmame version running the command "xmame -V".
 int[] getVersionNumbers(java.lang.String xmamePath)
          This method returns xmame version numbers.
 java.lang.String[] getWorkingRoms(java.lang.String xmamePath)
          This method runs the command "xmame -listgamelist" that outputs a list with specialy formatted extra info for generating gamelist.mame.
 java.lang.String[] listClones(java.lang.String xmamePath)
          This method retrieves the list of all clones running the command "xmame -listclones".
 java.lang.String[] listCpuUsage(java.lang.String xmamePath)
          This method lists cpu usage statistics per year running the command "xmame -listcpu".
 java.lang.String[] listDigitalSoundPlugins(java.lang.String xmamePath)
          This method lists available sound-dsp plugins running the command "xmame -ldp".
 java.lang.String[] listFull(java.lang.String xmamePath)
          This method retrieves list of supported games with full description running the command "xmame -listfull".
 java.lang.String[] listGames(java.lang.String xmamePath)
          This method retrieves the list of supported games with manufacturer and year running the command "xmame -listgames".
 java.lang.String[] listSamples(java.lang.String xmamePath)
          This method lists used audio samples running the command "xmame -ls".
 java.lang.String[] listSoundMixerPlugins(java.lang.String xmamePath)
          This method lists available sound-mixer plugins running the command "xmame -lmp -noloadconfig".
 java.lang.String parsePath(java.lang.String cmd)
           
 boolean romIsCorrect(java.lang.String xmamePath, java.lang.String romPath, java.lang.String romName)
          This method returns true if a rom is correct, false otherwise.
static java.lang.String[] runCommand(java.lang.String cmd)
          This method runs a given command, gets command' s output stream and puts a buffered reader input stream on it, then reads the output lines from command and put them into a list to pass to the caller.
 void runMame(java.lang.String xmamePath, java.lang.String options)
          This method runs a given game.
 void setDigitalSoundPlugins(java.lang.String xmamePath)
          This method adds available sound-dsp plugins into a main window' s specific combo box.
 void setSoundMixerPlugins(java.lang.String xmamePath)
          This method adds available sound mixer plugins into a main window' s specific combo box.
 java.lang.String verifyRom(java.lang.String xmamePath, java.lang.String romPath, java.lang.String romName)
          This method runs the command "xmame -verifyroms" to verify a romset and gets the response.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Xmame

public Xmame(Romeo romeo)
Constructor

Parameters:
romeo - The main class
Method Detail

listFull

public java.lang.String[] listFull(java.lang.String xmamePath)
This method retrieves list of supported games with full description running the command "xmame -listfull".

Parameters:
xmamePath - The path to the xmame executable
Returns:
The list of supported games with full description
See Also:
runCommand(String)

getRomNames

public java.lang.String[] getRomNames(java.lang.String[] listFull)
This method retrieves game names.

Parameters:
listFull - The list of supported games with full description
Returns:
The list of game names
See Also:
listFull(String)

getFavoriteRoms

public java.lang.String[] getFavoriteRoms(java.lang.String[] romName,
                                          java.lang.String listPath)
This method returns an array of favorite/non-favorite games.

Parameters:
romName - The game names
listPath - The path to the list of games file
Returns:
The list of favorite/non-favorite games
See Also:
getRomNames(String[])

getRomDescriptions

public java.lang.String[] getRomDescriptions(java.lang.String[] listFull)
This method retrieves game descriptions.

Parameters:
listFull - The list of supported games with full description
Returns:
The list of descriptions
See Also:
listFull(String)

listGames

public java.lang.String[] listGames(java.lang.String xmamePath)
This method retrieves the list of supported games with manufacturer and year running the command "xmame -listgames".

Parameters:
xmamePath - The path to the xmame executable
Returns:
The list of supported games with manufacturer and year
See Also:
runCommand(String)

getRomYears

public java.lang.String[] getRomYears(java.lang.String[] listOfGames)
This method retrieves the list of the production year for each game.

Parameters:
listOfGames - The list of supported games with manufacturer and year.
Returns:
The list of the production years
See Also:
listGames(String)

getRomManufacturers

public java.lang.String[] getRomManufacturers(java.lang.String[] listOfGames)
This method retrieves the manufacturer for each game.

Parameters:
listOfGames - The list of supported games with manufacturer and year.
Returns:
The list of manufacturers
See Also:
listGames(String)

getWorkingRoms

public java.lang.String[] getWorkingRoms(java.lang.String xmamePath)
This method runs the command "xmame -listgamelist" that outputs a list with specialy formatted extra info for generating gamelist.mame. Next this void retrieves if each game works fine or doesn' t. Finally it puts all retrieved data into an array.

Parameters:
xmamePath - The path to the xmame executable
Returns:
Array of strings
See Also:
runCommand(String)

listClones

public java.lang.String[] listClones(java.lang.String xmamePath)
This method retrieves the list of all clones running the command "xmame -listclones".

Parameters:
xmamePath - The path to the xmame executable
Returns:
The list of all clones
See Also:
runCommand(String)

getClonesOfGame

public java.lang.String[] getClonesOfGame(java.lang.String xmamePath,
                                          java.lang.String gameName)
This method retrieves the clones of a given game.

Parameters:
xmamePath - The path to the xmame executable
gameName - The game name
Returns:
The list of the clones of a given game
See Also:
runCommand(String)

getClones

public java.lang.String[] getClones(java.lang.String[] romName,
                                    java.lang.String[] listOfClones)
This method compares the list of games with the list of clones.

Parameters:
romName - The game names
listOfClones - The clones
Returns:
The list of original and cloned games
See Also:
getRomNames(String[])

getSourceFiles

public java.lang.String[] getSourceFiles(java.lang.String xmamePath)
This method retrieves list of source files running the command "xmame -lsf".

Parameters:
xmamePath - The path to the xmame executable
Returns:
The list of source files
See Also:
runCommand(String)

getRomsUsingSamples

public java.lang.String[] getRomsUsingSamples(java.lang.String xmamePath,
                                              java.lang.String[] romName)
This method retrieves the list of games that use audio samples.

Parameters:
xmamePath - The path to the xmame executable
romName - The list of rom names
Returns:
The list of games that use audio samples
See Also:
listSamples(String)

listSamples

public java.lang.String[] listSamples(java.lang.String xmamePath)
This method lists used audio samples running the command "xmame -ls".

Parameters:
xmamePath - The path to the xmame executable
Returns:
The list of used audio samples

getGameSamples

public java.lang.String[] getGameSamples(java.lang.String xmamePath,
                                         java.lang.String gameName)
This method lists used audio samples for a given game running the command "xmame -ls gamename".

Parameters:
xmamePath - The path to the xmame executable
gameName - The game name
Returns:
The list of used audio samples for a given name
See Also:
runCommand(String)

getDetailedInfo

public java.lang.String getDetailedInfo(java.lang.String xmamePath,
                                        java.lang.String gameName)
This method retrieves detailed info for a given game running the command "xmame -ld gamename".

Parameters:
xmamePath - The path to the xmame executable
gameName - The game name
Returns:
The detailed info for a given game
See Also:
runCommand(String)

getNumberOfPlayedMatches

public java.lang.String[] getNumberOfPlayedMatches(java.lang.String[] romName,
                                                   java.lang.String listPath)
This method returns an array with numbers of played matches for each game.

Parameters:
romName - The list of games
listPath - The path to the list of games
Returns:
An array with the numbers of played matches for each game.

listCpuUsage

public java.lang.String[] listCpuUsage(java.lang.String xmamePath)
This method lists cpu usage statistics per year running the command "xmame -listcpu".

Parameters:
xmamePath - The path to the xmame executable
Returns:
The list of cpu usage statistics per year
See Also:
runCommand(String)

getVersionNumbers

public int[] getVersionNumbers(java.lang.String xmamePath)
This method returns xmame version numbers.

Parameters:
xmamePath - The path to the xmame executable
Returns:
The major revision number, the minor revision number and the patch level
Since:
0.1.3pre2
See Also:
getVersion(String)

getVersion

public java.lang.String getVersion(java.lang.String xmamePath)
This method retrieves xmame version running the command "xmame -V".

Parameters:
xmamePath - The path to the xmame executable
Returns:
xmame version
See Also:
runCommand(String)

romIsCorrect

public boolean romIsCorrect(java.lang.String xmamePath,
                            java.lang.String romPath,
                            java.lang.String romName)
This method returns true if a rom is correct, false otherwise.

Parameters:
xmamePath - The path to the xmame executable
romPath - The path to the rom to verify
romName - The name of the rom to verify
Returns:
true if the rom is correct, false otherwise
Since:
0.1.3pre2
See Also:
verifyRom(String, String, String)

verifyRom

public java.lang.String verifyRom(java.lang.String xmamePath,
                                  java.lang.String romPath,
                                  java.lang.String romName)
This method runs the command "xmame -verifyroms" to verify a romset and gets the response.

Parameters:
xmamePath - The path to the xmame executable
romPath - The path to the rom to verify
romName - The name of the rom to verify
Returns:
The output of the command "xmame -verifyroms rom name".
See Also:
runCommand(String)

getRomColors

public java.lang.String getRomColors(java.lang.String xmamePath,
                                     java.lang.String romName)
This method returns a string containing the number of colors used by a rom running the command "xmame -listcolors romname".

Parameters:
xmamePath - The path to the xmame executable
romName - The name of the rom
Returns:
A String containing the number of colors used by a given rom
See Also:
runCommand(String)

setDigitalSoundPlugins

public void setDigitalSoundPlugins(java.lang.String xmamePath)
This method adds available sound-dsp plugins into a main window' s specific combo box.

Parameters:
xmamePath - The path to the xmame executable
See Also:
getDigitalSoundPlugins(String)

getDigitalSoundPlugins

public java.lang.String[] getDigitalSoundPlugins(java.lang.String xmamePath)
This method removes all unuseful stuff (ie copyright lines (Open GL), etc.) from the list of the available sound-dsp plugins.

Parameters:
xmamePath - The path to the xmame executable
Returns:
The list of available sound-dsp plugins without unuseful stuff
See Also:
listDigitalSoundPlugins(String)

listDigitalSoundPlugins

public java.lang.String[] listDigitalSoundPlugins(java.lang.String xmamePath)
This method lists available sound-dsp plugins running the command "xmame -ldp".

Parameters:
xmamePath - The path to the xmame executable
Returns:
The list of available sound-dsp plugins
See Also:
runCommand(String)

setSoundMixerPlugins

public void setSoundMixerPlugins(java.lang.String xmamePath)
This method adds available sound mixer plugins into a main window' s specific combo box.

Parameters:
xmamePath - The path to the xmame executable
See Also:
getSoundMixerPlugins(String)

getSoundMixerPlugins

public java.lang.String[] getSoundMixerPlugins(java.lang.String xmamePath)
This method removes all unuseful stuff (ie copyright lines (Open GL), etc.) from the list of the available sound-mixer plugins.

Parameters:
xmamePath - The path to the xmame executable
Returns:
The list of available sound-mixer plugins without unuseful stuff
See Also:
listSoundMixerPlugins(String), runCommand(String)

listSoundMixerPlugins

public java.lang.String[] listSoundMixerPlugins(java.lang.String xmamePath)
This method lists available sound-mixer plugins running the command "xmame -lmp -noloadconfig".

Parameters:
xmamePath - The path to the xmame executable
Returns:
The list of available sound-mixer plugins
See Also:
runCommand(String)

runMame

public void runMame(java.lang.String xmamePath,
                    java.lang.String options)
             throws java.io.IOException
This method runs a given game.

Parameters:
xmamePath - The path to the xmame executable
options - The options selected by the user to run the given game
Throws:
java.io.IOException
See Also:
runCommand(String)

runCommand

public static java.lang.String[] runCommand(java.lang.String cmd)
                                     throws java.io.IOException
This method runs a given command, gets command' s output stream and puts a buffered reader input stream on it, then reads the output lines from command and put them into a list to pass to the caller.

Parameters:
cmd - The command to run
Returns:
The list of strings for the caller
Throws:
java.io.IOException

getRealCommand

public java.lang.String getRealCommand(java.lang.String cmd)

parsePath

public java.lang.String parsePath(java.lang.String cmd)