File tree Expand file tree Collapse file tree 3 files changed +33
-1
lines changed Expand file tree Collapse file tree 3 files changed +33
-1
lines changed Original file line number Diff line number Diff line change @@ -92,7 +92,7 @@ extern "C" {
92
92
93
93
#include <3ds/applets/swkbd.h>
94
94
#include <3ds/applets/error.h>
95
-
95
+ #include <3ds/applets/browser.h>
96
96
#include <3ds/applets/miiselector.h>
97
97
98
98
#include <3ds/archive.h>
Original file line number Diff line number Diff line change
1
+ /**
2
+ * @file browser.h
3
+ * @brief Browser Applet
4
+ */
5
+
6
+ #pragma once
7
+
8
+ /**
9
+ * @brief Open the browser at a url
10
+ * @param url The url to open at, max-length 1024 characters including the trailing zero. If invalid or null, just opens the browser.
11
+ */
12
+ void browserOpenUrl (char * url );
Original file line number Diff line number Diff line change
1
+ #include <3ds/types.h>
2
+ #include <3ds/services/apt.h>
3
+
4
+ #include <3ds/applets/browser.h>
5
+
6
+ #include <stdlib.h>
7
+ #include <string.h>
8
+
9
+ void browserOpenUrl (const char * url )
10
+ {
11
+ size_t url_len = url ? (strlen (url ) + 1 ) : 0 ;
12
+ // check that we passed a url, it isn't too long and not too short (needs at least "http://")
13
+ // if that is not the case, we just claim our buffer was 0 in size
14
+ if (url_len > 0x400 || url_len < 8 ) url_len = 0 ;
15
+ // The URL needs to be on the heap, else we get an ARM11 exception when resuming the application
16
+ void * buffer = malloc (url_len );
17
+ if (buffer ) memcpy (buffer , url , url_len );
18
+ aptLaunchSystemApplet (APPID_WEB , buffer , url_len , 0 );
19
+ if (buffer ) free (buffer );
20
+ }
You can’t perform that action at this time.
0 commit comments