6 #include "anago_wxframe_main.h"
7 #include "reader_master.h"
8 //#include "reader_kazzo.h"
9 extern const struct reader_driver DRIVER_KAZZO;
11 #include "script_dump.h"
14 static void value_set(void *gauge, int value)
16 wxGauge *g = static_cast<wxGauge *>(gauge);
20 static void range_set(void *gauge, int value)
22 wxGauge *g = static_cast<wxGauge *>(gauge);
29 static void text_append(void *log, const char *str)
31 wxTextCtrl *l = static_cast<wxTextCtrl *>(log);
35 static void label_set(void *label, const char *str)
37 wxStaticText *l = static_cast<wxStaticText *>(label);
41 anago_wxframe_main::anago_wxframe_main( wxWindow* parent )
42 : frame_main( parent )
45 wxDir dir(wxGetCwd());
49 if ( !dir.IsOpened() ){
52 bool cont = dir.GetFirst(&filename, wxString("*.ad"), wxDIR_FILES);
54 m_combo_script->Append(filename);
56 cont = dir.GetNext(&filename);
58 m_combo_script->Select(0);
61 void anago_wxframe_main::OnButtonClick(wxCommandEvent& event)
63 struct config_dump config;
64 config.gauge_cpu.bar = m_gauge_cpu;
65 config.gauge_cpu.label = m_label_cpu;
66 config.gauge_cpu.label_set = label_set;
67 config.gauge_cpu.range_set = range_set;
68 config.gauge_cpu.value_set = value_set;
70 config.gauge_ppu.bar = m_gauge_ppu;
71 config.gauge_ppu.label = m_label_ppu;
72 config.gauge_ppu.label_set = label_set;
73 config.gauge_ppu.range_set = range_set;
74 config.gauge_ppu.value_set = value_set;
76 config.log.object = m_log;
77 config.log.append = text_append;
78 config.increase.cpu = 1;
79 config.increase.ppu = 1;
80 config.progress = true;
81 wxString str_script = m_combo_script->GetValue();
82 config.script = str_script.fn_str();
86 config.mappernum = -1;
87 if(m_check_forcemapper->GetValue() == true){
88 str = m_text_forcemapper->GetValue();
89 if(str.ToLong(&config.mappernum) == false){
90 *m_log << "bad mapper number\n";
96 wxTextCtrl *text = m_picker_romimage->GetTextCtrl();
97 wxString str_rom = text->GetValue();
98 if(text->IsEmpty() == true){
99 *m_log << "Enter filename to ROM image\n";
102 config.target = str_rom.fn_str();
104 config.reader = &DRIVER_KAZZO;
105 if(config.reader->open_or_close(READER_OPEN) == NG){
106 *m_log << "reader open error\n";
109 m_combo_script->Disable();
110 m_picker_romimage->Disable();
111 m_check_battery->Disable();
112 m_check_forcemapper->Disable();
113 m_button_dump->Disable();
114 if(m_check_forcemapper->GetValue() == true){
115 m_text_forcemapper->Disable();
118 config.reader->init();
119 script_dump_execute(&config);
120 config.reader->open_or_close(READER_CLOSE);
122 m_combo_script->Enable();
123 m_picker_romimage->Enable();
124 m_check_battery->Enable();
125 m_check_forcemapper->Enable();
126 m_button_dump->Enable();
127 if(m_check_forcemapper->GetValue() == true){
128 m_text_forcemapper->Enable();
132 void anago_wxframe_main::mapper_change_check(wxCommandEvent& event)
134 if(m_check_forcemapper->GetValue() == true){
135 m_text_forcemapper->Enable();
137 m_text_forcemapper->Disable();
141 class MyApp : public wxApp
144 anago_wxframe_main *m_frame;
148 m_frame = new anago_wxframe_main(NULL);