R/Ryujinx.HLE/Loaders/Npdm/ServiceAccessControl.cs

43 lines
1.1 KiB
C#
Raw Normal View History

2018-11-29 02:01:19 +00:00
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Text;
namespace Ryujinx.HLE.Loaders.Npdm
{
Add features to GUI (#757) * controller image changes depending on the selected controller type the new controller image assets are temporary until i get new ones * Game list scans subdirs for games * Key file existence check * Only shows Program NCAs in Application list * Change shown GUI columns without restarting * Sort by column if you click on the column header Columns are sorted as text so there are inaccuracies on some columns * Fix sort on Time Played, Last Played and File Size columns * Add ability to designate favourite games #1 TODO: - Make fav games persistent - Fix invisible check marks due to theme * Add ability to designate favourite games #2 Also removed default theme * Added a Windows specific build condition and a Linux bug fix * bugfix * Load metadata from JSONs * Temp bug fix for MacOS * lil clean up * requested changes * Misc fixes * edited schema and config * Show the TitleID of games on the title bar * gui column config option have names * Async loading of game list * bugfix and cleanup * thog's requested changes * requested changes and cleanup still need to fix the gtk seizure * Fix issue where an ExeFS as a NSP didn't show up in the application list * Minor fixes * catch glib unhandled exceptions * Make sure to do UI manipulation in the main thread * Print path of invalid files * Ac_k's requested changes * Return of the dark theme * move AboutInfo struct to another file * sort usings * changes - gdkchan's requested changes that have been marked resolved - made some structs internal as they aren't used outside of the GUI - renamed Ryujinx.UI to Ryujinx.Ui to fit naming convention and folder structure - fixed bug where controller type dropdown box is stretched
2019-11-29 04:32:51 +00:00
public class ServiceAccessControl
2018-11-29 02:01:19 +00:00
{
public IReadOnlyDictionary<string, bool> Services { get; private set; }
2018-11-29 02:01:19 +00:00
public ServiceAccessControl(Stream stream, int offset, int size)
2018-11-29 02:01:19 +00:00
{
stream.Seek(offset, SeekOrigin.Begin);
2018-11-29 02:01:19 +00:00
BinaryReader reader = new BinaryReader(stream);
2018-11-29 02:01:19 +00:00
int bytesRead = 0;
2018-11-29 02:01:19 +00:00
Dictionary<string, bool> services = new Dictionary<string, bool>();
2018-11-29 02:01:19 +00:00
while (bytesRead != size)
2018-11-29 02:01:19 +00:00
{
byte controlByte = reader.ReadByte();
2018-11-29 02:01:19 +00:00
if (controlByte == 0)
2018-11-29 02:01:19 +00:00
{
break;
}
int length = (controlByte & 0x07) + 1;
bool registerAllowed = (controlByte & 0x80) != 0;
2018-11-29 02:01:19 +00:00
services[Encoding.ASCII.GetString(reader.ReadBytes(length))] = registerAllowed;
2018-11-29 02:01:19 +00:00
bytesRead += length + 1;
2018-11-29 02:01:19 +00:00
}
Services = new ReadOnlyDictionary<string, bool>(services);
2018-11-29 02:01:19 +00:00
}
}
}