Skip to content

Commit adabfbe

Browse files
committed
NXDT-related updates
1 parent ba4afa0 commit adabfbe

File tree

2 files changed

+13
-15
lines changed

2 files changed

+13
-15
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ Sometimes I add new posts about this project [on my home page](https://developer
3232
* Information, ideas and data from ['fusee-launcher'](https://github.com/reswitched/fusee-launcher) application
3333
* [Apache Commons CLI](https://commons.apache.org/proper/commons-cli/)
3434

35-
#### List of awesome contributors!
35+
### List of awesome code contributors, translators and other great people!
3636

37+
* [Pablo Curiel (DarkMatterCore)](https://github.com/DarkMatterCore)
3738
* [wolfposd](https://github.com/wolfposd)
3839

39-
#### Thanks for the great work done by our translators!
4040

4141
* French by [Stephane Meden (JackFromNice)](https://github.com/JackFromNice)
4242
* Italian by [unbranched](https://github.com/unbranched)

src/main/java/nsusbloader/Utilities/nxdumptool/NxdtUsbAbi1.java

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -287,11 +287,9 @@ private void dumpFile(File file, long size) throws Exception{
287287
long received = 0;
288288
int bufferSize;
289289

290-
boolean zlt_expected = isAligned(size);
291-
292-
while (received < size) {
290+
while (received+NXDT_FILE_CHUNK_SIZE < size) {
293291
//readBuffer = readUsbFile();
294-
readBuffer = readUsbFileDebug();
292+
readBuffer = readUsbFileDebug(NXDT_FILE_CHUNK_SIZE);
295293
bos.write(readBuffer);
296294
if (isWindows10)
297295
fd.sync();
@@ -300,20 +298,20 @@ private void dumpFile(File file, long size) throws Exception{
300298

301299
logPrinter.updateProgress((double)received / (double)size);
302300
}
303-
304-
if (zlt_expected) {
305-
logPrinter.print("Finishing with ZLT packet request", EMsgType.INFO);
306-
//readUsbFile();
307-
readUsbFileDebug();
308-
}
301+
int lastChunkSize = (int)(size - received) + 1;
302+
readBuffer = readUsbFileDebug(lastChunkSize);
303+
bos.write(readBuffer);
304+
if (isWindows10)
305+
fd.sync();
309306
} finally {
310307
logPrinter.updateProgress(1.0);
311308
}
312309
}
313-
/** Handle Zero-length terminator **/
310+
/* Handle Zero-length terminator
314311
private boolean isAligned(long size){
315312
return ((size & (endpointMaxPacketSize - 1)) == 0);
316313
}
314+
*/
317315

318316
/** Sending any byte array to USB device **/
319317
private void writeUsb(byte[] message) throws Exception{
@@ -397,8 +395,8 @@ private byte[] readUsbFile() throws Exception{
397395
throw new InterruptedException();
398396
}
399397

400-
private byte[] readUsbFileDebug() throws Exception {
401-
ByteBuffer readBuffer = ByteBuffer.allocateDirect(NXDT_FILE_CHUNK_SIZE);
398+
private byte[] readUsbFileDebug(int chunkSize) throws Exception {
399+
ByteBuffer readBuffer = ByteBuffer.allocateDirect(chunkSize);
402400
IntBuffer readBufTransferred = IntBuffer.allocate(1);
403401
if (parent.isCancelled())
404402
throw new InterruptedException();

0 commit comments

Comments
 (0)