示例#1
0
static bool shouldSendCommand(PluginData* data)
{
	bool t0 = data->state != PDDebugState_running;
	bool t1 = VICEConnection_isConnected(data->conn);

	return t0 && t1;
}
static void launch_vice_with_config(PluginData* data) {
    int r, cmdIndex = 1;
    uv_process_options_t options = { 0 };

    log_debug("spawning vice...\n", "");

    char* args[10];
    args[0] = (char*)data->config.vice_exe;

    // TODO: Must generate the breakpoint file from the json one

    args[cmdIndex++] = "-remotemonitor";

    if (data->config.breakpoint_file) {
        //args[cmdIndex++] = "-moncommands";
        //args[cmdIndex++] = "examples/c64_vice/test_mon.txt";
    }

    //args[cmdIndex++] = (char*)data->config.prg_file;
    args[cmdIndex++] = NULL;

    options.exit_cb = 0;
    options.file = data->config.vice_exe;
    options.args = args;

    if ((r = uv_spawn(uv_default_loop(), &data->process, &options))) {
        MESSAGE_FUNCS->error("Unable to launch VICE", uv_strerror(r));
        return;
    }

    sleepMs(3000);

    connect_to_local_host(data);

    // if connected we load the image and make sure we get a reply back

    if (VICEConnection_isConnected(data->conn)) {
        log_debug("connected to vice...\n", "");

        if (!load_image(data, data->config.prg_file)) {
            return;
		}

        log_debug("image loaded ...\n", "");

        // parse the

        parse_mon_file(data, data->config.breakpoint_file);

        log_debug("start from basic...\n", "");

        // start vice!

        log_debug("started from basic\n", "");

        uint16_t address = 0; //get_basic_start(data);

        parse_mon_file(data, data->config.breakpoint_file);

        if (address != 0) {
            log_debug("start from %x\n", address);
            send_command(data, "g %x\n", address);
        }

        return;
    }

    log_debug("unable to make connection with vice\n", "");
}