Add updated brazilian portuguese translation by @almircanella! #64

Refactor NETCommunications. Not it's readable :D
A lot of small changes, code refactoring, updates and fixes.
This commit is contained in:
Dmitry Isaenko 2020-07-10 16:57:29 +03:00
parent 96e85056dd
commit 267ffcf5d2
22 changed files with 553 additions and 522 deletions

View file

@ -18,7 +18,6 @@
*/
package nsusbloader.COM.USB;
import nsusbloader.COM.INSTask;
import nsusbloader.ModelControllers.ILogPrinter;
import nsusbloader.NSLDataTypes.EFileStatus;
import nsusbloader.NSLDataTypes.EMsgType;
@ -48,7 +47,7 @@ class TinFoil extends TransferModule {
/* byte[] magic = new byte[4];
ByteBuffer bb = StandardCharsets.UTF_8.encode("TUC0").rewind().get(magic); // Let's rephrase this 'string' */
TinFoil(DeviceHandle handler, LinkedHashMap<String, File> nspMap, INSTask task, ILogPrinter logPrinter){
TinFoil(DeviceHandle handler, LinkedHashMap<String, File> nspMap, Runnable task, ILogPrinter logPrinter){
super(handler, nspMap, task, logPrinter);
logPrinter.print("============= Tinfoil =============", EMsgType.INFO);
@ -305,7 +304,7 @@ class TinFoil extends TransferModule {
IntBuffer writeBufTransferred = IntBuffer.allocate(1);
int result;
//int varVar = 0; //todo:remove
while (! task.isCancelled()) {
while (! Thread.interrupted() ) {
/*
if (varVar != 0)
logPrinter.print("writeUsb() retry cnt: "+varVar, EMsgType.INFO); //NOTE: DEBUG
@ -345,7 +344,7 @@ class TinFoil extends TransferModule {
// We can limit it to 32 bytes, but there is a non-zero chance to got OVERFLOW from libusb.
IntBuffer readBufTransferred = IntBuffer.allocate(1);
int result;
while (! task.isCancelled()) {
while (! Thread.interrupted()) {
result = LibUsb.bulkTransfer(handlerNS, (byte) 0x81, readBuffer, readBufTransferred, 1000); // last one is TIMEOUT. 0 stands for unlimited. Endpoint IN = 0x81
switch (result) {