Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Merge pull request #9452 from JosJuice/android-wii-saves
Android: Add "Import Wii Save"
- Loading branch information
Showing
17 changed files
with
324 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/BooleanSupplier.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| package org.dolphinemu.dolphinemu.utils; | ||
|
|
||
| public interface BooleanSupplier | ||
| { | ||
| boolean get(); | ||
| } |
95 changes: 95 additions & 0 deletions
95
Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/CompletableFuture.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,95 @@ | ||
| package org.dolphinemu.dolphinemu.utils; | ||
|
|
||
| import java.util.concurrent.ExecutionException; | ||
| import java.util.concurrent.Future; | ||
| import java.util.concurrent.TimeUnit; | ||
| import java.util.concurrent.TimeoutException; | ||
| import java.util.concurrent.locks.Condition; | ||
| import java.util.concurrent.locks.Lock; | ||
| import java.util.concurrent.locks.ReentrantLock; | ||
|
|
||
| /** | ||
| * Simplified re-implementation of a subset of {@link java.util.concurrent.CompletableFuture}. | ||
| * Replace this class with that class once we have full Java 8 support (once we require API 24). | ||
| */ | ||
| public class CompletableFuture<T> implements Future<T> | ||
| { | ||
| private final Lock lock = new ReentrantLock(); | ||
| private final Condition done = lock.newCondition(); | ||
|
|
||
| private boolean isDone = false; | ||
| private T result = null; | ||
|
|
||
| @Override | ||
| public boolean cancel(boolean mayInterruptIfRunning) | ||
| { | ||
| throw new UnsupportedOperationException(); | ||
| } | ||
|
|
||
| @Override | ||
| public boolean isCancelled() | ||
| { | ||
| return false; | ||
| } | ||
|
|
||
| @Override | ||
| public boolean isDone() | ||
| { | ||
| return isDone; | ||
| } | ||
|
|
||
| @Override | ||
| public T get() throws ExecutionException, InterruptedException | ||
| { | ||
| lock.lock(); | ||
| try | ||
| { | ||
| while (!isDone) | ||
| done.await(); | ||
|
|
||
| return result; | ||
| } | ||
| finally | ||
| { | ||
| lock.unlock(); | ||
| } | ||
| } | ||
|
|
||
| @Override | ||
| public T get(long timeout, TimeUnit unit) | ||
| throws ExecutionException, InterruptedException, TimeoutException | ||
| { | ||
| lock.lock(); | ||
| try | ||
| { | ||
| while (!isDone) | ||
| { | ||
| if (!done.await(timeout, unit)) | ||
| throw new TimeoutException(); | ||
| } | ||
|
|
||
| return result; | ||
| } | ||
| finally | ||
| { | ||
| lock.unlock(); | ||
| } | ||
| } | ||
|
|
||
| public boolean complete(T value) | ||
| { | ||
| lock.lock(); | ||
| try | ||
| { | ||
| boolean wasDone = isDone; | ||
| result = value; | ||
| isDone = true; | ||
| done.signalAll(); | ||
| return !wasDone; | ||
| } | ||
| finally | ||
| { | ||
| lock.unlock(); | ||
| } | ||
| } | ||
| } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.