*/
#include <common.h>
#include <acess/sys.h>
+#include <stdlib.h>
+#include <stdio.h>
// === IMPORTS ===
+extern void Video_Setup(void);
+extern void WM_Initialise(void);
+extern int Renderer_Menu_Init(void);
+extern int Renderer_Widget_Init(void);
+extern int Renderer_Background_Init(void);
extern void WM_Update(void);
// === PROTOTYPES ===
int giScreenWidth = 640;
int giScreenHeight = 480;
-uint32_t *gpScreenBuffer = NULL;
int giTerminalFD = -1;
int giMouseFD = -1;
-
+
+#define __INSTALL_ROOT "/Acess/Apps/AxWin/3.0"
+
+const char *gsInstallRoot = __INSTALL_ROOT;
// === CODE ===
/**
*/
int main(int argc, char *argv[])
{
+ int server_tid = gettid();
+
ParseCommandline(argc, argv);
if( gsTerminalDevice == NULL ) {
gsMouseDevice = "/Devices/PS2Mouse";
}
-// Video_Setup();
-// Interface_Init();
+ Video_Setup();
IPC_Init();
Input_Init();
-// WM_Update();
+ Renderer_Menu_Init();
+ Renderer_Widget_Init();
+ Renderer_Background_Init();
+ WM_Initialise();
+ // Spawn interface root
+ if( clone(CLONE_VM, 0) == 0 )
+ {
+ static char csInterfaceApp[] = __INSTALL_ROOT"/AxWinUI";
+ char server_info[] = "AXWIN3_SERVER=00000";
+ char *envp[] = {server_info, NULL};
+ char *argv[] = {csInterfaceApp, NULL};
+ _SysDebug("server_tid = %i, &server_tid = %p", server_tid, &server_tid);
+ sprintf(server_info, "AXWIN3_SERVER=%i", server_tid);
+ execve(csInterfaceApp, argv, envp);
+ exit(1);
+ }
+
// Main Loop
for(;;)
{
int nfds = 0;
FD_ZERO(&fds);
+ WM_Update();
+
Input_FillSelect(&nfds, &fds);
IPC_FillSelect(&nfds, &fds);
nfds ++;
- select(nfds, &fds, NULL, NULL, NULL);
+ if( _SysSelect(nfds, &fds, NULL, NULL, NULL, THREAD_EVENT_IPCMSG) == -1 ) {
+ _SysDebug("ERROR: select() returned -1");
+ return -1;
+ }
Input_HandleSelect(&fds);
IPC_HandleSelect(&fds);