#foundromfiles = os.popen('ls '+rom_dir).readlines( ) foundromfiles = [romf[:-1] for romf in os.popen('ls '+rom_dir)] rom = romf.rstrip() #print "rom = "+rom while True: try: triforcetools.connect('192.168.1.2', 10703) except: #logfile.write("Error:\nConnect Failed") continue #logfile.write("Sending...") triforcetools.HOST_SetMode(0, 1) triforcetools.SECURITY_SetKeycode("\x00" * 8) #argv[0] not games(selection) triforcetools.DIMM_UploadFile(rom_dir+rom) triforcetools.HOST_Restart() triforcetools.TIME_SetLimit(10*60*1000) triforcetools.disconnect() #logfile.write("Transfer\nComplete!") sleep(5) exit()
import os, collections, signal, sys, subprocess, socket import triforcetools from time import sleep logfile = open('log.txt', 'w') # open input file triforcetools.connect('192.168.0.2', 10703) logfile.write("Sending..." + sys.argv[1]) triforcetools.HOST_SetMode(0, 1) triforcetools.SECURITY_SetKeycode("\x00" * 8) triforcetools.DIMM_UploadFile(sys.argv[1]) logfile.write("Transfer\nComplete!") triforcetools.HOST_Restart() while True: triforcetools.TIME_SetLimit(10 * 60 * 1000) sleep(5)
except: lcd.clear() lcd.message("Error:\nConnect Failed") sleep(1) lcd.clear() lcd.message(selection) continue lcd.clear() lcd.message("Sending...") lcd.setCursor(10, 0) lcd.ToggleBlink() triforcetools.HOST_SetMode(0, 1) triforcetools.SECURITY_SetKeycode("\x00" * 8) triforcetools.DIMM_UploadFile(rom_dir + games[selection]) triforcetools.HOST_Restart() triforcetools.TIME_SetLimit(10 * 60 * 1000) triforcetools.disconnect() lcd.ToggleBlink() lcd.clear() lcd.message("Transfer\nComplete!") sleep(5) lcd.clear() lcd.message(selection) elif lcd.SELECT in pressedButtons: pressedButtons.remove(lcd.SELECT) # Handle LEFT if lcd.buttonPressed(lcd.LEFT):
lcd.clear() lcd.message("Error:\nConnect Failed") sleep(1) lcd.clear() lcd.message(selection) continue lcd.clear() lcd.message("Sending...") # lcd.set_Cursor(10, 0) # lcd.ToggleBlink() triforcetools.HOST_SetMode(0, 1) triforcetools.SECURITY_SetKeycode("\x00" * 8) if categories[chosen_category] == "atomiswave": triforcetools.DIMM_UploadFile(rom_dir + atomiswave[selection]) elif categories[chosen_category] == "atomiswave_special": triforcetools.DIMM_UploadFile( rom_dir + atomiswave_special[selection]) elif categories[chosen_category] == "naomi": triforcetools.DIMM_UploadFile(rom_dir + naomi[selection]) elif categories[chosen_category] == "naomi2": triforcetools.DIMM_UploadFile(rom_dir + naomi2[selection]) elif categories[chosen_category] == "naomi_vertical": triforcetools.DIMM_UploadFile(rom_dir + naomi_vertical[selection]) elif categories[chosen_category] == "naomi_gun": triforcetools.DIMM_UploadFile(rom_dir + naomi_gun[selection]) elif categories[chosen_category] == "naomi_special": triforcetools.DIMM_UploadFile(rom_dir +
import os, collections, signal, sys, subprocess, socket import triforcetools #from systemd import daemon from time import sleep logfile = open('/var/www/logs/log.txt', 'w') rom_dir = '/boot/roms/' while True: try: triforcetools.connect('192.168.1.2', 10703) except: #logfile.write("Error:\nConnect Failed") continue logfile.write(sys.argv[1]) triforcetools.HOST_SetMode(0, 1) triforcetools.SECURITY_SetKeycode("\x00" * 8) #argv[0] not games(selection) triforcetools.DIMM_UploadFile(rom_dir + sys.argv[1]) triforcetools.HOST_Restart() triforcetools.TIME_SetLimit(10 * 60 * 1000) triforcetools.disconnect() #logfile.write("Transfer\nComplete!") sleep(5) exit()
try: triforcetools.connect(targets_list[current_ip], 10703) except: lcd.clear() lcd.ToggleBlink() lcd.message("Error:\nConnect Failed!") sleep(sleep_error) lcd.clear() lcd.message(selection) continue lcd.clear() lcd.message("Sending...") triforcetools.HOST_SetMode(0, 1) triforcetools.SECURITY_SetKeycode("\x00" * 8) triforcetools.DIMM_UploadFile(roms_list[selection]) triforcetools.HOST_Restart() triforcetools.TIME_SetLimit(10 * 60 * 1000) triforcetools.disconnect() lcd.clear() lcd.ToggleBlink() lcd.message("Transfer\nComplete!") sleep(sleep_message) lcd.clear() lcd.message(selection) elif lcd.SELECT in pressedButtons: pressedButtons.remove(lcd.SELECT) # Handle LEFT
import triforcetools from time import sleep from sys import argv if len(argv) < 3: print "Usage: python ./upload.py ip_address path_to_rom" exit() netdimm_ip = argv[1] rompath = argv[2] print "Trying to connect to NetDIMM on " + netdimm_ip + "..." while True: try: triforcetools.connect(netdimm_ip, 10703) except: pass sleep(1) print "Uploading " + rompath + "..." triforcetools.HOST_SetMode(0, 1) triforcetools.SECURITY_SetKeycode("\x00" * 8) triforcetools.DIMM_UploadFile(rompath) triforcetools.HOST_Restart() triforcetools.TIME_SetLimit(10 * 60 * 1000) triforcetools.disconnect() print "All done"