aboutsummaryrefslogtreecommitdiff
path: root/Northstar.Client/mod/scripts
diff options
context:
space:
mode:
authorJack <66967891+ASpoonPlaysGames@users.noreply.github.com>2023-10-07 11:40:31 +0100
committerGitHub <noreply@github.com>2023-10-07 12:40:31 +0200
commit15b3b65fc4e88fe98ba12b4d7603e396fba91fb3 (patch)
tree2bda073e3a7340445dfa8e5b2ea0288ef2efe815 /Northstar.Client/mod/scripts
parent1c3bafd8efd56c4f0bb11a952fb192f60bcf42c0 (diff)
downloadNorthstarMods-15b3b65fc4e88fe98ba12b4d7603e396fba91fb3.tar.gz
NorthstarMods-15b3b65fc4e88fe98ba12b4d7603e396fba91fb3.zip
Display origin auth failure in a dialog (#648)v1.19.5-rc1v1.19.5
Currently, we don't do anything with origin auth failure, meaning the next request just fails, and we get not particularly relevant error messages (player not found, invalid masterserver token)
Diffstat (limited to 'Northstar.Client/mod/scripts')
-rw-r--r--Northstar.Client/mod/scripts/vscripts/cl_northstar_client_init.nut7
-rw-r--r--Northstar.Client/mod/scripts/vscripts/ui/atlas_auth.nut56
2 files changed, 63 insertions, 0 deletions
diff --git a/Northstar.Client/mod/scripts/vscripts/cl_northstar_client_init.nut b/Northstar.Client/mod/scripts/vscripts/cl_northstar_client_init.nut
index 2a2ed3db..a844478a 100644
--- a/Northstar.Client/mod/scripts/vscripts/cl_northstar_client_init.nut
+++ b/Northstar.Client/mod/scripts/vscripts/cl_northstar_client_init.nut
@@ -41,3 +41,10 @@ global struct ServerInfo
string region
array< RequiredModInfo > requiredMods
}
+
+global struct MasterServerAuthResult
+{
+ bool success
+ string errorCode
+ string errorMessage
+}
diff --git a/Northstar.Client/mod/scripts/vscripts/ui/atlas_auth.nut b/Northstar.Client/mod/scripts/vscripts/ui/atlas_auth.nut
new file mode 100644
index 00000000..89b7f719
--- /dev/null
+++ b/Northstar.Client/mod/scripts/vscripts/ui/atlas_auth.nut
@@ -0,0 +1,56 @@
+global function AtlasAuthDialog
+
+void function AtlasAuthDialog()
+{
+ thread AtlasAuthDialog_Threaded()
+}
+
+void function AtlasAuthDialog_Threaded()
+{
+ // wait at least 1 frame so that the main menu can be loaded first
+ WaitFrame()
+
+ while ( !NSIsMasterServerAuthenticated() || GetConVarBool( "ns_auth_allow_insecure" ) )
+ WaitFrame()
+
+ if ( GetConVarBool( "ns_auth_allow_insecure" ) )
+ return
+
+ MasterServerAuthResult res = NSGetMasterServerAuthResult()
+
+ // do nothing on successful authentication
+ if ( res.success )
+ return
+
+ EmitUISound( "blackmarket_purchase_fail" )
+
+ DialogData dialogData
+ dialogData.image = $"ui/menu/common/dialog_error"
+ dialogData.header = Localize( "#AUTHENTICATION_FAILED_HEADER" )
+
+ // if we got a special error message from Atlas, display it
+ if ( res.errorMessage != "" )
+ dialogData.message = res.errorMessage
+ else
+ dialogData.message = Localize( "#AUTHENTICATION_FAILED_BODY" )
+
+ if ( res.errorCode != "" )
+ dialogData.message += format( "\n\n%s", Localize( "#AUTHENTICATION_FAILED_ERROR_CODE", res.errorCode ) )
+
+ string link = "https://r2northstar.gitbook.io/r2northstar-wiki/installing-northstar/troubleshooting"
+ // link to generic troubleshooting page if we don't have an error code from Atlas
+ if ( res.errorCode != "" )
+ link = format( "%s#%s", link, res.errorCode )
+
+ CloseAllDialogs()
+ AddDialogButton( dialogData, "#OK" )
+ AddDialogButton( dialogData, Localize( "#AUTHENTICATION_FAILED_HELP" ), void function() : ( dialogData, link )
+ {
+ // todo: get MS to redirect, so i can use an MS link or something?
+ LaunchExternalWebBrowser( link, WEBBROWSER_FLAG_FORCEEXTERNAL )
+ // keep the dialog open
+ OpenDialog( dialogData )
+ } )
+
+ OpenDialog( dialogData )
+}