""" Simple test. """ import GameInfo import NecroQuest import GameMap import os try: import wx except: pass # Copy the new version here, THEN import PyVBA: LocalPath = "PyVBA.pyd" if os.path.exists(LocalPath): LocalTime = os.stat(LocalPath).st_mtime else: LocalTime = 0 DistalPath = r"build\lib.win32-2.5\PyVBA.pyd" if os.path.exists(DistalPath): DistalTime = os.stat(DistalPath).st_mtime else: DistalTime = 0 if LocalTime < DistalTime: Command = r"copy %s %s"%(DistalPath, LocalPath) print Command os.system(Command) def TestConfig(): KeyConfig = PyVBA.GetKeyConfig() print "KeyConfig:", KeyConfig NewConfig = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10) PyFCEU.SetKeyConfig(NewConfig) KeyConfig = PyVBA.GetKeyConfig() print "KeyConfig:", KeyConfig def TestPlayGame(): PyVBA.foo() print dir(PyVBA) #ROMPath = r"g:\emu\gba\gbaren\USA\MegaMan Zero (U).zip" #ROMPath = r"g:\emu\gba\gbaren\1370 - Metroid - Zero Mission (U).zip" #ROMPath = r"g:\emu\gba\1370 - Metroid - Zero Mission (U).zip" ROMPath = r"g:\emu\gb\Legend of Zelda Oracle of Ages.gbc" SavePath = None #SavePath = r"G:\emu\gba\GBARen\USA\MegaMan Zero (U)2.sgm" print "playGame:", ROMPath Result = PyVBA.PlayGame(ROMPath, SavePath) print Result def TestQuest(): #ROMName = r"g:\emu\gba\gbaren\Mario Advanced 3 - Yoshi's Island # GBA.zip" ROMName = r"g:\emu\gba\gbaren\USA\WarioWare Inc. (U).zip" 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("SMPlatforming") Quest = Metagame.GetQuestByName("Meta-meta-game") #Quest = None print ">>> Quest:", Quest SavePath = Quest.GetSaveFilePath() print ">>>SavePath:", SavePath #SavePath = None ResultList = PyVBA.PlayGame(ROMName, SavePath, Quest) print ResultList def TestKeyConfig(): import Keystroke 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"), ord("G"), #wx.WXK_ESCAPE, ## 0, 0] TranslatedConfig = [] for Key in KeyConfig: MappedKey = Keystroke.VBAKeyMapping.get(Key, Key) print "%s maps to %s"%(Key, MappedKey) TranslatedConfig.append(MappedKey) PyVBA.SetKeyConfig(TranslatedConfig) TestQuest() if __name__ == "__main__": import PyVBA print "Path:", PyVBA.__file__ TestPlayGame() #TestQuest() #TestConfig() #TestKeyConfig()