}
}
+#ifdef CONFIG_MARU
+extern int start_simple_client(char* msg);
+#endif
+
DriveInfo *drive_init(QemuOpts *opts, int default_to_scsi)
{
const char *buf;
if (ret < 0) {
error_report("could not open disk image %s: %s",
file, strerror(-ret));
+
+#ifdef CONFIG_MARU
+ const char _msg[] = "Disk image file could not load from following path\n";
+ char* current_path = (char *)g_get_current_dir();
+
+ int len = strlen(_msg) + strlen(current_path) + strlen(file) + 3;
+
+ char* error_msg = g_malloc0(len * sizeof(char));
+ snprintf(error_msg, len - 1, "%s%s/%s", _msg, current_path, file);
+
+ start_simple_client(error_msg);
+
+ g_free(current_path);
+ g_free(error_msg);
+#endif
+
goto err;
}
return size;
}
+#ifdef CONFIG_MARU
+extern int start_simple_client(char* msg);
+#endif
+
static void load_linux(void *fw_cfg,
const char *kernel_filename,
const char *initrd_filename,
MIN(ARRAY_SIZE(header), kernel_size)) {
fprintf(stderr, "qemu: could not load kernel '%s': %s\n",
kernel_filename, strerror(errno));
+
+#ifdef CONFIG_MARU
+ const char _msg[] = "Kernel image file could not load from following path\n";
+ char* current_path = (char *)g_get_current_dir();
+
+ int len = strlen(_msg) + strlen(current_path) + strlen(kernel_filename) + 3;
+
+ char* error_msg = g_malloc0(len * sizeof(char));
+ snprintf(error_msg, len - 1, "%s%s/%s", _msg, current_path, kernel_filename);
+
+ start_simple_client(error_msg);
+
+ g_free(current_path);
+ g_free(error_msg);
+#endif
+
exit(1);
}
}
}
+#ifdef CONFIG_MARU
+extern char* qemu_get_data_dir(void);
+#endif
+
void pc_memory_init(MemoryRegion *system_memory,
const char *kernel_filename,
const char *kernel_cmdline,
if (ret != 0) {
bios_error:
fprintf(stderr, "qemu: could not load PC BIOS '%s'\n", bios_name);
+
+#ifdef CONFIG_MARU
+ const char _msg[] = "Bios image file could not load from following path\n";
+ char* current_path = (char *)g_get_current_dir();
+ const char* _path = qemu_get_data_dir();
+
+ int len = strlen(_msg) + strlen(current_path) + strlen(_path) + strlen(bios_name) + 4;
+
+ char* error_msg = g_malloc0(len * sizeof(char));
+ snprintf(error_msg, len - 1, "%s%s/%s/%s", _msg, current_path, _path, bios_name);
+
+ start_simple_client(error_msg);
+
+ g_free(current_path);
+ g_free(error_msg);
+#endif
+
exit(1);
}
if (filename) {
* @param args
*/
public static void main( String[] args ) {
+
+ String simpleMsg = getSimpleMsg(args);
+ if (simpleMsg != null) {
+ /* just show one message box. that's all. */
+ Shell temp = new Shell(Display.getDefault());
+ MessageBox messageBox = new MessageBox(temp, SWT.ICON_ERROR);
+ messageBox.setText("Emulator");
+ messageBox.setMessage(simpleMsg);
+ messageBox.open();
+ temp.dispose();
+
+ System.exit(-1);
+ }
SocketCommunicator communicator = null;
}
+ private static String getSimpleMsg( String[] args ) {
+
+ for ( int i = 0; i < args.length; i++ ) {
+ final String simple = "simple.msg";
+ String arg = args[i];
+ String[] split = arg.split( "=" );
+ if ( 1 < split.length ) {
+ if ( simple.equals( split[0].trim() ) ) {
+ return split[1].trim();
+ }
+ }
+ }
+
+ return null;
+
+ }
+
private static String getVmPath( String[] args ) {
for ( int i = 0; i < args.length; i++ ) {
#include <windows.h>
#endif
+MULTI_DEBUG_CHANNEL(qemu, maruskin_client);
+
+
+
#define SKIN_SERVER_READY_TIME 3 // second
#define SKIN_SERVER_SLEEP_TIME 10 // milli second
#define OPT_VM_PATH "vm.path"
#define OPT_NET_BASE_PORT "net.baseport"
-MULTI_DEBUG_CHANNEL( qemu, maruskin_client );
+#define MAX_COMMAND 512
static int skin_argc;
static char** skin_argv;
static void* run_skin_client(void* arg)
{
- char cmd[512] = {0};
+ char cmd[MAX_COMMAND] = {0};
char argv[256] = {0};
INFO("run skin client\n");
int skin_server_port = get_skin_server_port();
- srand( time( NULL ) );
+ //srand( time( NULL ) );
int uid = 0; //rand();
//INFO( "generated skin uid:%d\n", uid );
INFO( "command for swt : %s\n", cmd );
#ifdef _WIN32
-#if 0
- WinExec( cmd, SW_SHOW );
-#else
+ //WinExec( cmd, SW_SHOW );
{
STARTUPINFO sti = { 0 };
PROCESS_INFORMATION pi = { 0 };
}
}
-#endif
#else //ifndef _WIN32
int ret = system(cmd);
return 1;
}
+
+int start_simple_client(char* msg) {
+ int ret = 0;
+ char cmd[MAX_COMMAND] = {0};
+
+ INFO("run simple client\n");
+
+ sprintf(cmd, "%s %s %s %s=\"%s\"", JAVA_EXEFILE_PATH, JAVA_EXEOPTION, JAR_SKINFILE_PATH, "simple.msg", msg);
+ INFO("command for swt : %s\n", cmd);
+
+#ifdef __WIN32
+ ret = WinExec(cmd, SW_SHOW);
+#else
+ ret = system(cmd);
+#endif
+
+ INFO("child return value : %d\n", ret);
+
+ return 1;
+}
+
#define MARUSKIN_CLIENT_H_
int start_skin_client(int argc, char* argv[]);
+int start_simple_client(char* msg);
+
#endif /* MARUSKIN_CLIENT_H_ */
return buf;
}
+#ifdef CONFIG_MARU
+const char *qemu_get_data_dir(void);
+
+const char *qemu_get_data_dir(void)
+{
+ return data_dir;
+}
+#endif
+
static int device_help_func(QemuOpts *opts, void *opaque)
{
return qdev_device_help(opts);