PackDetails RenderSystem::CreatePack(uint8_t*data, uint32_t len) { bool result; uint32_t width, height; // Create a new DXTexture DXTexture* temp = new DXTexture; if(!temp) { log_sxerror("RenderSystem", "Ran out of memory to allocate for the texture pack."); return PackDetails(0, 0, 0); } // Initialize the texture result = temp->Initialize(data, len, width, height); if(!result) { log_sxerror("RenderSystem", "Failed to load your texture pack properly."); return PackDetails(0, 0, 0); } // Create a new pack info PackDetails pack(currentPackID++, width, height); // Insert the pack into the map m_Packs.insert(std::pair<uint16_t, DXTexture*>(pack._pack_id, temp)); // Insert the texture info into the other map m_PackInfo.insert(std::pair<uint16_t, PackDetails>(pack._pack_id, pack)); return pack; }
static bool RunMuxing(const std::string& dest_path, const std::string& args) { Gtk::Dialog dlg(BF_("Muxing \"%1%\"") % fs::name_str(dest_path) % bf::stop); SetDialogStrict(dlg, 400, -1); Gtk::TextView& txt_view = NewManaged<Gtk::TextView>(); Execution::Data edat; Gtk::ProgressBar& prg_bar = NewManaged<Gtk::ProgressBar>(); { Gtk::VBox& box = *dlg.get_vbox(); PackStart(box, prg_bar); Gtk::Expander& expdr = PackStart(box, NewManaged<Gtk::Expander>(_("Show/_hide Details"), true)); txt_view.set_editable(false); txt_view.set_size_request(0, 200); expdr.add(PackDetails(txt_view)); dlg.get_action_area()->set_layout(Gtk::BUTTONBOX_CENTER); dlg.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); dlg.signal_response().connect(bb::bind(&OnResponse, boost::ref(edat), _1)); dlg.show_all(); } //dlg.run(); ExitData ed; { Execution::Pulse pls(prg_bar); std::string cmd = boost::format("mplex -f 8 -o %1% %2%") % dest_path % args % bf::stop; AppendCommandText(txt_view, cmd); ed = ExecuteAsync(0, cmd.c_str(), TextViewAppender(txt_view), &edat.pid); } if( !ed.IsGood() && !edat.userAbort ) { MessageBox(_("Muxing error"), Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, BF_("The reason is \"%1%\" (see Details)") % ExitDescription(ed) % bf::stop); dlg.run(); } return ed.IsGood(); }