scripts
This commit is contained in:
+171
@@ -0,0 +1,171 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Sony.NP
|
||||
{
|
||||
// Token: 0x0200003E RID: 62
|
||||
public class Main
|
||||
{
|
||||
// Token: 0x06000116 RID: 278
|
||||
[DllImport("UnityNpToolkit2")]
|
||||
private static extern void PrxInitialize(InitToolkit initParams, out NativeInitResult initResult, Main.OnPrxCallbackEvent toolkitEventCallback, Main.OnPrxCallbackEvent npRequestEventCallback, out APIResult result);
|
||||
|
||||
// Token: 0x06000117 RID: 279
|
||||
[DllImport("UnityNpToolkit2")]
|
||||
private static extern void PrxValidateToolkit(Main.ValidationChecks checks, out APIResult result);
|
||||
|
||||
// Token: 0x06000118 RID: 280
|
||||
[DllImport("UnityNpToolkit2")]
|
||||
private static extern void PrxShutDown();
|
||||
|
||||
// Token: 0x06000119 RID: 281
|
||||
[DllImport("UnityNpToolkit2")]
|
||||
private static extern int PrxUpdate();
|
||||
|
||||
// Token: 0x0600011A RID: 282
|
||||
[DllImport("UnityNpToolkit2")]
|
||||
private static extern bool PrxAbortRequest(uint npRequestId, out APIResult result);
|
||||
|
||||
// Token: 0x0600011B RID: 283 RVA: 0x000049F4 File Offset: 0x000039F4
|
||||
public static InitResult Initialize(InitToolkit initParams)
|
||||
{
|
||||
Main.ValidationChecks validationChecks = new Main.ValidationChecks();
|
||||
validationChecks.Init();
|
||||
APIResult apiresult;
|
||||
Main.PrxValidateToolkit(validationChecks, out apiresult);
|
||||
if (apiresult.RaiseException)
|
||||
{
|
||||
throw new NpToolkitException(apiresult);
|
||||
}
|
||||
initParams.CheckValid();
|
||||
Main.OnPrxCallbackEvent onPrxCallbackEvent = new Main.OnPrxCallbackEvent(PopulateThread.OnPrxNpToolkitEvent);
|
||||
Main.OnPrxCallbackEvent onPrxCallbackEvent2 = new Main.OnPrxCallbackEvent(NpRequestsThread.OnPrxNpRequestEvent);
|
||||
NativeInitResult nativeInitResult = default(NativeInitResult);
|
||||
Main.PrxInitialize(initParams, out nativeInitResult, onPrxCallbackEvent, onPrxCallbackEvent2, out apiresult);
|
||||
Main.initResult.Initialise(nativeInitResult);
|
||||
if (apiresult.RaiseException)
|
||||
{
|
||||
throw new NpToolkitException(apiresult);
|
||||
}
|
||||
PopulateThread.Start();
|
||||
NpRequestsThread.Start();
|
||||
return Main.initResult;
|
||||
}
|
||||
|
||||
// Token: 0x14000001 RID: 1
|
||||
// (add) Token: 0x0600011C RID: 284 RVA: 0x00004AA0 File Offset: 0x00003AA0
|
||||
// (remove) Token: 0x0600011D RID: 285 RVA: 0x00004AB7 File Offset: 0x00003AB7
|
||||
public static event Main.EventHandler OnAsyncEvent;
|
||||
|
||||
// Token: 0x0600011E RID: 286 RVA: 0x00004AD0 File Offset: 0x00003AD0
|
||||
internal static void InternalEventHandler(NpCallbackEvent npEvent)
|
||||
{
|
||||
if (npEvent.service == ServiceTypes.Notification)
|
||||
{
|
||||
if (npEvent.apiCalled == FunctionTypes.NotificationAborted)
|
||||
{
|
||||
PendingAsyncRequestList.RequestHasBeenAborted(npEvent.npRequestId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600011F RID: 287 RVA: 0x00004B10 File Offset: 0x00003B10
|
||||
internal static void CallOnAsyncEvent(NpCallbackEvent npEvent)
|
||||
{
|
||||
Main.InternalEventHandler(npEvent);
|
||||
try
|
||||
{
|
||||
Main.OnAsyncEvent(npEvent);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine("Exception Occured in OnAsyncEvent handler : " + ex.Message);
|
||||
Console.WriteLine(ex.StackTrace);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000120 RID: 288 RVA: 0x00004B6C File Offset: 0x00003B6C
|
||||
public static void Update()
|
||||
{
|
||||
Main.PrxUpdate();
|
||||
}
|
||||
|
||||
// Token: 0x06000121 RID: 289 RVA: 0x00004B78 File Offset: 0x00003B78
|
||||
private static void PumpAsyncEvents()
|
||||
{
|
||||
if (Main.OnAsyncEvent != null)
|
||||
{
|
||||
for (NpCallbackEvent npCallbackEvent = PendingCallbackQueue.PopEvent(); npCallbackEvent != null; npCallbackEvent = PendingCallbackQueue.PopEvent())
|
||||
{
|
||||
Main.InternalEventHandler(npCallbackEvent);
|
||||
Main.OnAsyncEvent(npCallbackEvent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000122 RID: 290 RVA: 0x00004BC2 File Offset: 0x00003BC2
|
||||
public static void ShutDown()
|
||||
{
|
||||
PopulateThread.Stop();
|
||||
NpRequestsThread.Stop();
|
||||
PendingAsyncRequestList.Shutdown();
|
||||
Main.PrxShutDown();
|
||||
}
|
||||
|
||||
// Token: 0x06000123 RID: 291 RVA: 0x00004BE0 File Offset: 0x00003BE0
|
||||
public static List<PendingRequest> GetPendingRequests()
|
||||
{
|
||||
return PendingAsyncRequestList.PendingRequests;
|
||||
}
|
||||
|
||||
// Token: 0x06000124 RID: 292 RVA: 0x00004BF8 File Offset: 0x00003BF8
|
||||
public static bool AbortRequest(uint npRequestId)
|
||||
{
|
||||
bool flag;
|
||||
if (!PendingAsyncRequestList.IsPending(npRequestId))
|
||||
{
|
||||
flag = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
APIResult apiresult;
|
||||
Main.PrxAbortRequest(npRequestId, out apiresult);
|
||||
if (apiresult.RaiseException)
|
||||
{
|
||||
throw new NpToolkitException(apiresult);
|
||||
}
|
||||
PendingAsyncRequestList.MarkRequestAsAborting(npRequestId);
|
||||
flag = true;
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
// Token: 0x040000BD RID: 189
|
||||
internal static InitResult initResult;
|
||||
|
||||
// Token: 0x0200003F RID: 63
|
||||
// (Invoke) Token: 0x06000127 RID: 295
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
internal delegate void OnPrxCallbackEvent();
|
||||
|
||||
// Token: 0x02000040 RID: 64
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal class ValidationChecks
|
||||
{
|
||||
// Token: 0x0600012A RID: 298 RVA: 0x00004C47 File Offset: 0x00003C47
|
||||
public void Init()
|
||||
{
|
||||
this.expectedNumFunctionTypes = 118U;
|
||||
}
|
||||
|
||||
// Token: 0x040000BF RID: 191
|
||||
internal uint expectedNumFunctionTypes;
|
||||
}
|
||||
|
||||
// Token: 0x02000041 RID: 65
|
||||
// (Invoke) Token: 0x0600012D RID: 301
|
||||
public delegate void EventHandler(NpCallbackEvent npEvent);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user