Wii/3DS: Try to add opening web browser support

This commit is contained in:
UnknownShadow200 2023-07-29 17:33:56 +10:00
parent 1a1473ad4d
commit 347658254b
4 changed files with 26 additions and 2 deletions

View file

@ -476,7 +476,13 @@ cc_result Platform_SetDefaultCurrentDirectory(int argc, char **argv) {
void Process_Exit(cc_result code) { exit(code); }
cc_result Process_StartOpen(const cc_string* args) {
return ERR_NOT_SUPPORTED;
char url[NATIVE_STR_LEN];
int len = String_EncodeUtf8(url, args);
// TODO: Not sure if this works or not
APT_PrepareToStartSystemApplet(APPID_WEB);
return APT_StartSystemApplet(APPID_WEB, url, len + 1, CUR_PROCESS_HANDLE);
// len + 1 for null terminator
}

View file

@ -21,6 +21,9 @@
#include <ogc/cond.h>
#include <ogc/lwp_watchdog.h>
#include <fat.h>
#ifdef HW_RVL
#include <ogc/wiilaunch.h>
#endif
const cc_result ReturnCode_FileShareViolation = 1000000000; /* TODO: not used apparently */
const cc_result ReturnCode_FileNotFound = ENOENT;
@ -576,10 +579,19 @@ cc_result Platform_SetDefaultCurrentDirectory(int argc, char **argv) {
void Process_Exit(cc_result code) { exit(code); }
#ifdef HW_RVL
cc_result Process_StartOpen(const cc_string* args) {
char url[NATIVE_STR_LEN];
String_EncodeUtf8(url, args);
// TODO: Not sure if this works or not
return WII_OpenURL(url);
}
#else
cc_result Process_StartOpen(const cc_string* args) {
// TODO launch browser
return ERR_NOT_SUPPORTED;
}
#endif
/*########################################################################################################################*
@ -643,6 +655,7 @@ static void AppendDevice(cc_string* path, char* cwd) {
String_AppendConst(path, "sd");
}
}
static void FindRootDirectory(void) {
char cwdBuffer[NATIVE_STR_LEN] = { 0 };
char* cwd = getcwd(cwdBuffer, NATIVE_STR_LEN);
@ -651,6 +664,7 @@ static void FindRootDirectory(void) {
AppendDevice(&root_path, cwd);
String_AppendConst(&root_path, ":/ClassiCube/");
}
static void CreateRootDirectory(void) {
if (!fat_available) return;
root_buffer[root_path.length] = '\0';

View file

@ -257,6 +257,8 @@ void Window_CloseKeyboard(void) { /* TODO implement */ }
*#########################################################################################################################*/
static void ShowDialogCore(const char* title, const char* msg) {
/* TODO implement */
Platform_LogConst(title);
Platform_LogConst(msg);
}
cc_result Window_OpenFileDialog(const struct OpenFileDialogArgs* args) {

View file

@ -277,6 +277,8 @@ static void Cursor_DoSetVisible(cc_bool visible) {
static void ShowDialogCore(const char* title, const char* msg) {
/* TODO implement */
Platform_LogConst(title);
Platform_LogConst(msg);
}
cc_result Window_OpenFileDialog(const struct OpenFileDialogArgs* args) {