Formatting, optimize imports

This commit is contained in:
Maschell 2022-02-01 23:54:17 +01:00
parent 2793c02246
commit a3f9dcb648
22 changed files with 129 additions and 150 deletions

View File

@ -1,5 +1,13 @@
package de.mas.wiiu.jnus.fuse_wiiu; package de.mas.wiiu.jnus.fuse_wiiu;
import de.mas.wiiu.jnus.fuse_wiiu.implementation.GroupFuseContainer;
import de.mas.wiiu.jnus.fuse_wiiu.implementation.GroupFuseContainerDefault;
import de.mas.wiiu.jnus.fuse_wiiu.interfaces.FuseContainer;
import de.mas.wiiu.jnus.fuse_wiiu.utils.FuseContainerWrapper;
import de.mas.wiiu.jnus.utils.HashUtil;
import de.mas.wiiu.jnus.utils.Utils;
import org.apache.commons.cli.*;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.nio.charset.Charset; import java.nio.charset.Charset;
@ -9,20 +17,6 @@ import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.Optional; import java.util.Optional;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
import org.apache.commons.cli.DefaultParser;
import org.apache.commons.cli.HelpFormatter;
import org.apache.commons.cli.Option;
import org.apache.commons.cli.Options;
import de.mas.wiiu.jnus.fuse_wiiu.implementation.GroupFuseContainer;
import de.mas.wiiu.jnus.fuse_wiiu.implementation.GroupFuseContainerDefault;
import de.mas.wiiu.jnus.fuse_wiiu.interfaces.FuseContainer;
import de.mas.wiiu.jnus.fuse_wiiu.utils.FuseContainerWrapper;
import de.mas.wiiu.jnus.utils.HashUtil;
import de.mas.wiiu.jnus.utils.Utils;
public class Main { public class Main {
private static final String DEV_COMMON_KEY = "devcommon.key"; private static final String DEV_COMMON_KEY = "devcommon.key";
private static final String COMMON_KEY = "common.key"; private static final String COMMON_KEY = "common.key";
@ -168,7 +162,7 @@ public class Main {
} }
RootFuseFS stub = new RootFuseFS(root); RootFuseFS stub = new RootFuseFS(root);
try { try {
System.out.println("Mounting " + new File(inputPath).getAbsolutePath() + " to " + mount.getAbsolutePath()); System.out.println("Mounting " + new File(inputPath).getAbsolutePath() + " to " + mount.getAbsolutePath());
stub.mount(mount.toPath(), true, false); stub.mount(mount.toPath(), true, false);
} finally { } finally {

View File

@ -1,13 +1,13 @@
package de.mas.wiiu.jnus.fuse_wiiu; package de.mas.wiiu.jnus.fuse_wiiu;
import java.io.File;
import de.mas.wiiu.jnus.utils.Utils; import de.mas.wiiu.jnus.utils.Utils;
import java.io.File;
public class Settings { public class Settings {
public static File disckeyPath = null;
public static final byte[] retailCommonKeyHash = Utils.StringToByteArray("6A0B87FC98B306AE3366F0E0A88D0B06A2813313"); public static final byte[] retailCommonKeyHash = Utils.StringToByteArray("6A0B87FC98B306AE3366F0E0A88D0B06A2813313");
public static final byte[] devCommonKeyHash = Utils.StringToByteArray("E191BFDB1232537D7DADEAD81F2A48FD6F188E02"); public static final byte[] devCommonKeyHash = Utils.StringToByteArray("E191BFDB1232537D7DADEAD81F2A48FD6F188E02");
public static File disckeyPath = null;
public static File titlekeyPath = null; public static File titlekeyPath = null;
public static byte[] retailCommonKey = new byte[16]; public static byte[] retailCommonKey = new byte[16];
public static byte[] devCommonKey = new byte[16]; public static byte[] devCommonKey = new byte[16];

View File

@ -1,19 +1,14 @@
package de.mas.wiiu.jnus.fuse_wiiu.implementation; package de.mas.wiiu.jnus.fuse_wiiu.implementation;
import java.io.File;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Optional;
import java.util.Timer;
import java.util.TimerTask;
import de.mas.wiiu.jnus.fuse_wiiu.interfaces.FuseContainer; import de.mas.wiiu.jnus.fuse_wiiu.interfaces.FuseContainer;
import de.mas.wiiu.jnus.fuse_wiiu.interfaces.FuseDirectory; import de.mas.wiiu.jnus.fuse_wiiu.interfaces.FuseDirectory;
import de.mas.wiiu.jnus.fuse_wiiu.utils.FuseContainerWrapper; import de.mas.wiiu.jnus.fuse_wiiu.utils.FuseContainerWrapper;
import lombok.val; import lombok.val;
import java.io.File;
import java.util.*;
import java.util.Map.Entry;
/** /**
* Representation of a directory on the OS filesystem. For every children of this directory the FuseContainerWrapper is used to create children if needed. * Representation of a directory on the OS filesystem. For every children of this directory the FuseContainerWrapper is used to create children if needed.
* *

View File

@ -1,8 +1,5 @@
package de.mas.wiiu.jnus.fuse_wiiu.implementation; package de.mas.wiiu.jnus.fuse_wiiu.implementation;
import java.util.Optional;
import java.util.function.Supplier;
import de.mas.wiiu.jnus.entities.FST.nodeentry.DirectoryEntry; import de.mas.wiiu.jnus.entities.FST.nodeentry.DirectoryEntry;
import de.mas.wiiu.jnus.entities.FST.nodeentry.FileEntry; import de.mas.wiiu.jnus.entities.FST.nodeentry.FileEntry;
import de.mas.wiiu.jnus.entities.FST.nodeentry.NodeEntry; import de.mas.wiiu.jnus.entities.FST.nodeentry.NodeEntry;
@ -17,6 +14,9 @@ import ru.serce.jnrfuse.FuseFillDir;
import ru.serce.jnrfuse.struct.FileStat; import ru.serce.jnrfuse.struct.FileStat;
import ru.serce.jnrfuse.struct.FuseFileInfo; import ru.serce.jnrfuse.struct.FuseFileInfo;
import java.util.Optional;
import java.util.function.Supplier;
/** /**
* FuseContainer implementation based on a FSTDataProvider. * FuseContainer implementation based on a FSTDataProvider.
* *

View File

@ -1,12 +1,5 @@
package de.mas.wiiu.jnus.fuse_wiiu.implementation; package de.mas.wiiu.jnus.fuse_wiiu.implementation;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import java.util.Map.Entry;
import java.util.function.BiFunction;
import java.util.stream.Collectors;
import de.mas.wiiu.jnus.fuse_wiiu.interfaces.FuseContainer; import de.mas.wiiu.jnus.fuse_wiiu.interfaces.FuseContainer;
import de.mas.wiiu.jnus.fuse_wiiu.interfaces.FuseDirectory; import de.mas.wiiu.jnus.fuse_wiiu.interfaces.FuseDirectory;
import jnr.ffi.Pointer; import jnr.ffi.Pointer;
@ -17,11 +10,17 @@ import ru.serce.jnrfuse.FuseFillDir;
import ru.serce.jnrfuse.struct.FileStat; import ru.serce.jnrfuse.struct.FileStat;
import ru.serce.jnrfuse.struct.FuseFileInfo; import ru.serce.jnrfuse.struct.FuseFileInfo;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Optional;
import java.util.function.BiFunction;
import java.util.stream.Collectors;
/** /**
* Implementation of an FuseContainer which can hold serveral FuseContainers emulated as directories. * Implementation of an FuseContainer which can hold serveral FuseContainers emulated as directories.
*
* @author Maschell
* *
* @author Maschell
*/ */
public abstract class GroupFuseContainer implements FuseContainer { public abstract class GroupFuseContainer implements FuseContainer {
private final Map<String, FuseContainer> containerMap = new HashMap<>(); private final Map<String, FuseContainer> containerMap = new HashMap<>();

View File

@ -1,13 +1,13 @@
package de.mas.wiiu.jnus.fuse_wiiu.implementation; package de.mas.wiiu.jnus.fuse_wiiu.implementation;
import java.util.Optional;
import de.mas.wiiu.jnus.fuse_wiiu.interfaces.FuseDirectory; import de.mas.wiiu.jnus.fuse_wiiu.interfaces.FuseDirectory;
import java.util.Optional;
/** /**
* Default GroupFuseContainer implementation * Default GroupFuseContainer implementation
* @author Maschell
* *
* @author Maschell
*/ */
public class GroupFuseContainerDefault extends GroupFuseContainer { public class GroupFuseContainerDefault extends GroupFuseContainer {

View File

@ -1,9 +1,5 @@
package de.mas.wiiu.jnus.fuse_wiiu.implementation; package de.mas.wiiu.jnus.fuse_wiiu.implementation;
import java.io.File;
import java.io.IOException;
import java.util.Optional;
import de.mas.wiiu.jnus.NUSTitle; import de.mas.wiiu.jnus.NUSTitle;
import de.mas.wiiu.jnus.NUSTitleLoaderLocalBackup; import de.mas.wiiu.jnus.NUSTitleLoaderLocalBackup;
import de.mas.wiiu.jnus.entities.Ticket; import de.mas.wiiu.jnus.entities.Ticket;
@ -13,6 +9,10 @@ import de.mas.wiiu.jnus.fuse_wiiu.utils.TicketUtils;
import de.mas.wiiu.jnus.implementations.FSTDataProviderNUSTitle; import de.mas.wiiu.jnus.implementations.FSTDataProviderNUSTitle;
import de.mas.wiiu.jnus.utils.Utils; import de.mas.wiiu.jnus.utils.Utils;
import java.io.File;
import java.io.IOException;
import java.util.Optional;
public class LocalBackupNUSTitleContainer extends GroupFuseContainer { public class LocalBackupNUSTitleContainer extends GroupFuseContainer {
private File folder; private File folder;

View File

@ -1,19 +1,19 @@
package de.mas.wiiu.jnus.fuse_wiiu.implementation; package de.mas.wiiu.jnus.fuse_wiiu.implementation;
import de.mas.wiiu.jnus.NUSTitle;
import de.mas.wiiu.jnus.NUSTitleLoaderLocal;
import de.mas.wiiu.jnus.entities.TMD.TitleMetaData;
import de.mas.wiiu.jnus.entities.Ticket;
import de.mas.wiiu.jnus.fuse_wiiu.Settings;
import de.mas.wiiu.jnus.fuse_wiiu.interfaces.FuseDirectory;
import de.mas.wiiu.jnus.fuse_wiiu.utils.TicketUtils;
import de.mas.wiiu.jnus.implementations.FSTDataProviderNUSTitle;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.text.ParseException; import java.text.ParseException;
import java.util.Optional; import java.util.Optional;
import de.mas.wiiu.jnus.NUSTitle;
import de.mas.wiiu.jnus.NUSTitleLoaderLocal;
import de.mas.wiiu.jnus.entities.Ticket;
import de.mas.wiiu.jnus.entities.TMD.TitleMetaData;
import de.mas.wiiu.jnus.fuse_wiiu.Settings;
import de.mas.wiiu.jnus.fuse_wiiu.interfaces.FuseDirectory;
import de.mas.wiiu.jnus.fuse_wiiu.utils.TicketUtils;
import de.mas.wiiu.jnus.implementations.FSTDataProviderNUSTitle;
public class LocalNUSTitleContainer extends GroupFuseContainer { public class LocalNUSTitleContainer extends GroupFuseContainer {
private File folder; private File folder;

View File

@ -1,14 +1,14 @@
package de.mas.wiiu.jnus.fuse_wiiu.implementation; package de.mas.wiiu.jnus.fuse_wiiu.implementation;
import java.io.File;
import java.util.List;
import java.util.Optional;
import de.mas.wiiu.jnus.fuse_wiiu.interfaces.FSTDataProviderLoader; import de.mas.wiiu.jnus.fuse_wiiu.interfaces.FSTDataProviderLoader;
import de.mas.wiiu.jnus.fuse_wiiu.interfaces.FuseDirectory; import de.mas.wiiu.jnus.fuse_wiiu.interfaces.FuseDirectory;
import de.mas.wiiu.jnus.interfaces.FSTDataProvider; import de.mas.wiiu.jnus.interfaces.FSTDataProvider;
import lombok.val; import lombok.val;
import java.io.File;
import java.util.List;
import java.util.Optional;
public class MultipleFSTDataProviderFuseContainer<T> extends GroupFuseContainer { public class MultipleFSTDataProviderFuseContainer<T> extends GroupFuseContainer {
private final File file; private final File file;
private final FSTDataProviderLoader<T> loader; private final FSTDataProviderLoader<T> loader;

View File

@ -1,11 +1,5 @@
package de.mas.wiiu.jnus.fuse_wiiu.implementation; package de.mas.wiiu.jnus.fuse_wiiu.implementation;
import java.io.File;
import java.io.IOException;
import java.text.ParseException;
import java.util.List;
import java.util.Optional;
import de.mas.wiiu.jnus.NUSTitleLoaderFST; import de.mas.wiiu.jnus.NUSTitleLoaderFST;
import de.mas.wiiu.jnus.entities.FST.nodeentry.DirectoryEntry; import de.mas.wiiu.jnus.entities.FST.nodeentry.DirectoryEntry;
import de.mas.wiiu.jnus.entities.FST.nodeentry.FileEntry; import de.mas.wiiu.jnus.entities.FST.nodeentry.FileEntry;
@ -17,6 +11,12 @@ import de.mas.wiiu.jnus.interfaces.FSTDataProvider;
import de.mas.wiiu.jnus.interfaces.HasNUSTitle; import de.mas.wiiu.jnus.interfaces.HasNUSTitle;
import de.mas.wiiu.jnus.utils.FSTUtils; import de.mas.wiiu.jnus.utils.FSTUtils;
import java.io.File;
import java.io.IOException;
import java.text.ParseException;
import java.util.List;
import java.util.Optional;
public class MultipleFSTDataProviderRecursiveFuseContainer<T> extends MultipleFSTDataProviderFuseContainer<T> { public class MultipleFSTDataProviderRecursiveFuseContainer<T> extends MultipleFSTDataProviderFuseContainer<T> {
public MultipleFSTDataProviderRecursiveFuseContainer(Optional<FuseDirectory> parent, File input, FSTDataProviderLoader<T> loader) { public MultipleFSTDataProviderRecursiveFuseContainer(Optional<FuseDirectory> parent, File input, FSTDataProviderLoader<T> loader) {
super(parent, input, loader); super(parent, input, loader);

View File

@ -1,11 +1,5 @@
package de.mas.wiiu.jnus.fuse_wiiu.implementation; package de.mas.wiiu.jnus.fuse_wiiu.implementation;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.function.Supplier;
import de.mas.wiiu.jnus.NUSTitle; import de.mas.wiiu.jnus.NUSTitle;
import de.mas.wiiu.jnus.entities.TMD.Content; import de.mas.wiiu.jnus.entities.TMD.Content;
import de.mas.wiiu.jnus.fuse_wiiu.interfaces.FuseContainer; import de.mas.wiiu.jnus.fuse_wiiu.interfaces.FuseContainer;
@ -16,6 +10,12 @@ import ru.serce.jnrfuse.FuseFillDir;
import ru.serce.jnrfuse.struct.FileStat; import ru.serce.jnrfuse.struct.FileStat;
import ru.serce.jnrfuse.struct.FuseFileInfo; import ru.serce.jnrfuse.struct.FuseFileInfo;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.function.Supplier;
public class NUSTitleEncryptedFuseContainer implements FuseContainer { public class NUSTitleEncryptedFuseContainer implements FuseContainer {
private final Optional<FuseDirectory> parent; private final Optional<FuseDirectory> parent;
private final NUSTitle title; private final NUSTitle title;

View File

@ -1,9 +1,5 @@
package de.mas.wiiu.jnus.fuse_wiiu.implementation; package de.mas.wiiu.jnus.fuse_wiiu.implementation;
import java.io.File;
import java.io.IOException;
import java.util.Optional;
import de.mas.wiiu.jnus.NUSTitle; import de.mas.wiiu.jnus.NUSTitle;
import de.mas.wiiu.jnus.NUSTitleLoaderRemoteLocal; import de.mas.wiiu.jnus.NUSTitleLoaderRemoteLocal;
import de.mas.wiiu.jnus.entities.Ticket; import de.mas.wiiu.jnus.entities.Ticket;
@ -13,6 +9,10 @@ import de.mas.wiiu.jnus.fuse_wiiu.utils.TicketUtils;
import de.mas.wiiu.jnus.implementations.FSTDataProviderNUSTitle; import de.mas.wiiu.jnus.implementations.FSTDataProviderNUSTitle;
import de.mas.wiiu.jnus.utils.Utils; import de.mas.wiiu.jnus.utils.Utils;
import java.io.File;
import java.io.IOException;
import java.util.Optional;
public class RemoteLocalBackupNUSTitleContainer extends GroupFuseContainer { public class RemoteLocalBackupNUSTitleContainer extends GroupFuseContainer {
private File folder; private File folder;

View File

@ -1,9 +1,5 @@
package de.mas.wiiu.jnus.fuse_wiiu.implementation; package de.mas.wiiu.jnus.fuse_wiiu.implementation;
import java.io.File;
import java.io.IOException;
import java.util.Optional;
import de.mas.wiiu.jnus.fuse_wiiu.interfaces.FuseContainer; import de.mas.wiiu.jnus.fuse_wiiu.interfaces.FuseContainer;
import de.mas.wiiu.jnus.fuse_wiiu.interfaces.FuseDirectory; import de.mas.wiiu.jnus.fuse_wiiu.interfaces.FuseDirectory;
import de.mas.wiiu.jnus.fuse_wiiu.utils.WUDUtils; import de.mas.wiiu.jnus.fuse_wiiu.utils.WUDUtils;
@ -15,6 +11,10 @@ import ru.serce.jnrfuse.FuseFillDir;
import ru.serce.jnrfuse.struct.FileStat; import ru.serce.jnrfuse.struct.FileStat;
import ru.serce.jnrfuse.struct.FuseFileInfo; import ru.serce.jnrfuse.struct.FuseFileInfo;
import java.io.File;
import java.io.IOException;
import java.util.Optional;
public class WUDToWUDContainer implements FuseContainer { public class WUDToWUDContainer implements FuseContainer {
private final String filename; private final String filename;
private final Optional<WiiUDisc> wudInfo; private final Optional<WiiUDisc> wudInfo;

View File

@ -1,12 +1,12 @@
package de.mas.wiiu.jnus.fuse_wiiu.implementation; package de.mas.wiiu.jnus.fuse_wiiu.implementation;
import java.io.File;
import java.util.Optional;
import de.mas.wiiu.jnus.NUSTitleLoaderWoomy; import de.mas.wiiu.jnus.NUSTitleLoaderWoomy;
import de.mas.wiiu.jnus.fuse_wiiu.interfaces.FuseDirectory; import de.mas.wiiu.jnus.fuse_wiiu.interfaces.FuseDirectory;
import de.mas.wiiu.jnus.implementations.FSTDataProviderNUSTitle; import de.mas.wiiu.jnus.implementations.FSTDataProviderNUSTitle;
import java.io.File;
import java.util.Optional;
public class WoomyNUSTitleContainer extends GroupFuseContainer { public class WoomyNUSTitleContainer extends GroupFuseContainer {
private final File file; private final File file;

View File

@ -1,12 +1,5 @@
package de.mas.wiiu.jnus.fuse_wiiu.implementation.loader; package de.mas.wiiu.jnus.fuse_wiiu.implementation.loader;
import java.io.File;
import java.io.IOException;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import de.mas.wiiu.jnus.WUDLoader; import de.mas.wiiu.jnus.WUDLoader;
import de.mas.wiiu.jnus.fuse_wiiu.Settings; import de.mas.wiiu.jnus.fuse_wiiu.Settings;
import de.mas.wiiu.jnus.fuse_wiiu.interfaces.FSTDataProviderLoader; import de.mas.wiiu.jnus.fuse_wiiu.interfaces.FSTDataProviderLoader;
@ -15,13 +8,20 @@ import de.mas.wiiu.jnus.implementations.wud.WiiUDisc;
import de.mas.wiiu.jnus.interfaces.FSTDataProvider; import de.mas.wiiu.jnus.interfaces.FSTDataProvider;
import lombok.Getter; import lombok.Getter;
import java.io.File;
import java.io.IOException;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
public class WUDFSTDataProviderLoader implements FSTDataProviderLoader<WiiUDisc> { public class WUDFSTDataProviderLoader implements FSTDataProviderLoader<WiiUDisc> {
@Getter @Getter
private static WUDFSTDataProviderLoader instance = new WUDFSTDataProviderLoader(); private static final WUDFSTDataProviderLoader instance = new WUDFSTDataProviderLoader();
private WUDFSTDataProviderLoader() { private WUDFSTDataProviderLoader() {
} }
@Override @Override
public List<FSTDataProvider> getDataProvider(WiiUDisc info) { public List<FSTDataProvider> getDataProvider(WiiUDisc info) {
List<FSTDataProvider> dps = new ArrayList<>(); List<FSTDataProvider> dps = new ArrayList<>();

View File

@ -1,12 +1,5 @@
package de.mas.wiiu.jnus.fuse_wiiu.implementation.loader; package de.mas.wiiu.jnus.fuse_wiiu.implementation.loader;
import java.io.File;
import java.io.IOException;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import de.mas.wiiu.jnus.WumadLoader; import de.mas.wiiu.jnus.WumadLoader;
import de.mas.wiiu.jnus.fuse_wiiu.Settings; import de.mas.wiiu.jnus.fuse_wiiu.Settings;
import de.mas.wiiu.jnus.fuse_wiiu.interfaces.FSTDataProviderLoader; import de.mas.wiiu.jnus.fuse_wiiu.interfaces.FSTDataProviderLoader;
@ -14,13 +7,20 @@ import de.mas.wiiu.jnus.implementations.wud.wumad.WumadInfo;
import de.mas.wiiu.jnus.interfaces.FSTDataProvider; import de.mas.wiiu.jnus.interfaces.FSTDataProvider;
import lombok.Getter; import lombok.Getter;
import java.io.File;
import java.io.IOException;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
public class WumadFSTDataProviderLoader implements FSTDataProviderLoader<WumadInfo> { public class WumadFSTDataProviderLoader implements FSTDataProviderLoader<WumadInfo> {
@Getter @Getter
private static WumadFSTDataProviderLoader instance = new WumadFSTDataProviderLoader(); private static final WumadFSTDataProviderLoader instance = new WumadFSTDataProviderLoader();
private WumadFSTDataProviderLoader() { private WumadFSTDataProviderLoader() {
} }
@Override @Override
public Optional<WumadInfo> loadInfo(File input) { public Optional<WumadInfo> loadInfo(File input) {
if (input != null && input.exists()) { if (input != null && input.exists()) {

View File

@ -1,13 +1,13 @@
package de.mas.wiiu.jnus.fuse_wiiu.interfaces; package de.mas.wiiu.jnus.fuse_wiiu.interfaces;
import de.mas.wiiu.jnus.interfaces.FSTDataProvider;
import java.io.File; import java.io.File;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
import de.mas.wiiu.jnus.interfaces.FSTDataProvider;
public interface FSTDataProviderLoader<T> { public interface FSTDataProviderLoader<T> {
public Optional<T> loadInfo(File input); Optional<T> loadInfo(File input);
public List<FSTDataProvider> getDataProvider(T info); List<FSTDataProvider> getDataProvider(T info);
} }

View File

@ -9,26 +9,26 @@ import ru.serce.jnrfuse.struct.FuseFileInfo;
/** /**
* Simplified version of the FuseFS interface. * Simplified version of the FuseFS interface.
*
* @author Maschell
* *
* @author Maschell
*/ */
public interface FuseContainer extends FuseDirectory { public interface FuseContainer extends FuseDirectory {
/** /**
* Wrapper for the getattr function of the FuseFS interface. * Wrapper for the getattr function of the FuseFS interface.
* When this function is called, the path will be relative to this FuseContainer * When this function is called, the path will be relative to this FuseContainer
* * <p>
* Get file attributes. * Get file attributes.
* <p> * <p>
* Similar to stat(). The 'st_dev' and 'st_blksize' fields are * Similar to stat(). The 'st_dev' and 'st_blksize' fields are
* ignored. The 'st_ino' field is ignored except if the 'use_ino' * ignored. The 'st_ino' field is ignored except if the 'use_ino'
* mount option is given. * mount option is given.
*/ */
public int getattr(String path, FileStat stat); int getattr(String path, FileStat stat);
/** /**
* Wrapper for the getattr function of the FuseFS interface. * Wrapper for the getattr function of the FuseFS interface.
* When this function is called, the path will be relative to this FuseContainer * When this function is called, the path will be relative to this FuseContainer
* * <p>
* File open operation * File open operation
* <p> * <p>
* No creation (O_CREAT, O_EXCL) and by default also no * No creation (O_CREAT, O_EXCL) and by default also no
@ -46,12 +46,12 @@ public interface FuseContainer extends FuseDirectory {
* *
* @see jnr.constants.platform.OpenFlags * @see jnr.constants.platform.OpenFlags
*/ */
public int open(String path, FuseFileInfo fi); int open(String path, FuseFileInfo fi);
/** /**
* Wrapper for the readdir function of the FuseFS interface. * Wrapper for the readdir function of the FuseFS interface.
* When this function is called, the path will be relative to this FuseContainer * When this function is called, the path will be relative to this FuseContainer
* * <p>
* Read directory * Read directory
* <p> * <p>
* This supersedes the old getdir() interface. New applications * This supersedes the old getdir() interface. New applications
@ -71,12 +71,12 @@ public interface FuseContainer extends FuseDirectory {
* is full (or an error happens) the filler function will return * is full (or an error happens) the filler function will return
* '1'. * '1'.
*/ */
public int readdir(String path, Pointer buf, FuseFillDir filter, @off_t long offset, FuseFileInfo fi); int readdir(String path, Pointer buf, FuseFillDir filter, @off_t long offset, FuseFileInfo fi);
/** /**
* Wrapper for the getattr function of the FuseFS interface. * Wrapper for the getattr function of the FuseFS interface.
* When this function is called, the path will be relative to this FuseContainer * When this function is called, the path will be relative to this FuseContainer
* * <p>
* Read data from an open file * Read data from an open file
* <p> * <p>
* Read should return exactly the number of bytes requested except * Read should return exactly the number of bytes requested except
@ -86,17 +86,17 @@ public interface FuseContainer extends FuseDirectory {
* value of the read system call will reflect the return value of * value of the read system call will reflect the return value of
* this operation. * this operation.
*/ */
public int read(String path, Pointer buf, @size_t long size, @off_t long offset, FuseFileInfo fi); int read(String path, Pointer buf, @size_t long size, @off_t long offset, FuseFileInfo fi);
/** /**
* This function will be called when ever the FuseContainer needs to update it's children. * This function will be called when ever the FuseContainer needs to update it's children.
*/ */
public void init(); void init();
/** /**
* This function will be called right before this FuseContainer won't be used anymore. * This function will be called right before this FuseContainer won't be used anymore.
*/ */
public void deinit(); void deinit();
} }

View File

@ -4,16 +4,15 @@ import java.util.Optional;
/** /**
* Representation of a directory. * Representation of a directory.
*
* @author Maschell
* *
* @author Maschell
*/ */
public interface FuseDirectory { public interface FuseDirectory {
/** /**
* Returns the parent of this FuseDirectory. * Returns the parent of this FuseDirectory.
* *
* @return parent * @return parent
*/ */
public Optional<FuseDirectory> getParent(); Optional<FuseDirectory> getParent();
} }

View File

@ -1,18 +1,6 @@
package de.mas.wiiu.jnus.fuse_wiiu.utils; package de.mas.wiiu.jnus.fuse_wiiu.utils;
import java.io.File; import de.mas.wiiu.jnus.fuse_wiiu.implementation.*;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import de.mas.wiiu.jnus.fuse_wiiu.implementation.FSFuseContainer;
import de.mas.wiiu.jnus.fuse_wiiu.implementation.LocalBackupNUSTitleContainer;
import de.mas.wiiu.jnus.fuse_wiiu.implementation.LocalNUSTitleContainer;
import de.mas.wiiu.jnus.fuse_wiiu.implementation.MultipleFSTDataProviderFuseContainer;
import de.mas.wiiu.jnus.fuse_wiiu.implementation.MultipleFSTDataProviderRecursiveFuseContainer;
import de.mas.wiiu.jnus.fuse_wiiu.implementation.RemoteLocalBackupNUSTitleContainer;
import de.mas.wiiu.jnus.fuse_wiiu.implementation.WUDToWUDContainer;
import de.mas.wiiu.jnus.fuse_wiiu.implementation.WoomyNUSTitleContainer;
import de.mas.wiiu.jnus.fuse_wiiu.implementation.loader.WUDFSTDataProviderLoader; import de.mas.wiiu.jnus.fuse_wiiu.implementation.loader.WUDFSTDataProviderLoader;
import de.mas.wiiu.jnus.fuse_wiiu.implementation.loader.WumadFSTDataProviderLoader; import de.mas.wiiu.jnus.fuse_wiiu.implementation.loader.WumadFSTDataProviderLoader;
import de.mas.wiiu.jnus.fuse_wiiu.interfaces.FuseContainer; import de.mas.wiiu.jnus.fuse_wiiu.interfaces.FuseContainer;
@ -20,6 +8,11 @@ import de.mas.wiiu.jnus.fuse_wiiu.interfaces.FuseDirectory;
import de.mas.wiiu.jnus.implementations.wud.reader.WUDDiscReaderSplitted; import de.mas.wiiu.jnus.implementations.wud.reader.WUDDiscReaderSplitted;
import de.mas.wiiu.jnus.utils.Utils; import de.mas.wiiu.jnus.utils.Utils;
import java.io.File;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
public class FuseContainerWrapper { public class FuseContainerWrapper {
private final static String prefix = "[EMULATED] "; private final static String prefix = "[EMULATED] ";
@ -45,19 +38,19 @@ public class FuseContainerWrapper {
return result; return result;
} }
} }
if (c.exists() && c.getName().endsWith(".woomy")) { if (c.exists() && c.getName().endsWith(".woomy")) {
result.put(prefix + c.getName(), new WoomyNUSTitleContainer(parent, c)); result.put(prefix + c.getName(), new WoomyNUSTitleContainer(parent, c));
return result; return result;
} }
if (c.exists() && c.getName().endsWith(".wumad")) { if (c.exists() && c.getName().endsWith(".wumad")) {
result.put(prefix + c.getName(), new MultipleFSTDataProviderFuseContainer<>(parent, c, WumadFSTDataProviderLoader.getInstance())); result.put(prefix + c.getName(), new MultipleFSTDataProviderFuseContainer<>(parent, c, WumadFSTDataProviderLoader.getInstance()));
result.put(prefix + "[EXTRA] " + c.getName(), new MultipleFSTDataProviderRecursiveFuseContainer<>(parent, c, WumadFSTDataProviderLoader.getInstance())); result.put(prefix + "[EXTRA] " + c.getName(), new MultipleFSTDataProviderRecursiveFuseContainer<>(parent, c, WumadFSTDataProviderLoader.getInstance()));
return result; return result;
} }
if (checkWUD(result, parent, c)) { if (checkWUD(result, parent, c)) {
return result; return result;
} }

View File

@ -1,13 +1,13 @@
package de.mas.wiiu.jnus.fuse_wiiu.utils; package de.mas.wiiu.jnus.fuse_wiiu.utils;
import de.mas.wiiu.jnus.entities.Ticket;
import de.mas.wiiu.jnus.utils.FileUtils;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.nio.file.Files; import java.nio.file.Files;
import java.util.Optional; import java.util.Optional;
import de.mas.wiiu.jnus.entities.Ticket;
import de.mas.wiiu.jnus.utils.FileUtils;
public class TicketUtils { public class TicketUtils {
public static Optional<Ticket> getTicket(File folder, File keyFolder, long titleID, byte[] commonKey) { public static Optional<Ticket> getTicket(File folder, File keyFolder, long titleID, byte[] commonKey) {
File ticketFile = null; File ticketFile = null;

View File

@ -1,16 +1,15 @@
package de.mas.wiiu.jnus.fuse_wiiu.utils; package de.mas.wiiu.jnus.fuse_wiiu.utils;
import de.mas.wiiu.jnus.WUDLoader;
import de.mas.wiiu.jnus.fuse_wiiu.Settings;
import de.mas.wiiu.jnus.implementations.wud.WiiUDisc;
import org.apache.commons.io.FilenameUtils;
import java.io.File; import java.io.File;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.io.StringWriter; import java.io.StringWriter;
import java.util.Optional; import java.util.Optional;
import org.apache.commons.io.FilenameUtils;
import de.mas.wiiu.jnus.WUDLoader;
import de.mas.wiiu.jnus.fuse_wiiu.Settings;
import de.mas.wiiu.jnus.implementations.wud.WiiUDisc;
public class WUDUtils { public class WUDUtils {
public static Optional<WiiUDisc> loadWUDInfo(File file) { public static Optional<WiiUDisc> loadWUDInfo(File file) {
String FSfilename = file.getName(); String FSfilename = file.getName();