""" Simple test. """ import os import sys import GameInfo import NecroQuest import GameMap # Copy the new version here, THEN import PyMAME: LocalPath = "PyMAME.pyd" if os.path.exists(LocalPath): LocalTime = os.stat(LocalPath).st_mtime else: LocalTime = 0 DistalPath = r"build\lib.win32-2.5\PyMAME.pyd" if os.path.exists(DistalPath): DistalTime = os.stat(DistalPath).st_mtime else: DistalTime = 0 if LocalTime < DistalTime: Command = r"move /y %s %s"%(DistalPath, LocalPath) print Command os.system(Command) import PyMAME print "Path:", PyMAME.__file__ def TestSimpleRun(): PyMAME.foo() print dir(PyMAME) Result = PyMAME.PlayGame("blktiger") print "Result:", Result print ">>> PRESS ENTER <<<" sys.stdin.readline() def TestQuest(): #ROMName = "19xx" #ROMName = "digdug" #ROMName = "invaders" #ROMName = "joust" ROMName = "dragnblz" GameInfo.ParseGameInfoFromFile(os.path.join("quests", "Games.xml")) Metagame = GameMap.MetagameClass() QuestFilePath = os.path.join("Quests", "Dot", "Dot.qst") Metagame.Load(QuestFilePath) #Quest = Metagame.GetQuestByName("Shipyard raid") #Quest = Metagame.GetQuestByName("That's a big flower.") #Quest = Metagame.GetQuestByName("Space Invaders") #Quest = Metagame.GetQuestByName("Buzzard Bait!") Quest = Metagame.GetQuestByName("Dragon Blazing Under Water") print ">>> Quest:", Quest SavePath = Quest.GetSaveFilePath() print "SavePath:", SavePath ResultList = PyMAME.PlayGame(ROMName, SavePath, Quest) for Item in ResultList: print ">>", Item def TestKeyConfig(): import wx import Keystroke ## KeyConfig = [ord("Z"), ord("X"), # A and B ## wx.WXK_TAB, wx.WXK_RETURN, # Select and start ## wx.WXK_NUMPAD_UP, wx.WXK_NUMPAD_DOWN, wx.WXK_NUMPAD_LEFT, wx.WXK_NUMPAD_RIGHT, # Directions ## ord("Z"), ord("X"), # X and Y ## ord("A"), ord("S"), # Left-trigger and right-trigger ## 0, 0] ## KeyConfig = [Keystroke.JoystickButtons.Button2, Keystroke.JoystickButtons.Button3, ## wx.WXK_TAB, wx.WXK_RETURN, # Select and start ## Keystroke.JoystickButtons.Up, Keystroke.JoystickButtons.Down, Keystroke.JoystickButtons.Left, Keystroke.JoystickButtons.Right, ## Keystroke.JoystickButtons.Button1, Keystroke.JoystickButtons.Button4, ## ord("Q"), ord("W"), # Left-trigger and right-trigger ## ord("R"), ord("G"), #wx.WXK_ESCAPE, ## 0, 0] KeyConfig = [ord("Z"), ord("X"), # A and B wx.WXK_TAB, wx.WXK_RETURN, # Select and start wx.WXK_NUMPAD_UP, wx.WXK_NUMPAD_DOWN, wx.WXK_NUMPAD_LEFT, wx.WXK_NUMPAD_RIGHT, # Directions ord("A"), ord("S"), # X and Y ord("Q"), ord("W"), # Left-trigger and right-trigger ord("R"), wx.WXK_ESCAPE] TranslatedConfig = [] for Key in KeyConfig: MappedKey = Keystroke.MAMEKeyMapping.get(Key, Key) print "%s maps to %s"%(Key, MappedKey) TranslatedConfig.append(MappedKey) PyMAME.SetKeyConfig(TranslatedConfig) TestQuest() if __name__ == "__main__": #TestSimpleRun() TestQuest() #TestKeyConfig()