int CXCCRA2RadarCustomizerDlg::customize_radar(t_game game, int theater) { CWaitCursor wait; const string theater_mname[] = {"snow", "temp", "urb", "des", "lun", "ubn"}; const Cfname fname = xcc_dirs::get_dir(game) + "iso" + theater_mname[theater] + ".mix"; if (m_reset) return delete_file(fname); Cmix_file main_mix; int error = main_mix.open(xcc_dirs::get_main_mix(game)); if (!error) { Ccc_file mix_f(false); error = mix_f.open(fname.get_fname(), main_mix); if (!error) { error = mix_f.extract(fname); mix_f.close(); Cfile32 mix_fe; mix_fe.open_edit(fname); Cmix_file mix_f; mix_f.open(mix_fe.h()); for (int i = 0; i < mix_f.get_c_files(); i++) { const int id = mix_f.get_id(i); Ctmp_ts_file f; f.open(id, mix_f); if (f.is_valid()) { for (int j = 0; j < f.get_c_tiles(); j++) { if (!f.get_index()[j]) continue; t_tmp_image_header header = *f.get_image_header(j); if (m_relative) { header.radar_red_left = header.radar_red_left * m_red / 255; header.radar_red_right = header.radar_red_right * m_red / 255; header.radar_green_left = header.radar_green_left * m_green / 255; header.radar_green_right = header.radar_green_right * m_green / 255; header.radar_blue_left = header.radar_blue_left * m_blue / 255; header.radar_blue_right = header.radar_blue_right * m_blue / 255; } else { header.radar_red_left = header.radar_red_right = m_red; header.radar_green_left = header.radar_green_right = m_green; header.radar_blue_left = header.radar_blue_right = m_blue; } mix_fe.seek(mix_f.get_offset(id) + f.get_index()[j]); mix_fe.write(&header, sizeof(t_tmp_image_header)); } } f.close(); } mix_f.close(); mix_fe.close(); } main_mix.close(); } return 0; }
int main() { xcc_dirs::load_from_registry(); Cmix_file::enable_ft_support(); mix_cache::load(); mix_database::load(); check_dir(xcc_dirs::get_dir(game)); check_dir(xcc_dirs::get_cd_dir()); check_dir("f:/"); int known = 0; int total = flist.size(); for (auto& i : flist) known += !mix_database::get_name(game, i.first).empty(); ofstream log_f("c:/log.txt"); for (auto& i : flist) check_name(mix_database::get_name(game, i.first), log_f); if (0) { init_filename_chars(); for (int i = 0; i < 256; i++) { if (filename_chars[i]) log_f << static_cast<char>(i); } log_f << endl; } if (0) { Ccc_file f(true); f.open("c:/temp/filemon.log"); Cvirtual_tfile t; t.load_data(f.vdata()); while (!t.eof()) { Cmulti_line l = t.read_line(); l.get_next_line('\t'); l.get_next_line('\t'); l.get_next_line('\t'); l.get_next_line('\t'); check_name(static_cast<Cfname>(l.get_next_line('\t')).get_fname(), log_f); } f.close(); } if (0) { for (auto& i : flist) { Cfname name = mix_database::get_name(game, i.first); name.set_ext(".hva"); int id = Cmix_file::get_id(game, name); if (flist.find(id) != flist.end() && mix_database::get_name(game, id).empty()) { cout << "found: " << name.get_fname() << endl; log_f << name.get_fname() << '\t' << endl; } } } if (1) { // check_binary_file("c:/games/ra2/game.exe", log_f); // check_binary_file("c:/games/ra2/gamemd.exe", log_f); // check_text_file("c:/temp/missions.pkt", log_f); string name = "c:/temp/"; WIN32_FIND_DATA finddata; HANDLE findhandle = FindFirstFile((name + "*.ini").c_str(), &finddata); if (findhandle != INVALID_HANDLE_VALUE) { do { if (~finddata.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) check_text_file(name + finddata.cFileName, log_f); } while (FindNextFile(findhandle, &finddata)); FindClose(findhandle); } } if (0) { int id = Cmix_file::get_id(game, ""); if (flist.find(id) != flist.end() && mix_database::get_name(game, id).empty()) cout << "not found" << endl; } cout << "Known: " << known << endl << "Total: " << total << endl; mix_cache::save(); return 0; }