diff --git a/README.md b/README.md index d126431..5c27cac 100644 --- a/README.md +++ b/README.md @@ -32,11 +32,11 @@ Sometimes I add new posts about this project [on my home page](https://developer * Information, ideas and data from ['fusee-launcher'](https://github.com/reswitched/fusee-launcher) application * [Apache Commons CLI](https://commons.apache.org/proper/commons-cli/) -#### List of awesome contributors! +### List of awesome code contributors, translators and other great people! +* [Pablo Curiel (DarkMatterCore)](https://github.com/DarkMatterCore) * [wolfposd](https://github.com/wolfposd) -#### Thanks for the great work done by our translators! * French by [Stephane Meden (JackFromNice)](https://github.com/JackFromNice) * Italian by [unbranched](https://github.com/unbranched) diff --git a/src/main/java/nsusbloader/Utilities/nxdumptool/NxdtUsbAbi1.java b/src/main/java/nsusbloader/Utilities/nxdumptool/NxdtUsbAbi1.java index e51622b..dd2a1bc 100644 --- a/src/main/java/nsusbloader/Utilities/nxdumptool/NxdtUsbAbi1.java +++ b/src/main/java/nsusbloader/Utilities/nxdumptool/NxdtUsbAbi1.java @@ -287,11 +287,9 @@ class NxdtUsbAbi1 { long received = 0; int bufferSize; - boolean zlt_expected = isAligned(size); - - while (received < size) { + while (received+NXDT_FILE_CHUNK_SIZE < size) { //readBuffer = readUsbFile(); - readBuffer = readUsbFileDebug(); + readBuffer = readUsbFileDebug(NXDT_FILE_CHUNK_SIZE); bos.write(readBuffer); if (isWindows10) fd.sync(); @@ -300,20 +298,20 @@ class NxdtUsbAbi1 { logPrinter.updateProgress((double)received / (double)size); } - - if (zlt_expected) { - logPrinter.print("Finishing with ZLT packet request", EMsgType.INFO); - //readUsbFile(); - readUsbFileDebug(); - } + int lastChunkSize = (int)(size - received) + 1; + readBuffer = readUsbFileDebug(lastChunkSize); + bos.write(readBuffer); + if (isWindows10) + fd.sync(); } finally { logPrinter.updateProgress(1.0); } } - /** Handle Zero-length terminator **/ + /* Handle Zero-length terminator private boolean isAligned(long size){ return ((size & (endpointMaxPacketSize - 1)) == 0); } + */ /** Sending any byte array to USB device **/ private void writeUsb(byte[] message) throws Exception{ @@ -397,8 +395,8 @@ class NxdtUsbAbi1 { throw new InterruptedException(); } - private byte[] readUsbFileDebug() throws Exception { - ByteBuffer readBuffer = ByteBuffer.allocateDirect(NXDT_FILE_CHUNK_SIZE); + private byte[] readUsbFileDebug(int chunkSize) throws Exception { + ByteBuffer readBuffer = ByteBuffer.allocateDirect(chunkSize); IntBuffer readBufTransferred = IntBuffer.allocate(1); if (parent.isCancelled()) throw new InterruptedException();