Ejemplo n.º 1
0
void filelist_onEnter(UserInterfaceElement *b) {
    if(ztPlayer->playing)
    {
        UIP_RUSure->str = " You crazy?";
        popup_window(UIP_RUSure);
        return;
    }
    UIP_RUSure->str = " Load file?";
    UIP_RUSure->OnYes = (VFunc)do_load;
    FileList *f = (FileList *)b;
    strcpy(load_filename,f->getCurrentItem());
    if (file_changed)
        popup_window(UIP_RUSure);
    else
        popup_window(UIP_LoadMsg);
}
Ejemplo n.º 2
0
static bool simulator_view(WINDOW *out, WINDOW *state, struct program *program,
                           enum STATE *current_state)
{
        int input;
        static int timeout = 0;

        set_state(current_state);

        while (1) {
                wtimeout(state, timeout);
                input = wgetch(status);

                if (program->simulator.memory[program->simulator.PC].isBreakpoint) {
                        popup_window("Breakpoint hit!", 0, true);
                        program->simulator.isPaused = true;
                        program->simulator.memory[program->simulator.PC]
                                .isBreakpoint = false;
                }

                if (QUIT == input) {
                        return false;
                } else if (GOBACK == input) {
                        *current_state = MAIN;
                        program->simulator.isPaused = true;
                        return true;
                } else if (PAUSE == input) {
                        program->simulator.isPaused = !program->simulator.isPaused;
                } else if (START == input || RUN == input) {
                        program->simulator.isPaused = program->simulator.isHalted;
                } else if (RESTART == input) {
                        memPopulated = -1;
                        init_machine(program);
                        wclear(out);
                        wrefresh(out);
                } else if (STEP_NEXT == input) {
                        executeNext(&(program->simulator), output);
                        program->simulator.isPaused = true;
                        printState(&(program->simulator), state);
                } else if (CONTINUE == input) {
                        memPopulated = -1;
                        init_machine(program);
                } else if (CONTINUE_RUN == input) {
                        memPopulated = -1;
                        init_machine(program);
                        program->simulator.isPaused = false;
                }

                if (!program->simulator.isPaused && !program->simulator.isHalted) {
                        executeNext(&(program->simulator), out);
                        timeout = 0;
                } else {
                        set_state(current_state);
                        printState(&(program->simulator), state);
                        timeout = -1;
                        generateContext(context, program, 0, program->simulator.PC);
                }
        }
}
Ejemplo n.º 3
0
// ------------------------------------------------------------------------------------------------
//
//
void filelist_onEnter(UserInterfaceElement *b)
{
//  <Manu> Desactivamos el requester de si estas loco, al cargar 
//         la cancion se comprueba si se esta playeando y la parara
  
/*  if(ztPlayer->playing) {
        UIP_RUSure->str = " You crazy?";
        popup_window(UIP_RUSure);
        return;
    }
*/
  UIP_RUSure->str = " Load file?";
  UIP_RUSure->OnYes = (VFunc)do_load;
  FileList *f = (FileList *)b;
  strcpy(load_filename,f->getCurrentItem());
  
  if (file_changed) popup_window(UIP_RUSure);
  else popup_window(UIP_LoadMsg);
}
Ejemplo n.º 4
0
// ------------------------------------------------------------------------------------------------
//
//
void do_load(void) 
{
//  <Manu> Si la cancion esta sonando la paramos --
  if(ztPlayer->playing) {
    
    ztPlayer->stop() ;
    MidiOut->panic();
  }
// ------------------------------------------------
  popup_window(UIP_LoadMsg) ;
}
Ejemplo n.º 5
0
static bool memory_view(WINDOW *window, struct program *program,
                        enum STATE *current_state)
{
        int input, jump_address, new_value;

        while (1) {
                set_state(current_state);
                input = wgetch(window);
                if (QUIT == input) {
                        return false;
                } else if (GOBACK == input) {
                        *current_state = MAIN;
                        return true;
                } else if (JUMP == input) {
                        jump_address = popup_window(
                                "Enter a hex address to jump to: ",
                                selectedAddress, false);
                        if (jump_address == selectedAddress)
                                continue;
                        generateContext(window, program, 0, (uint16_t) jump_address);
                } else if (KEYUP == input) {
                        moveContext(window, program, UP);
                } else if (KEYDOWN == input) {
                        moveContext(window, program, DOWN);
                } else if (EDITFILE == input) {
                        new_value = popup_window(
                                "Enter the new instruction (in hex): ",
                                program->simulator.memory[selectedAddress].value,
                                false);
                        program->simulator.memory[selectedAddress].value =
                                (uint16_t) new_value;
                        update(window, program);
                } else if (SETPC == input) {
                        program->simulator.PC = selectedAddress;
                } else if (BREAKPOINTSET == input) {
                        program->simulator.memory[selectedAddress]
                                .isBreakpoint = !program->simulator.memory[
                                selectedAddress].isBreakpoint;
                }
        }
}
Ejemplo n.º 6
0
// ------------------------------------------------------------------------------------------------
//
//
void do_save(void)
{
  strcpy((char *)song->filename,save_filename);
  popup_window(UIP_SaveMsg);
}
Ejemplo n.º 7
0
// ------------------------------------------------------------------------------------------------
//
//
void begin_save(void)
{
  //int i = strlen(ls_filename)-3; if (i<0) i=0;
  if (((Button *)UIP_Savescreen->UI->get_element(4))->state) {

    UIP_SaveMsg->filetype = 1;

    int i=0;

    while(i<255 && save_filename[i] != 0) {

      i++;
    }

    while (i>=0 && save_filename[i]==' ') {

      i--;
    }

    if (save_filename[i] == ' ' || i == 0) save_filename[i] =0;

    if (i>3) {

      if (zcmpi(&save_filename[i-3],".zt")==0) memcpy(&save_filename[i],".zt",3);
    }
    else {

      if (i>0) memcpy(&save_filename[i+3],".zt",3);
    }

    if (file_exists(save_filename)) {

      UIP_RUSure->str = " File exists, sure?";
      UIP_RUSure->OnYes = (VFunc)do_save;
      popup_window(UIP_RUSure);
    }
    else {

      do_save();
    }
  }

  if (((Button *)UIP_Savescreen->UI->get_element(5))->state) {

    UIP_SaveMsg->filetype = 2;
    int i=0;

    while(i<255 && save_filename[i] != 0) {

      i++;
    }

    while (i>=0 && save_filename[i]==' ') {

      i--;
    }

    if (save_filename[i] == ' ' || i == 0) save_filename[i] =0;

    if (i>4) {
      if (zcmpi(&save_filename[i-4],".mid")==0)
        memcpy(&save_filename[i],".mid",4);
    }
    else {

      if (i>0) memcpy(&save_filename[i+4],".mid",4);
    }

    if (file_exists(save_filename)) {

      UIP_RUSure->str = " File exists, sure?";
      UIP_RUSure->OnYes = (VFunc)do_save;
      popup_window(UIP_RUSure);
    }
    else {

      do_save();
    }
  }
}
Ejemplo n.º 8
0
void do_load(void) {
    popup_window(UIP_LoadMsg);
}