def create(self): self.noeWnd = noewin.NoeUserWindow("Load Ghost Recon qob model", "openModelWindowClass", 385, 120) noeWindowRect = noewin.getNoesisWindowRect() if noeWindowRect: windowMargin = 100 self.noeWnd.x = noeWindowRect[0] + windowMargin self.noeWnd.y = noeWindowRect[1] + windowMargin if self.noeWnd.createWindow(): self.noeWnd.setFont("Arial", 12) self.noeWnd.createStatic("Path to texture folder", 5, 5, 180, 20) # choose path to textures index = self.noeWnd.createEditBox(5, 28, 275, 20, "", None, False, False) self.texturePathEditBox = self.noeWnd.getControlByIndex(index) self.noeWnd.createButton("Open", 290, 27, 80, 21, self.buttonGetTexturePathOnClick) self.noeWnd.createButton("Load", 5, 60, 80, 30, self.buttonLoadOnClick) self.noeWnd.createButton("Cancel", 90, 60, 80, 30, self.buttonCancelOnClick) self.noeWnd.doModal()
def setDefaultWindowPos(noeWnd): #offset a bit into the noesis window noeWindowRect = noewin.getNoesisWindowRect() if noeWindowRect: windowMargin = 64 noeWnd.x = noeWindowRect[0] + windowMargin noeWnd.y = noeWindowRect[1] + windowMargin
def ToolMethod(toolIndex): noeWnd = noewin.NoeUserWindow("Driver San Francisco Importer", "convert", 500, 300) noeWindowRect = noewin.getNoesisWindowRect() if noeWindowRect: windowMargin = 64 noeWnd.x = noeWindowRect[0] + windowMargin noeWnd.y = noeWindowRect[1] + windowMargin if not noeWnd.createWindow(): print("Failed to create window.") return 0 noeWnd.setFont("Arial", 14) buttonExportCar = noeWnd.createButton("Export .VEHC", 10, 225, 96, 32, ExportCar) buttonExport = noeWnd.getControlByIndex(buttonExportCar) buttonLoadModel = noeWnd.createButton("Load Selected", 252, 225, 126, 32, LoadModel) buttonLoad = noeWnd.getControlByIndex(buttonLoadModel) buttonExportAll = noeWnd.createButton("Export All", 116, 225, 126, 32, ExportAll) buttonAll = noeWnd.getControlByIndex(buttonExportAll) global listBox listIndex = noeWnd.createListBox(10, 22, 480, 220, None, noewin.LBS_NOTIFY) listBox = noeWnd.getControlByIndex(listIndex) return 0
def create(self): self.noeWnd = noewinext.NoeUserWindowExt( \ "AOS 2 Resource Viewer", "AOSResourceViewerWindowClass", \ 385, 495) noeWindowRect = noewin.getNoesisWindowRect() if noeWindowRect: windowMargin = 100 self.noeWnd.x = noeWindowRect[0] + windowMargin self.noeWnd.y = noeWindowRect[1] + windowMargin if self.noeWnd.createWindow(): self.noeWnd.setFont("Arial", 12) self.noeWnd.createStatic("Resource file:", 5, 2, 110, 20) index = self.noeWnd.createTreeView(5, 25, 275, 440) self.resourceFileView = self.noeWnd.getControlByIndex(index) self.noeWnd.createButton("Open", 290, 25, 80, 30, \ self.viewerToolButtonOpen) self.noeWnd.createButton("Unpack", 290, 400, 80, 30, \ self.viewerToolButtonUnpack) self.noeWnd.createButton("Close", 290, 435, 80, 30, \ self.viewerToolButtonClose) self.viewResFile() self.noeWnd.doModal()
def create(self): self.noeWnd = noewin.NoeUserWindow("Import options", "HTRAWWindowClass", \ 286, 180) noeWindowRect = noewin.getNoesisWindowRect() if noeWindowRect: windowMargin = 100 self.noeWnd.x = noeWindowRect[0] + windowMargin self.noeWnd.y = noeWindowRect[1] + windowMargin if self.noeWnd.createWindow(): self.noeWnd.setFont("Arial", 12) self.noeWnd.createStatic("Height coefficient:", 5, 7, 120, 20) # index = self.noeWnd.createEditBox(110, 5, 70, 20, None, 0) self.heightEdit = self.noeWnd.getControlByIndex(index) self.heightEdit.setText(str(DEFAULT_HEIGHT_COEFF)) self.noeWnd.createStatic("Sand level:", 43, 32, 120, 20) # index = self.noeWnd.createEditBox(110, 30, 70, 20, None, 0) self.levelEdit = self.noeWnd.getControlByIndex(index) self.levelEdit.setText(str(DEFAULT_SAND_LEVEL)) self.noeWnd.createStatic("Scale:", 69, 57, 120, 20) # index = self.noeWnd.createEditBox(110, 55, 70, 20, None, 0) self.scaleEdit = self.noeWnd.getControlByIndex(index) self.scaleEdit.setText(str(DEFAULT_SCALE)) index = self.noeWnd.createCheckBox("add textures", 5, 80, \ 135, 20) self.texturesCheckBox = self.noeWnd.getControlByIndex(index) self.texturesCheckBox.setChecked(1) self.noeWnd.createStatic("uTile:", 72, 107, 70, 20) self.noeWnd.createStatic("vTile:", 74, 130, 70, 20) # index = self.noeWnd.createEditBox(110, 105, 70, 20, None, 0) self.utileEdit = self.noeWnd.getControlByIndex(index) self.utileEdit.setText(str(DEFAULT_UTILE)) index = self.noeWnd.createEditBox(110, 130, 70, 20, None, 0) self.vtileEdit = self.noeWnd.getControlByIndex(index) self.vtileEdit.setText(str(DEFAULT_VTILE)) self.noeWnd.createButton("Import", 190, 5, 80, 30, \ self.openOptionsButtonImport) self.noeWnd.createButton("Cancel", 190, 40, 80, 30, \ self.openOptionsButtonCancel) self.noeWnd.doModal()
def show(self): self.noeWnd = noewin.NoeUserWindow("Export options", "HTWindowClass", \ 300, 155) noeWindowRect = noewin.getNoesisWindowRect() if noeWindowRect: windowMargin = 64 self.noeWnd.x = noeWindowRect[0] + windowMargin self.noeWnd.y = noeWindowRect[1] + windowMargin if self.noeWnd.createWindow(): self.noeWnd.setFont("Arial", 12) self.noeWnd.createStatic("Choose format:", 5, 5, 160, 20) # choose game list index = self.noeWnd.createListBox(5, 25, 184, 47, None, 0) self.typeListBox = self.noeWnd.getControlByIndex(index) typeList = ("Format RGB565", "Format RGBA5551") for type in typeList: self.typeListBox.addString(type) self.typeListBox.selectString(typeList[0]) self.noeWnd.createStatic("Number of 16 bit images:", 5, 70, 169, 20) # choose format combobox index = self.noeWnd.createComboBox(160, 65, 30, 20) self.mmcountComboBox = self.noeWnd.getControlByIndex(index) self.noeWnd.createStatic("Number of paletted images:", 5, 98, 169, 20) # choose format combobox index = self.noeWnd.createComboBox(160, 95, 30, 20) self.palcountComboBox = self.noeWnd.getControlByIndex(index) countList = ("6", "5", "4", "3", "2", "1", "0") for count in countList: self.mmcountComboBox.addString(count) self.palcountComboBox.addString(count) self.mmcountComboBox.selectString(countList[0]) self.palcountComboBox.selectString(countList[0]) self.noeWnd.createButton("Export", 210, 25, 80, 30, \ self.exportOptionsButtonExport) self.noeWnd.createButton("Cancel", 210, 60, 80, 30, \ self.exportOptionsButtonCancel) self.noeWnd.doModal()
def create(self): self.noeWnd = noewin.NoeUserWindow( \ "Hard Truck archive packer (.res, .rmp)", "HTPackerWindowClass", \ 420, 255) noeWindowRect = noewin.getNoesisWindowRect() if noeWindowRect: windowMargin = 100 self.noeWnd.x = noeWindowRect[0] + windowMargin self.noeWnd.y = noeWindowRect[1] + windowMargin if self.noeWnd.createWindow(): self.noeWnd.setFont("Arial", 12) self.noeWnd.createStatic("File path:", 5, 5, 50, 20) # index = self.noeWnd.createEditBox(60, 5, 350, 20, "", None, \ False, True) self.pathEdit = self.noeWnd.getControlByIndex(index) self.pathEdit.setText(self.filename) self.noeWnd.createStatic("Exten.:", 5, 32, 110, 20) # index = self.noeWnd.createComboBox(60, 32, 130, 20) self.extComboBox = self.noeWnd.getControlByIndex(index) extList = ("", "Hard Truck 1 (.rmp)", "Hard Truck 2 (.res)") for extension in extList: self.extComboBox.addString(extension) self.extComboBox.selectString(extList[0]) self.noeWnd.createStatic("Output:", 5, 65, 60, 20) # index = self.noeWnd.createEditBox(60, 65, 350, 120, "", None, \ True, True) self.outputEdit = self.noeWnd.getControlByIndex(index) self.noeWnd.createButton("Check files", 60, 195, 80, 30, \ self.archivePackerButtonCheck) self.noeWnd.createButton("Pack archive", 145, 195, 80, 30, \ self.archivePackerButtonPack) self.noeWnd.createButton("Cancel", 330, 195, 80, 30, \ self.archivePackerButtonCancel) self.packer = htArchivePacker(self.filename) self.noeWnd.doModal()
def show(self): self.noeWnd = noewin.NoeUserWindow("Export options", "HTWindowClass", \ 300, 150) noeWindowRect = noewin.getNoesisWindowRect() if noeWindowRect: windowMargin = 64 self.noeWnd.x = noeWindowRect[0] + windowMargin self.noeWnd.y = noeWindowRect[1] + windowMargin if self.noeWnd.createWindow(): self.noeWnd.setFont("Arial", 12) self.noeWnd.createStatic("Choose game:", 5, 5, 160, 20) # choose game list index = self.noeWnd.createListBox(5, 25, 200, 47, None, 0) self.gameListBox = self.noeWnd.getControlByIndex(index) gameList = ("Hard Truck 1 (1.4)", "Hard Truck 2 (7.0 - 8.0)") for game in gameList: self.gameListBox.addString(game) self.gameListBox.selectString(gameList[1]) self.noeWnd.createStatic("Choose format:", 5, 70, 110, 20) # choose format combobox index = self.noeWnd.createComboBox(100, 67, 95, 20) self.formatComboBox = self.noeWnd.getControlByIndex(index) formatList = ("BGR 565", "BGRA 4444", "BGRA 5551") for format in formatList: self.formatComboBox.addString(format) self.formatComboBox.selectString(formatList[2]) index = self.noeWnd.createCheckBox("generate mip-maps", 5, 95, \ 135, 20) self.mipmapsCheckBox = self.noeWnd.getControlByIndex(index) #self.mipmapsCheckBox.setChecked(1) self.noeWnd.createButton("Export", 210, 25, 80, 30, \ self.exportOptionsButtonExport) self.noeWnd.createButton("Cancel", 210, 60, 80, 30, \ self.exportOptionsButtonCancel) self.noeWnd.doModal()
def create(self): self.noeWnd = noewin.NoeUserWindow("Load Ghost Recon character model", "openModelWindowClass", 430, 405) noeWindowRect = noewin.getNoesisWindowRect() if noeWindowRect: windowMargin = 100 self.noeWnd.x = noeWindowRect[0] + windowMargin self.noeWnd.y = noeWindowRect[1] + windowMargin if self.noeWnd.createWindow(): self.noeWnd.setFont("Arial", 14) self.noeWnd.createStatic("Path to texture folder", 5, 5, 140, 20) # index = self.noeWnd.createEditBox(5, 24, 330, 40, "", None, True) self.texturePathEditBox = self.noeWnd.getControlByIndex(index) self.noeWnd.createButton("Open", 340, 24, 80, 21, self.buttonGetTexturePathOnClick) self.noeWnd.createStatic("Path to actor (.act) file", 5, 70, 140, 20) # index = self.noeWnd.createEditBox(5, 90, 330, 40, "", None, True) self.actorFileNameEditBox = self.noeWnd.getControlByIndex(index) self.noeWnd.createButton("Open", 340, 90, 80, 21, self.buttonGetActorFileNameOnClick) self.noeWnd.createStatic("Path to .bmf files", 5, 140, 140, 20) # index = self.noeWnd.createEditBox(5, 160, 330, 20, "", None, False, False) self.bmfPathEditBox = self.noeWnd.getControlByIndex(index) self.noeWnd.createButton("Open", 340, 160, 80, 21, self.buttonGetAnimationListOnClick) self.noeWnd.createStatic("Animations:", 5, 190, 80, 20) index = self.noeWnd.createListBox(5, 210, 330, 175) self.animationListBox = self.noeWnd.getControlByIndex(index) self.noeWnd.createButton("Load", 340, 310, 80, 30, self.buttonLoadOnClick) self.noeWnd.createButton("Cancel", 340, 345, 80, 30, self.buttonCancelOnClick) self.noeWnd.doModal()
def neoPickToolMethod(toolIndex): filePath = noesis.getSelectedFile() nameNoExt, ext = os.path.splitext(filePath) neoPickPath = nameNoExt + "_neoPick" + ext noeMod = noesis.instantiateModule() noesis.setModuleRAPI(noeMod) with open(filePath, "rb") as f: data = f.read() noeWndWidth = 1280 noeWndHeight = 800 noeWndPad = 64 noeWnd = noewin.NoeUserWindow("NEOpicker", "NeoPickerWindowClass", noeWndWidth + noeWndPad, noeWndHeight + noeWndPad, neoPickWindowProc) noeWnd.showClipped = False noeWnd.drawWidth = noeWndWidth noeWnd.drawHeight = noeWndHeight noeWnd.imgCoordX = 0 noeWnd.imgCoordY = 0 noeWnd.clipAddrs = set([]) noeWnd.pickPath = neoPickPath if neoPickAttachNeoToNoeWnd(noeWnd, data): noeWnd.originalData = data #offset a bit into the noesis window noeWindowRect = noewin.getNoesisWindowRect() if noeWindowRect: windowMargin = 64 noeWnd.x = noeWindowRect[0] + windowMargin noeWnd.y = noeWindowRect[1] + windowMargin if noeWnd.createWindow(): noeWnd.doModal() noesis.freeModule(noeMod) return 0
def create(self): self.noeWnd = noewin.NoeUserWindow( \ "Load cyclone model file", "openModelWindowClass", 385, 195) noeWindowRect = noewin.getNoesisWindowRect() if noeWindowRect: windowMargin = 100 self.noeWnd.x = noeWindowRect[0] + windowMargin self.noeWnd.y = noeWindowRect[1] + windowMargin if self.noeWnd.createWindow(): self.noeWnd.setFont("Arial", 12) self.noeWnd.createStatic("Textures path:", 5, 5, 110, 20) # choose path to textures index = self.noeWnd.createEditBox(5, 28, 275, 20, "", None, False, True) self.texPathEditBox = self.noeWnd.getControlByIndex(index) # extenstion self.noeWnd.createStatic("extension:", 170, 5, 60, 20) index = self.noeWnd.createEditBox(240, 5, 40, 20, "", None, False) self.extEditBox = self.noeWnd.getControlByIndex(index) self.extEditBox.setText("tf") self.noeWnd.createStatic("Frame:", 5, 57, 80, 20) # choose frame number index = self.noeWnd.createEditBox(55, 55, 80, 20, "", None, False) self.frameEditBox = self.noeWnd.getControlByIndex(index) self.frameEditBox.setText("0") self.noeWnd.createStatic("LOD:", 160, 57, 80, 20) # choose lod index = self.noeWnd.createEditBox(200, 55, 80, 20, "", None, False) self.lodEditBox = self.noeWnd.getControlByIndex(index) self.lodEditBox.setText("0") # model info self.noeWnd.createStatic("lods:", 5, 85, 130, 20) index = self.noeWnd.createEditBox(60, 85, 50, 20, "", None, False, True) self.lodCountEditBox = self.noeWnd.getControlByIndex(index) self.lodCountEditBox.setText(str(self.model.modelCount)) self.noeWnd.createStatic("textures:", 5, 105, 130, 20) index = self.noeWnd.createEditBox(60, 105, 50, 20, "", None, False, True) self.textureCountEditBox = self.noeWnd.getControlByIndex(index) self.textureCountEditBox.setText(str(self.model.textureCount)) self.noeWnd.createStatic("meshes:", 145, 85, 130, 20) index = self.noeWnd.createEditBox(200, 85, 50, 20, "", None, False, True) self.meshCountEditBox = self.noeWnd.getControlByIndex(index) self.meshCountEditBox.setText(str(len(self.model.lods[0].meshes))) self.noeWnd.createStatic("frames:", 145, 105, 130, 20) index = self.noeWnd.createEditBox(200, 105, 50, 20, "", None, False, True) self.frameCountEditBox = self.noeWnd.getControlByIndex(index) self.frameCountEditBox.setText(str(self.model.frameCount)) self.noeWnd.createButton("Open", 290, 27, 80, 21, \ self.sdmodelViewButtonGetPath) self.noeWnd.createButton("Load", 5, 135, 80, 30, \ self.sdmodelViewButtonLoad) self.noeWnd.createButton("Cancel", 90, 135, 80, 30, \ self.sdmodelViewButtonCancel) self.noeWnd.doModal()
def f2aToolMethod(toolIndex): noesis.logPopup() handle = noesis.usbOpenDevice(F2A_DEVINTGUID, F2A_CLASSGUID) riskIt = (user32.MessageBoxW( noesis.getWindowHandle(), "Found what appears to be the target F2A device. However, if this is not the correct device, the device could be damaged. Are you sure you want to continue?", "F2A Interface", noewin.MB_YESNO) == noewin.IDYES) if riskIt: if noesis.usbGetEndpointCount(handle) == 0: #try uploading the ez-usb firmware, then reconnect print( "Endpoint count is 0, attempting vendor-specific EZ-USB FW upload." ) #usbControlTransfer params = handle, data, requestType, request, index, value noesis.usbControlTransfer(handle, bytearray([0x01]), 0x40, 0xA0, 0, 0x7F92) fw = loadBin(F2A_EZUSBFW) chunkSize = 512 for offset in range(0, len(fw) // chunkSize): chunkData = fw[offset * chunkSize:offset * chunkSize + chunkSize] noesis.usbControlTransfer(handle, chunkData, 0x40, 0xA0, 0, offset * chunkSize) #upload complete noesis.usbControlTransfer(handle, bytearray([0x00]), 0x40, 0xA0, 0, 0x7F92) time.sleep(1) noesis.usbCloseDevice(handle) handle = None #spin here for a bit - uploading the firmware effectively reconnects the device with a different interface, #so it may take a little while for Windows to prepare it again. for attemptCount in range(0, F2A_RECONNECT_LIMIT): try: handle = noesis.usbOpenDevice(F2A_DEVINTGUID, F2A_CLASSGUID) print("Successfully re-opened device.") break except: print( "Cannot re-open device. Waiting before trying again.") time.sleep(3) if handle is None: noesis.messagePrompt( "Could not re-establish connection to device. Aborting.") elif noesis.usbGetEndpointCount(handle) != 5: noesis.messagePrompt( "The device does not have the expected number of endpoints. Aborting." ) else: noesis.usbSetEndpointTimeoutId(handle, F2A_EP_WRITE, F2A_EP_TIMEOUT) noesis.usbSetEndpointTimeoutId(handle, F2A_EP_READ, F2A_EP_TIMEOUT) response = getDeviceStatus(handle) while response[0] != F2A_STATUS_NOTREADY: tryAgain = (user32.MessageBoxW( noesis.getWindowHandle(), "Your GBA must be turned off to continue. Ready to try again?", "F2A Interface", noewin.MB_YESNO) == noewin.IDYES) if not tryAgain: break response = getDeviceStatus(handle) if response[0] == F2A_STATUS_NOTREADY: mb = loadBin(F2A_MULTIBOOT) bootCmd = F2ACommand() #if we don't do this bit, the linker gets angry again and stops accepting writes. particular to my hardware/firmware? bootCmd.fromBytes(response) bootCmd.command |= F2A_CMD_GETINF #keep the high bytes from the response data noesis.usbWriteEndpointId(handle, F2A_EP_WRITE, bootCmd.getBytes()) response = noesis.usbReadEndpointId(handle, F2A_EP_READ, F2A_RESPONSE_SIZE) noesis.usbSetEndpointTimeoutId(handle, F2A_EP_WRITE, F2A_EP_BOOTWAIT_TIMEOUT) readyToGo = (user32.MessageBoxW( noesis.getWindowHandle(), "After continuing (do not turn the GBA on before proceeding), you will connect your GBA, turn it on, and hold start+select during startup. Are you ready?", "F2A Interface", noewin.MB_YESNO) == noewin.IDYES) if readyToGo: #make sure they didn't turn it on prematurely response = getDeviceStatus(handle) if response[0] == F2A_STATUS_READY: readyToGo = False noesis.messagePrompt( "You turned the GBA on prematurely. Aborting.") if readyToGo: #spin until we detect the GBA is on, then take a run at it response = getDeviceStatus(handle) while response[0] != F2A_STATUS_READY: time.sleep(0.1) response = getDeviceStatus(handle) bootCmd.command = F2A_CMD_MULTIBOOT1 bootCmd.dataSize = 0 bootCmd.reserved0 &= ~255 noesis.usbWriteEndpointId(handle, F2A_EP_WRITE, bootCmd.getBytes()) bootCmd.command = F2A_CMD_MULTIBOOT2 bootCmd.dataSize = len( mb ) #my sniffing reveals this is actually 1024 bytes less than the data sent. writer bug? noesis.usbWriteEndpointId(handle, F2A_EP_WRITE, bootCmd.getBytes()) writeSize = chunkedWrite(handle, mb) print("MB write:", writeSize, "/", len(mb)) if writeSize != len(mb): noesis.messagePrompt( "Could not upload multiboot image. Aborting.") else: noesis.usbSetEndpointTimeoutId(handle, F2A_EP_WRITE, F2A_EP_TIMEOUT) #just write black to the background. sniffed out the original bg, or we could make our own, but eh. bgCmd = F2ACommand() bgCmd.magic = F2A_MAGIC bgCmd.address = F2A_TARGET_VRAM bgCmd.command = F2A_CMD_WRITEDATA bgCmd.subCommand = F2A_SUBCMD_WRITE bgCmd.dataSize = 76800 #packet sniffing shows this to be size & 0xFFFF, does it matter? (doesn't seem to) bgCmd.dataSizeKb = 76800 // 1024 noesis.usbWriteEndpointId(handle, F2A_EP_WRITE, bgCmd.getBytes()) bgUploadSize = 0 for offset in range(0, bgCmd.dataSizeKb): chunkSize = noesis.usbWriteEndpointId( handle, F2A_EP_WRITE, bytearray([0] * 1024)) if chunkSize < 0: break bgUploadSize += chunkSize print("BG write:", bgUploadSize) time.sleep(1) noeWnd = noewin.NoeUserWindow("F2A Interface", "F2AWindowClass", 644, 300) #offset a bit into the noesis window noeWindowRect = noewin.getNoesisWindowRect() if noeWindowRect: windowMargin = 64 noeWnd.x = noeWindowRect[0] + windowMargin noeWnd.y = noeWindowRect[1] + windowMargin if noeWnd.createWindow(): noeWnd.usbHandle = handle createInterfaceWindow(noeWnd) noeWnd.doModal() if handle: noesis.usbCloseDevice(handle) return 0