ostream& VrmlNodeOrientationInt::printFields(ostream& os, int indent) { if (d_key.size() > 0) PRINT_FIELD(key); if (d_keyValue.size() > 0) PRINT_FIELD(keyValue); return os; }
ostream& VrmlNodeAppearance::printFields(ostream& os, int indent) { if (d_material.get()) PRINT_FIELD(material); if (d_texture.get()) PRINT_FIELD(texture); if (d_textureTransform.get()) PRINT_FIELD(textureTransform); return os; }
static void info_mach_task_command (char *args, int from_tty) { union { struct task_basic_info basic; struct task_events_info events; struct task_thread_times_info thread_times; } task_info_data; kern_return_t result; unsigned int info_count; task_t task; task = get_task_from_args (args); if (task == TASK_NULL) return; printf_unfiltered (_("TASK_BASIC_INFO for 0x%x:\n"), task); info_count = TASK_BASIC_INFO_COUNT; result = task_info (task, TASK_BASIC_INFO, (task_info_t) & task_info_data.basic, &info_count); MACH_CHECK_ERROR (result); PRINT_FIELD (&task_info_data.basic, suspend_count); PRINT_FIELD (&task_info_data.basic, virtual_size); PRINT_FIELD (&task_info_data.basic, resident_size); PRINT_TV_FIELD (&task_info_data.basic, user_time); PRINT_TV_FIELD (&task_info_data.basic, system_time); printf_unfiltered (_("\nTASK_EVENTS_INFO:\n")); info_count = TASK_EVENTS_INFO_COUNT; result = task_info (task, TASK_EVENTS_INFO, (task_info_t) & task_info_data.events, &info_count); MACH_CHECK_ERROR (result); PRINT_FIELD (&task_info_data.events, faults); #if 0 PRINT_FIELD (&task_info_data.events, zero_fills); PRINT_FIELD (&task_info_data.events, reactivations); #endif PRINT_FIELD (&task_info_data.events, pageins); PRINT_FIELD (&task_info_data.events, cow_faults); PRINT_FIELD (&task_info_data.events, messages_sent); PRINT_FIELD (&task_info_data.events, messages_received); printf_unfiltered (_("\nTASK_THREAD_TIMES_INFO:\n")); info_count = TASK_THREAD_TIMES_INFO_COUNT; result = task_info (task, TASK_THREAD_TIMES_INFO, (task_info_t) & task_info_data.thread_times, &info_count); MACH_CHECK_ERROR (result); PRINT_TV_FIELD (&task_info_data.thread_times, user_time); PRINT_TV_FIELD (&task_info_data.thread_times, system_time); }
ostream &VrmlNodeTextureSample::printFields(ostream &os, int indent) { if (!d_sampleNum.get()) PRINT_FIELD(sampleNum); if (!d_repeatS.get()) PRINT_FIELD(repeatS); if (!d_repeatT.get()) PRINT_FIELD(repeatT); if (d_environment.get()) PRINT_FIELD(environment); return os; }
ostream &VrmlNodeTimesteps::printFields(ostream &os, int indent) { if (!d_numTimesteps.get()) PRINT_FIELD(numTimesteps); if (!d_enabled.get()) PRINT_FIELD(enabled); if (!d_loop.get()) PRINT_FIELD(loop); if (!d_fraction_changed.get()) PRINT_FIELD(fraction_changed); return os; }
ostream &VrmlNodeClippingPlane::printFields(ostream &os, int indent) { if (!d_global.get()) PRINT_FIELD(global); if (!d_enabled.get()) PRINT_FIELD(enabled); if (!d_position.get()) PRINT_FIELD(position); if (!d_orientation.get()) PRINT_FIELD(orientation); if (!d_number.get()) PRINT_FIELD(number); return os; }
ostream& VrmlNodeVisibilitySensor::printFields(ostream& os, int indent) { if (! FPZERO(d_center.x()) || ! FPZERO(d_center.y()) || ! FPZERO(d_center.z()) ) PRINT_FIELD(center); if (! d_enabled.get()) PRINT_FIELD(enabled); if (! FPZERO(d_size.x()) || ! FPZERO(d_size.y()) || ! FPZERO(d_size.z()) ) PRINT_FIELD(size); return os; }
ostream& VrmlNodeNavigationInfo::printFields(ostream& os, int indent) { if (d_avatarSize.size() != 3 || ! FPEQUAL(d_avatarSize[0], 0.25) || ! FPEQUAL(d_avatarSize[1], 1.6) || ! FPEQUAL(d_avatarSize[2], 0.75) ) PRINT_FIELD(avatarSize); if (! d_headlight.get()) PRINT_FIELD(headlight); if (! FPEQUAL(d_speed.get(), 1.0)) PRINT_FIELD(speed); if (d_type.size() != 2 || strcmp(d_type[0], "WALK") != 0 || strcmp(d_type[1], "ANY") != 0 ) PRINT_FIELD(type); if (! FPZERO(d_visibilityLimit.get())) PRINT_FIELD(visibilityLimit); return os; }
static void info_mach_thread_command (char *args, int from_tty) { union { struct thread_basic_info basic; } thread_info_data; thread_t thread; kern_return_t result; unsigned int info_count; CHECK_ARGS (_("Thread"), args); sscanf (args, "0x%x", &thread); printf_unfiltered (_("THREAD_BASIC_INFO\n")); info_count = THREAD_BASIC_INFO_COUNT; result = thread_info (thread, THREAD_BASIC_INFO, (thread_info_t) & thread_info_data.basic, &info_count); MACH_CHECK_ERROR (result); #if 0 PRINT_FIELD (&thread_info_data.basic, user_time); PRINT_FIELD (&thread_info_data.basic, system_time); #endif PRINT_FIELD (&thread_info_data.basic, cpu_usage); PRINT_FIELD (&thread_info_data.basic, run_state); PRINT_FIELD (&thread_info_data.basic, flags); PRINT_FIELD (&thread_info_data.basic, suspend_count); PRINT_FIELD (&thread_info_data.basic, sleep_time); }
ostream& VrmlNodeViewpoint::printFields(ostream& os, int indent) { if (! FPEQUAL( d_fieldOfView.get(), DEFAULT_FIELD_OF_VIEW)) PRINT_FIELD(fieldOfView); if (! d_jump.get()) PRINT_FIELD(jump); if (! FPZERO(d_orientation.x()) || ! FPZERO(d_orientation.y()) || ! FPEQUAL(d_orientation.z(), 1.0) || ! FPZERO(d_orientation.r()) ) PRINT_FIELD(orientation); if (! FPZERO(d_position.x()) || ! FPZERO(d_position.y()) || ! FPEQUAL(d_position.z(), 10.0) ) PRINT_FIELD(position); if (d_description.get()) PRINT_FIELD(description); return os; }
ostream& VrmlNodePlaneSensor::printFields(ostream& os, int indent) { if (! d_autoOffset.get()) PRINT_FIELD(autoOffset); if (! d_enabled.get()) PRINT_FIELD(enabled); if (! FPEQUAL(d_maxPosition.x(), -1.0) || ! FPEQUAL(d_maxPosition.y(), -1.0)) PRINT_FIELD(maxPosition); if (! FPEQUAL(d_minPosition.x(), -1.0) || ! FPEQUAL(d_minPosition.y(), -1.0)) PRINT_FIELD(minPosition); if (! FPZERO(d_offset.x()) || ! FPZERO(d_offset.y()) || ! FPZERO(d_offset.z()) ) PRINT_FIELD(offset); return os; }
ostream& VrmlNodeTextureTransform::printFields(ostream& os, int indent) { if (! FPZERO(d_center.x()) || ! FPZERO(d_center.y())) PRINT_FIELD(center); if (! FPZERO(d_rotation.get())) PRINT_FIELD(rotation); if (! FPEQUAL(d_scale.x(), 1.0) || ! FPEQUAL(d_scale.y(), 1.0)) PRINT_FIELD(scale); if (! FPZERO(d_translation.x()) || ! FPZERO(d_translation.y())) PRINT_FIELD(translation); return os; }
ostream& VrmlNodeMovieTexture::printFields(ostream& os, int indent) { if (d_loop.get()) PRINT_FIELD(loop); if (!FPEQUAL(d_speed.get(), 1.0)) PRINT_FIELD(speed); if (!FPZERO(d_startTime.get())) PRINT_FIELD(startTime); if (!FPZERO(d_stopTime.get())) PRINT_FIELD(stopTime); if (d_url.get()) PRINT_FIELD(url); if (! d_repeatS.get()) PRINT_FIELD(repeatS); if (! d_repeatT.get()) PRINT_FIELD(repeatT); return os; }
int let2phon_callout(pcre_callout_block *match_info) { int i; #if 0 PRINT_FIELD(subject_length); PRINT_FIELD(start_match); PRINT_FIELD(current_position); PRINT_FIELD(capture_top); PRINT_FIELD(capture_last); PRINT_FIELD(pattern_position); PRINT_FIELD(next_item_length); /* for (i=0; i < match_info->capture_top; i++) printf(": %d", match_info->offset_vector[i]); printf("\n"); */ #endif /* * A pcre ?C callout has been encountered during pattern match. * It could be information about a left context that needs matching * or the rule number we have just matched. */ if (match_info->callout_number <= num_left_context) return left_matches(match_info); if (match_info->callout_number >= CALLOUT_START+CALLOUT_NUM_BASE) l_match_pos[match_info->start_match]=9*CALLOUT_NUM_BASE+ match_info->callout_number; else { for (i=match_info->start_match+1; i < MAX_MATCH_POINTS; i++) l_match_pos[i]=0; if (l_match_pos[match_info->start_match] > 10*CALLOUT_NUM_BASE) l_match_pos[match_info->start_match]=CALLOUT_NUM_BASE* (l_match_pos[match_info->start_match]-10*CALLOUT_NUM_BASE-CALLOUT_START)+ match_info->callout_number-CALLOUT_START; else l_match_pos[match_info->start_match]=match_info->callout_number- CALLOUT_START; } #if DEBUG_L2P printf("(%d:%d) ", match_info->callout_number-CALLOUT_START, match_info->start_match); printf("%d", l_match_pos[match_info->start_match]); #endif return 0; }
ostream &VrmlNodeMultiTouchSensor::printFields(ostream &os, int indent) { if (!d_trackObjects.get()) PRINT_FIELD(trackObjects); if (!d_freeze.get()) PRINT_FIELD(freeze); if (!d_enabled.get()) PRINT_FIELD(enabled); if (!d_currentCamera.get()) PRINT_FIELD(currentCamera); if (!FPEQUAL(d_size.x(), -1.0) || !FPEQUAL(d_size.y(), -1.0)) PRINT_FIELD(size); if (!FPEQUAL(d_minPosition.x(), -1.0) || !FPEQUAL(d_minPosition.y(), -1.0)) PRINT_FIELD(minPosition); return os; }
int main(int argc, const char *argv[]) { int i, fd; Elf *pelf = NULL; char *id, bytes[5]; size_t n = 0; Elf32_Phdr *phdr32 = NULL; GElf_Phdr gphdr = { 0 }; if (argc != 2) errx(EXIT_FAILURE, "usage: %s file-name", argv[0]); if (elf_version(EV_CURRENT) == EV_NONE) errx(EXIT_FAILURE, "ELF library initialization " "failed: %s", elf_errmsg(-1)); if ((fd = open(argv[1], O_RDONLY, 0)) < 0) errx(EXIT_FAILURE, "open \"%s\" failed", argv[1]); if ((pelf = elf_begin(fd, ELF_C_READ, NULL)) == NULL) errx(EXIT_FAILURE, "elf_begin() failed: %s", elf_errmsg(-1)); if (elf_kind(pelf) != ELF_K_ELF) errx(EXIT_FAILURE, "\"%s\" is not an ELF object.", argv[1]); // get the num of program header table if (elf_getphdrnum(pelf, &n) != 0) errx(EXIT_FAILURE, "elf_getphdrnum() failed: %s.", elf_errmsg(-1)); #if 0 // 32bit if ((phdr32 = elf32_getphdr(pelf)) == NULL) errx(EXIT_FAILURE, "elf32_getphdr() failed: %s.", elf_errmsg(-1)); for (i = 0; i < n; i++) { Elf32_Phdr phdr = phdr32[i]; printf("PHDR %d:\n", i); #define PRINT_FMT " %-20s 0x%jx" #define PRINT_FIELD(N) do { printf(PRINT_FMT, #N, (uintmax_t)phdr.N); } while (0); #define NL() do { printf("\n"); } while (0); PRINT_FIELD(p_type); print_ptype(phdr.p_type); NL(); PRINT_FIELD(p_offset); NL(); PRINT_FIELD(p_vaddr); NL(); PRINT_FIELD(p_paddr); NL(); PRINT_FIELD(p_filesz); NL(); PRINT_FIELD(p_memsz); NL(); PRINT_FIELD(p_flags); printf(" ["); if (phdr.p_flags & PF_X) printf(" execute"); if (phdr.p_flags & PF_R) printf(" read"); if (phdr.p_flags & PF_W) printf(" write"); printf(" ]"); NL(); PRINT_FIELD(p_align); NL(); } #endif #if 1 for (i = 0; i < n; i++) { // get every entry fist if (gelf_getphdr(pelf, i, &gphdr) != &gphdr) errx(EXIT_FAILURE, "gelf_getphdr() failed: %s.", elf_errmsg(-1)); // now print every entry printf("PHDR %d:\n", i); #define PRINT_FMT " %-20s 0x%jx" #define PRINT_FIELD(N) do { printf(PRINT_FMT, #N, (uintmax_t)gphdr.N); } while (0); #define NL() do { printf("\n"); } while (0); PRINT_FIELD(p_type); print_ptype(gphdr.p_type); NL(); PRINT_FIELD(p_offset); NL(); PRINT_FIELD(p_vaddr); NL(); PRINT_FIELD(p_paddr); NL(); PRINT_FIELD(p_filesz); NL(); PRINT_FIELD(p_memsz); NL(); PRINT_FIELD(p_flags); ; printf(" ["); if (gphdr.p_flags & PF_X) printf(" execute"); if (gphdr.p_flags & PF_R) printf(" read"); if (gphdr.p_flags & PF_W) printf(" write"); printf(" ]"); NL(); PRINT_FIELD(p_align); NL(); } #endif elf_end(pelf); close(fd); exit(EXIT_SUCCESS); }
ostream& VrmlNodeSwitch::printFields(ostream& os, int indent) { if (d_choice.size() > 0) PRINT_FIELD(choice); if (d_whichChoice.get() != -1) PRINT_FIELD(whichChoice); return os; }
int phon2let_callout(pcre_callout_block *match_info) { int i; #if 0 PRINT_FIELD(subject_length); PRINT_FIELD(start_match); PRINT_FIELD(current_position); PRINT_FIELD(capture_top); PRINT_FIELD(capture_last); PRINT_FIELD(pattern_position); PRINT_FIELD(next_item_length); /* for (i=0; i < match_info->capture_top; i++) printf(": %d", match_info->offset_vector[i]); printf("\n"); */ #endif /* * A pcre ?C callout has been encountered during pattern match. * It could be information about a left context that needs matching * or the rule number we have just matched. */ if (match_info->callout_number == 255) // Unconditionally fail { save_gen_word(gen_word); return 1; } if (match_info->callout_number >= CALLOUT_NUM_BASE) { /* * Adding in another CALLOUT_NUM_BASE lets the next call * distinguish between a 'stale' value and a partially * created value that it needs to complete. */ p2l_callout_num=9*CALLOUT_NUM_BASE+match_info->callout_number; return 0; } else { if (p2l_callout_num > 10*CALLOUT_NUM_BASE) p2l_callout_num=CALLOUT_NUM_BASE* (p2l_callout_num-10*CALLOUT_NUM_BASE)+ match_info->callout_number; else p2l_callout_num=match_info->callout_number; if (match_gen_word(p2l_callout_num)) { for (i=match_info->start_match+1; i < MAX_MATCH_POINTS; i++) p_match_pos[i]=0; if (match_info->start_match == 0) gen_word[0]='\0'; else { if (p_match_pos[match_info->start_match] == 0) p_match_pos[match_info->start_match]=strlen(gen_word); else gen_word[p_match_pos[match_info->start_match]]='\0'; } strcat(gen_word, phon_rule_let_seq[p2l_callout_num]); } else return 1; } #if DEBUG_P2L printf("[%d:%d:%d] ", match_info->callout_number, match_info->start_match, p_match_pos[match_info->start_match]); #endif return 0; }
int main (void) { srand(time(0)); struct StringDatabase* D = databaseInit(); FILE* databaseFile = fopen ("base.txt", "r"); databaseRead(D, databaseFile); //BTreePrintTree(D->root, 0, stdout); fclose (databaseFile); //return; // databasePrint(D, stdout); // printf ("%d\n", databaseFindPrefix(D, "")); char array[SIZE * SIZE] = {}; array[0] = 'b'; array[1] = 'a'; array[2] = 's'; array[3] = 'i'; array[4] = 's'; //array[9] = 's'; //array[7] = 'd'; char result[SIZE * SIZE] = {}; databaseRemove(D, "basis"); #define PRINT_FIELD(field) \ {\ int i, j;\ for (i = 0; i < SIZE; i++)\ { \ for ( j = 0; j < SIZE; j++) \ printf("%c ", array[SIZE * i + j] ? array[SIZE * i + j] : '-');\ printf ("\n");\ }\ } PRINT_FIELD(array); int k; for (k = 0; k < SIZE * SIZE; k++) { int location = 0; char inserted = 0; computerNext (array, SIZE, SIZE, D, result, &location, &inserted); printf ("result = %s, location = (%d, %d), inserted = %c\n", result, location / SIZE + 1, location % SIZE + 1, inserted); if (inserted == 0) break; databaseRemove(D, result); memset(result, 0, SIZE * SIZE); array[location] = inserted; PRINT_FIELD(array); } //*/ databaseDestroy(D); }
static void info_mach_thread_command (char *args, int from_tty) { union { struct thread_basic_info basic; } thread_info_data; thread_t thread; kern_return_t result; unsigned int info_count; CHECK_ARGS ("Thread", args); sscanf (args, "0x%x", &thread); printf_unfiltered ("THREAD_BASIC_INFO\n"); info_count = THREAD_BASIC_INFO_COUNT; result = thread_info (thread, THREAD_BASIC_INFO, (thread_info_t) & thread_info_data.basic, &info_count); MACH_CHECK_ERROR (result); #if 0 PRINT_FIELD (&thread_info_data.basic, user_time); PRINT_FIELD (&thread_info_data.basic, system_time); #endif PRINT_FIELD (&thread_info_data.basic, cpu_usage); PRINT_FIELD (&thread_info_data.basic, run_state); PRINT_FIELD (&thread_info_data.basic, flags); PRINT_FIELD (&thread_info_data.basic, suspend_count); PRINT_FIELD (&thread_info_data.basic, sleep_time); #ifdef __ppc__ { union { struct __darwin_ppc_thread_state thread; struct __darwin_ppc_exception_state exception; } thread_state; int register_count, i; unsigned int *register_data; info_count = PPC_THREAD_STATE_COUNT; result = thread_get_state (thread, PPC_THREAD_STATE, (thread_state_t) & thread_state.thread, &info_count); MACH_CHECK_ERROR (result); printf_unfiltered ("\nPPC_THREAD_STATE \n"); register_data = &thread_state.thread.__r0; register_count = 0; for (i = 0; i < 8; ++i) { printf_unfiltered ("r%02d: 0x%08x ", register_count++, *register_data++); printf_unfiltered ("r%02d: 0x%08x ", register_count++, *register_data++); printf_unfiltered ("r%02d: 0x%08x ", register_count++, *register_data++); printf_unfiltered ("r%02d: 0x%08x\n", register_count++, *register_data++); } printf_unfiltered ("srr0: 0x%08x srr1: 0x%08x\n", thread_state.thread.__srr0, thread_state.thread.__srr1); printf_unfiltered ("cr: 0x%08x xer: 0x%08x\n", thread_state.thread.__cr, thread_state.thread.__xer); printf_unfiltered ("lr: 0x%08x ctr: 0x%08x\n", thread_state.thread.__lr, thread_state.thread.__ctr); } #endif }
int dump_bic() { Bic bic; if (!ReadC3CMemory(BIC_ADDR, &bic, sizeof(Bic))) { return 1; } PRINT_STR(bic, BIC); PRINT_FIELD_BUF(bic, no_idea_1, "%p"); PRINT_FIELD(bic, biqFilenamePtr, "%p"); PRINT_FIELD_BUF(bic, no_idea_2, "%p"); PRINT_STR(bic, pathNoExt); PRINT_STR(bic, pathWithExt); PRINT_STR(bic, c3cPath); PRINT_STR(bic, ptwPath); PRINT_FIELD_BUF(bic, no_idea_3, "%p"); PRINT_STR(bic, saveTmp); PRINT_STR(bic, no_idea_4); PRINT_FIELD_BUF(bic, no_idea_5, "%p"); PRINT_FIELD(bic, nTechs, "%d"); PRINT_FIELD(bic, nUnits, "%d"); PRINT_FIELD(bic, nBuildings, "%d"); PRINT_FIELD(bic, no_idea_6, "%d"); PRINT_FIELD(bic, nCitizens, "%d"); PRINT_FIELD(bic, no_idea_6b, "%d"); PRINT_FIELD(bic, nCulturalOpinions, "%d"); PRINT_FIELD(bic, nDifficultyLevels, "%d"); PRINT_FIELD_BUF(bic, no_idea_6c, "%d"); PRINT_FIELD(bic, nResources, "%d"); PRINT_FIELD(bic, no_idea_7, "%d"); PRINT_FIELD(bic, nPlayers, "%d"); PRINT_FIELD_BUF(bic, no_idea_8, "%d"); PRINT_STR(bic, description); PRINT_STR(bic, scenarioTitle); PRINT_FIELD(bic, no_idea_9, "%p"); PRINT_FIELD(bic, buildingsPtr, "%p"); PRINT_FIELD(bic, citizensPtr, "%p"); PRINT_FIELD(bic, cityNamesPtr, "%p"); PRINT_FIELD(bic, no_idea_10, "%p"); PRINT_FIELD(bic, culturePtr, "%p"); PRINT_FIELD(bic, difficultyPtr, "%p"); PRINT_FIELD(bic, erasPtr, "%p"); PRINT_FIELD(bic, espionagePtr, "%p"); PRINT_FIELD(bic, experiencePtr, "%p"); PRINT_FIELD_BUF(bic, no_idea_11, "%p"); PRINT_FIELD(bic, no_idea_12_ptr, "%p"); PRINT_FIELD(bic, no_idea_13_ptr, "%p"); PRINT_FIELD_BUF(bic, no_idea_14, "%p"); PRINT_FIELD(bic, autoPlaceCaptureUnits, "%d"); PRINT_FIELD(bic, autoPlaceKingUnits, "%d"); PRINT_FIELD(bic, autoPlaceVictoryLocations, "%d"); PRINT_FIELD(bic, useDebugMode, "%d"); PRINT_FIELD(bic, useTimeLimits, "%d"); PRINT_FIELD(bic, baseTimeUnit, "%d"); PRINT_FIELD(bic, startMonth, "%d"); PRINT_FIELD(bic, startWeek, "%d"); PRINT_FIELD(bic, startYear, "%d"); PRINT_FIELD(bic, timeLimitMinutes, "%d"); PRINT_FIELD(bic, timeLimitTurns, "%d"); PRINT_FIELD_BUF(bic, timeScaleTurns, "%d"); PRINT_FIELD_BUF(bic, timeScaleUnits, "%d"); PRINT_FIELD(bic, victoryPointLimit, "%d"); PRINT_FIELD(bic, cityEliminationCount, "%d"); PRINT_FIELD(bic, cultureVictoryCity, "%d"); PRINT_FIELD(bic, cultureVictoryCiv, "%d"); PRINT_FIELD(bic, terrainForDomination, "%d"); PRINT_FIELD(bic, populationForDomination, "%d"); PRINT_FIELD(bic, wonderVP, "%d"); PRINT_FIELD(bic, defeatUnitVP, "%d"); PRINT_FIELD(bic, advanceVP, "%d"); PRINT_FIELD(bic, cityConquestVP, "%d"); PRINT_FIELD(bic, victoryPointLocationVP, "%d"); PRINT_FIELD(bic, captureUnitVP, "%d"); PRINT_FIELD(bic, captureUnitGold, "%d"); PRINT_FIELD(bic, no_idea_15, "%d"); PRINT_STR(bic, scenarioSearchFolders); PRINT_FIELD_BUF(bic, no_idea_16, "%p"); PRINT_STR(bic, alliance1Name); PRINT_STR(bic, alliance2Name); PRINT_STR(bic, alliance3Name); PRINT_STR(bic, alliance4Name); PRINT_FIELD_BUF(bic, no_idea_17, "%p"); PRINT_STR(bic, scenarioTitle2); PRINT_FIELD_BUF(bic, no_idea_18, "%p"); PRINT_FIELD(bic, racesPtr, "%p"); PRINT_FIELD(bic, resourcesPtr, "%p"); PRINT_FIELD(bic, govtsPtr, "%p"); PRINT_FIELD(bic, playersPtr, "%p"); PRINT_FIELD(bic, unitsPtr, "%p"); PRINT_FIELD(bic, menuArtPtr, "%p"); PRINT_FIELD(bic, no_idea_19, "%p"); PRINT_STR(bic, citySize1); PRINT_STR(bic, citySize2); PRINT_STR(bic, citySize3); PRINT_FIELD_BUF(bic, no_idea_20, "%p"); PRINT_FIELD(bic, culturalLevelsPtr, "%p"); PRINT_FIELD(bic, levelMultiplier, "%d"); PRINT_FIELD(bic, nCulturalLevels, "%d"); PRINT_FIELD(bic, borderFactor, "%d"); PRINT_FIELD(bic, futureTechCost, "%d"); PRINT_FIELD_BUF(bic, no_idea_21, "%p"); PRINT_FIELD(bic, techsPtr, "%p"); PRINT_FIELD(bic, workerJobsPtr, "%p"); PRINT_FIELD(bic, terrainPtr, "%p"); PRINT_FIELD(bic, no_idea_22_ptr, "%p"); PRINT_FIELD(bic, worldSizesPtr, "%p"); PRINT_FIELD(bic, flavorsPtrPtr, "%p"); PRINT_FIELD(bic, screenWidthPixels, "%d"); PRINT_FIELD(bic, screenHeightPixels, "%d"); PRINT_FIELD(bic, no_idea_24, "%p"); return 0; }
int dump_unit(int unitId) { uint32_t unitsPtr; uint32_t unitValid, unitValidPtr; uint32_t unitPtr, unitPtrPtr; if (!ReadC3CMemory(UNITS_BEGIN_ADDR, &unitsPtr, sizeof(uint32_t))) { return 1; } unitValidPtr = unitsPtr + unitId * 2 * sizeof(uint32_t); if (!ReadC3CMemory(unitValidPtr, &unitValid, sizeof(uint32_t))) { return 1; } unitPtrPtr = unitValidPtr + sizeof(uint32_t); if (unitValid != 0xffffffff) { fprintf(stderr, "Invalid unit id: %d\n", unitId); return 1; } else { Unit unit; if (!ReadC3CMemory(unitPtrPtr, &unitPtr, sizeof(uint32_t))) { return 1; } if (!unitPtr) { fprintf(stderr, "Error: NULL pointer\n"); return 1; } if (!ReadC3CMemory(unitPtr, &unit, sizeof(Unit))) { return 1; } PRINT_FIELD(unit, no_idea_1, "%p"); PRINT_FIELD(unit, id, "%d"); PRINT_FIELD(unit, x, "%d"); PRINT_FIELD(unit, y, "%d"); PRINT_FIELD(unit, prevx, "%d"); PRINT_FIELD(unit, prevy, "%d"); PRINT_FIELD(unit, owner, "%d"); PRINT_FIELD(unit, nationality, "%d"); PRINT_FIELD(unit, no_idea_3, "%d"); PRINT_FIELD(unit, type, "%d"); PRINT_FIELD(unit, experience, "%d"); PRINT_FIELD(unit, no_idea_4, "%d"); PRINT_FIELD(unit, damage, "%d"); PRINT_FIELD(unit, usedMovement, "%d"); PRINT_FIELD(unit, no_idea_5, "%d"); PRINT_FIELD(unit, workerAction, "%d"); PRINT_FIELD_BUF(unit, no_idea_6, "%d"); PRINT_FIELD(unit, fortified, "%d"); PRINT_FIELD(unit, endTurn, "%d"); PRINT_FIELD_BUF(unit, no_idea_7, "%d"); PRINT_STR(unit, name); PRINT_FIELD_BUF(unit, no_idea_8, "%d"); PRINT_FIELD_BUF(unit, no_idea_9, "%d"); } return 0; }
int dump_lead(int leadId) { Leader lead; if (!ReadC3CMemory(LEADERS_BEGIN_ADDR + leadId * sizeof(Leader), &lead, sizeof(Leader))) { return 1; } PRINT_STR(lead, LEAD); PRINT_FIELD_BUF(lead, no_idea_1, "%p"); PRINT_FIELD(lead, id, "%d"); PRINT_FIELD(lead, nationality, "%d"); PRINT_FIELD_BUF(lead, no_idea_2, "%p"); PRINT_FIELD(lead, capitalCityId, "%d"); PRINT_FIELD_BUF(lead, no_idea_3, "%p"); PRINT_FIELD(lead, posGold, "%d"); PRINT_FIELD(lead, negGold, "%d"); PRINT_FIELD_BUF(lead, no_idea_4, "%p"); PRINT_FIELD(lead, govt, "%d"); PRINT_FIELD_BUF(lead, no_idea_5, "%p"); PRINT_FIELD(lead, beakers, "%d"); PRINT_FIELD(lead, researchTech, "%d"); PRINT_FIELD_BUF(lead, no_idea_6, "%p"); PRINT_FIELD(lead, nUnits, "%d"); PRINT_FIELD_BUF(lead, no_idea_7, "%p"); PRINT_FIELD(lead, luxury, "%d"); PRINT_FIELD(lead, science, "%d"); PRINT_FIELD(lead, tax, "%d"); PRINT_FIELD_BUF(lead, no_idea_8, "%p"); PRINT_FIELD_BUF(lead, contacts, "%d"); PRINT_FIELD_BUF(lead, no_idea_9, "%p"); PRINT_FIELD(lead, color, "%d"); PRINT_FIELD(lead, leaderName, "%s"); PRINT_FIELD(lead, leaderTitle, "%s"); PRINT_FIELD(lead, civName, "%s"); PRINT_FIELD(lead, noun, "%s"); PRINT_FIELD(lead, adjective, "%s"); PRINT_FIELD_BUF(lead, no_idea_10, "%p"); PRINT_FIELD_BUF(lead, no_idea_11, "%p"); PRINT_FIELD_BUF(lead, no_idea_12, "%p"); PRINT_FIELD(lead, password, "%s"); PRINT_FIELD_BUF(lead, no_idea_13, "%p"); return 0; }
int dump_city(int cityId) { uint32_t citiesPtr; uint32_t cityValid, cityValidPtr; uint32_t cityPtr, cityPtrPtr; if (!ReadC3CMemory(CITIES_BEGIN_ADDR, &citiesPtr, sizeof(uint32_t))) { return 1; } cityValidPtr = citiesPtr + 2 * cityId * sizeof(uint32_t); if (!ReadC3CMemory(cityValidPtr, &cityValid, sizeof(uint32_t))) { return 1; } cityPtrPtr = cityValidPtr + sizeof(uint32_t); if (cityValid != 0xffffffff) { fprintf(stderr, "Invalid city id: %d\n", cityId); return 1; } else { City city; if (!ReadC3CMemory(cityPtrPtr, &cityPtr, sizeof(uint32_t))) { return 1; } if (!cityPtr) { fprintf(stderr, "Error: NULL pointer\n"); return 1; } if (!ReadC3CMemory(cityPtr, &city, sizeof(City))) { return 1; } PRINT_FIELD(city, no_idea_1, "%p"); PRINT_FIELD(city, id, "%d"); PRINT_FIELD(city, x, "%d"); PRINT_FIELD(city, y, "%d"); PRINT_FIELD(city, owner, "%d"); PRINT_FIELD_BUF(city, no_idea_2, "%p"); PRINT_FIELD(city, currentFood, "%d"); PRINT_FIELD(city, currentShields, "%d"); PRINT_FIELD(city, pollution, "%p"); PRINT_FIELD(city, currentBuild, "%d"); PRINT_FIELD(city, currentBuildType, "%d"); PRINT_FIELD(city, numImprovements, "%d"); PRINT_FIELD_BUF(city, no_idea_4, "%p"); PRINT_FIELD(city, BINF, "%p"); PRINT_FIELD_BUF(city, no_idea_5, "%p"); PRINT_FIELD(city, citizenPtr, "%p"); PRINT_FIELD_BUF(city, no_idea_6, "%p"); PRINT_FIELD(city, population, "%d"); PRINT_FIELD(city, culturePerTurn, "%d"); PRINT_FIELD_BUF(city, culture, "%d"); PRINT_FIELD_BUF(city, no_idea_8, "%p"); PRINT_FIELD(city, name, "%s"); PRINT_FIELD_BUF(city, no_idea_9, "%p"); PRINT_FIELD_BUF(city, buildings, "%p"); } return 0; }