""" Simple test. """ import os import sys import traceback import GameInfo import NecroQuest import GameMap # Copy the new version here, THEN import PyNES: LocalPath = "PyNES.pyd" if os.path.exists(LocalPath): LocalTime = os.stat(LocalPath).st_mtime else: LocalTime = 0 DistalPath = r"build\lib.win32-2.5\PyNES.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) import PyNES print "Path:", PyNES.__file__ def TestSimpleRun(): PyNES.foo() print dir(PyNES) #Result = PyNES.PlayGame(r"g:\emu\nes\nesren\USA\Contra (U) [!].zip") #Result = PyNES.PlayGame(r"g:\emu\nes\nesren\USA\Power Blade (U) [!].zip") Result = PyNES.PlayGame(r"g:\emu\nes\nesren\USA\Power Blade 2 (U).zip") print "Result:", Result print ">>> PRESS ENTER <<<" sys.stdin.readline() def TestQuest(): #ROMName = r"g:\emu\nes\nesren\USA\Power Blade (U) [!].zip" ROMName = r"g:\emu\nes\nesren\USA\Power Blade 2 (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("Boomerang Boss 2!") print ">>> Quest:", Quest SavePath = Quest.GetSaveFilePath() ## import Keystroke ## KeyConfig = [88, 90, 9, 13, 315, 317, 314, 316, 65, 83, 81, 87, 0, 0] ## Keystroke.SetPyNESKeyConfig(KeyConfig) ResultList = PyNES.PlayGame(ROMName, SavePath, Quest) print ResultList if __name__ == "__main__": try: #TestSimpleRun() TestQuest() except: traceback.print_exc() sys.stdin.readline()