* It should take a ticket view, not a title ID.
* It's missing a lot of checks.
* It's not deleting tickets properly.
* It's not deleting only the ticket it needs to delete.
* It should not return -1017 when the ticket doesn't exist.
* It's not returning the proper error code when a read/write fails.
* It's not cleaning up the ticket directory if there is nothing left.
This commit fixes its implementation.
* Supporting other ticket types makes the logic slightly more complex.
* There have been no such non-RSA2048 tickets seen during the Wii's
lifetime.
* The Wii's IOS doesn't even have support for them.
Stops CMake from saying "BlueZ NOT found, disabling bluetooth support"
on other OSes. Windows, macOS, and Android support Bluetooth using other
libraries. I'm not sure if non-Linux, non-Android Unices (like FreeBSD)
need another message?
Whenever the EmulationActivity crashes and the app gets back to the
TvMainActivity, dolphin will crash tring to restor the mBrowseFragment
since we don't save the adapter data in the bundle.
This is quick hack to avoid the crash. The proper fix would be to save the
adapter data in the bundle and restore it before restoring the fragment
when the activity gets recreated.
Crash Stacktrace:
Process: org.dolphinemu.dolphinemu.debug, PID: 30353
java.lang.RuntimeException: Unable to start activity ComponentInfo{org.dolphinemu.dolphinemu.debug/org.dolphinemu.dolphinemu.ui.main.TvMainActivity}: java.lang.IllegalArgumentException: Invalid position 1 requested
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2691)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2752)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1461)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6120)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
Caused by: java.lang.IllegalArgumentException: Invalid position 1 requested
at android.support.v17.leanback.app.BrowseFragment.createMainFragment(BrowseFragment.java:509)
at android.support.v17.leanback.app.BrowseFragment.replaceMainFragment(BrowseFragment.java:1454)
at android.support.v17.leanback.app.BrowseFragment.setAdapter(BrowseFragment.java:764)
at org.dolphinemu.dolphinemu.ui.main.TvMainActivity.buildRowsAdapter(TvMainActivity.java:183)
at org.dolphinemu.dolphinemu.ui.main.TvMainActivity.onCreate(TvMainActivity.java:59)
at android.app.Activity.performCreate(Activity.java:6664)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2644)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2752)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1461)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6120)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
The accuracy doesn't match ppc, and worse, it doesn't set the error flags if the input is zero.
Lets stop to ship broken instructions, so right now, the interpreter is the closest one.
Fixes warning:
```
Source/Core/DiscIO/NANDImporter.cpp:55:17: warning: format specifies type 'unsigned long' but the argument has type 'u64' (aka 'unsigned long long') [-Wformat]
file.GetSize(), NAND_BIN_SIZE);
^~~~~~~~~~~~~~
1 warning generated.
```
This changes some parts of IOS (actually just ES) to reuse more crypto
code from IOSC or Common::AES.
TicketReader still returns the title key directly as opposed to having
ES use IOSC directly to avoid duplicating the title key IV stuff.
Side effects:
* A nasty unbounded array access bug is now fixed.
* ES_Decrypt/ES_Encrypt now returns sane results for keys other than
the SD key.
* Titles with a Korean ticket can now be decrypted properly.
And in the future, we can look into implementing ioctlv 0x3c and 0x3d
now that we have the proper "infra" for IOSC calls.
This prevents the IOS crypto code and keys from being spread over
the codebase. Things only have to be implemented once, and can be
used everywhere from the IOS code.
Additionally, since ES exposes some IOSC calls directly (DeleteObject
and Encrypt/Decrypt), we need this for proper emulation.
Currently, this only supports AES key objects.
Netplay uses a blank NAND, which means that homebrew launchers like
Gecko will force users to install IOSes.
Expecting netplay users to have a proper NAND setup is unrealistic,
and we don't actually give them a good way of syncing NANDs, so
let's extend the hack to netplay/TAS until we have a better way
of dealing with the issue.