commit 54061f1eb7fbcb4239272001bb74ab513677737a Author: ddidderr Date: Sat Aug 22 15:52:52 2026 +0200 init diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2f7896d --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +target/ diff --git a/original/COVERAGE.tsv b/original/COVERAGE.tsv new file mode 100644 index 0000000..58287dc --- /dev/null +++ b/original/COVERAGE.tsv @@ -0,0 +1,110 @@ +record name_or_start end bytes detail +block Code1 1000:fe39 65082 r=true,w=false,x=true,initialized=true +block Code2 1008:30c4 12485 r=true,w=false,x=true,initialized=true +block Code3 1010:05eb 1516 r=true,w=false,x=true,initialized=true +block Code4 1018:1f79 8058 r=true,w=false,x=true,initialized=true +block Code5 1020:1722 5923 r=true,w=false,x=true,initialized=true +block Data6 1028:4d39 19770 r=true,w=true,x=false,initialized=true +block Rsrc0 1030:15ff 5632 r=true,w=false,x=false,initialized=true +block Rsrc1 1038:15ff 5632 r=true,w=false,x=false,initialized=true +block Rsrc2 1040:15ff 5632 r=true,w=false,x=false,initialized=true +block Rsrc3 1048:15ff 5632 r=true,w=false,x=false,initialized=true +block Rsrc4 1050:15ff 5632 r=true,w=false,x=false,initialized=true +block Rsrc5 1058:15ff 5632 r=true,w=false,x=false,initialized=true +block Rsrc6 1060:15ff 5632 r=true,w=false,x=false,initialized=true +block Rsrc7 1068:15ff 5632 r=true,w=false,x=false,initialized=true +block Rsrc8 1071:7eff 98048 r=true,w=false,x=false,initialized=true +block Rsrc9 1078:52ff 21248 r=true,w=false,x=false,initialized=true +block Rsrc10 1080:52ff 21248 r=true,w=false,x=false,initialized=true +block Rsrc11 1088:52ff 21248 r=true,w=false,x=false,initialized=true +block Rsrc12 1090:52ff 21248 r=true,w=false,x=false,initialized=true +block Rsrc13 1098:10ff 4352 r=true,w=false,x=false,initialized=true +block Rsrc14 10a0:10ff 4352 r=true,w=false,x=false,initialized=true +block Rsrc15 10a8:10ff 4352 r=true,w=false,x=false,initialized=true +block Rsrc16 10b0:10ff 4352 r=true,w=false,x=false,initialized=true +block Rsrc17 10b8:10ff 4352 r=true,w=false,x=false,initialized=true +block Rsrc18 10c0:10ff 4352 r=true,w=false,x=false,initialized=true +block Rsrc19 10c8:10ff 4352 r=true,w=false,x=false,initialized=true +block Rsrc20 10d0:10ff 4352 r=true,w=false,x=false,initialized=true +block Rsrc21 10d8:10ff 4352 r=true,w=false,x=false,initialized=true +block Rsrc22 10e4:10ff 266496 r=true,w=false,x=false,initialized=true +block Rsrc23 10e8:0fff 4096 r=true,w=false,x=false,initialized=true +block Rsrc24 10f1:a6ff 108288 r=true,w=false,x=false,initialized=true +block Rsrc25 10f8:0cff 3328 r=true,w=false,x=false,initialized=true +block Rsrc26 1104:7eff 294656 r=true,w=false,x=false,initialized=true +block Rsrc27 110c:7eff 294656 r=true,w=false,x=false,initialized=true +block Rsrc28 1114:7eff 294656 r=true,w=false,x=false,initialized=true +block Rsrc29 111c:7eff 294656 r=true,w=false,x=false,initialized=true +block Rsrc30 1124:7eff 294656 r=true,w=false,x=false,initialized=true +block Rsrc31 112c:7eff 294656 r=true,w=false,x=false,initialized=true +block Rsrc32 1134:7eff 294656 r=true,w=false,x=false,initialized=true +block Rsrc33 113c:7eff 294656 r=true,w=false,x=false,initialized=true +block Rsrc34 1140:02ff 768 r=true,w=false,x=false,initialized=true +block Rsrc35 1148:18ff 6400 r=true,w=false,x=false,initialized=true +block Rsrc36 1150:11ff 4608 r=true,w=false,x=false,initialized=true +block Rsrc37 1158:1dff 7680 r=true,w=false,x=false,initialized=true +block Rsrc38 1160:0bff 3072 r=true,w=false,x=false,initialized=true +block Rsrc39 1168:76ff 30464 r=true,w=false,x=false,initialized=true +block Rsrc40 1170:98ff 39168 r=true,w=false,x=false,initialized=true +block Rsrc41 1178:1aff 6912 r=true,w=false,x=false,initialized=true +block Rsrc42 1180:01ff 512 r=true,w=false,x=false,initialized=true +block Rsrc43 1188:b5ff 46592 r=true,w=false,x=false,initialized=true +block Rsrc44 1190:1fff 8192 r=true,w=false,x=false,initialized=true +block Rsrc45 1198:0dff 3584 r=true,w=false,x=false,initialized=true +block Rsrc46 11a0:88ff 35072 r=true,w=false,x=false,initialized=true +block Rsrc47 11a8:14ff 5376 r=true,w=false,x=false,initialized=true +block Rsrc48 11b0:75ff 30208 r=true,w=false,x=false,initialized=true +block Rsrc49 11b8:0cff 3328 r=true,w=false,x=false,initialized=true +block Rsrc50 11c0:56ff 22272 r=true,w=false,x=false,initialized=true +block Rsrc51 11c8:00ff 256 r=true,w=false,x=false,initialized=true +block Rsrc52 11d0:00ff 256 r=true,w=false,x=false,initialized=true +block Rsrc53 11d8:34ff 13568 r=true,w=false,x=false,initialized=true +block Rsrc54 11e0:02ff 768 r=true,w=false,x=false,initialized=true +block Rsrc55 11e8:00ff 256 r=true,w=false,x=false,initialized=true +block Rsrc56 11f0:01ff 512 r=true,w=false,x=false,initialized=true +block Rsrc57 11f8:00ff 256 r=true,w=false,x=false,initialized=true +block Rsrc58 1200:00ff 256 r=true,w=false,x=false,initialized=true +block Rsrc59 1208:00ff 256 r=true,w=false,x=false,initialized=true +block Rsrc60 1210:01ff 512 r=true,w=false,x=false,initialized=true +block Rsrc61 1218:01ff 512 r=true,w=false,x=false,initialized=true +block Rsrc62 1220:00ff 256 r=true,w=false,x=false,initialized=true +block EXTERNAL 1228:048f 1168 r=true,w=false,x=false,initialized=false +summary executable-bytes 93064 +summary disassembled-bytes 91332 98.14% of executable +summary defined-data-bytes 2 0.00% of executable +summary explained-code-or-data-bytes 91334 98.14% of executable +summary function-body-bytes 91332 98.14% of executable +summary internal-functions 363 +summary undefined-executable-bytes 1730 +undefined-range 1000:0000 1000:0001 2 +undefined-range 1000:026e 1000:026f 2 +undefined-range 1008:0000 1008:0001 2 +undefined-range 1008:0f2c 1008:0f2d 2 +undefined-range 1008:11bd 1008:11c4 8 +undefined-range 1008:131e 1008:1325 8 +undefined-range 1010:0000 1010:0001 2 +undefined-range 1010:0470 1010:0471 2 +undefined-range 1018:0000 1018:0001 2 +undefined-range 1018:012f 1018:0132 4 +undefined-range 1020:0000 1020:0001 2 +undefined-range 1020:0107 1020:012c 38 +undefined-range 1020:0195 1020:01c9 53 +undefined-range 1020:03c5 1020:03ca 6 +undefined-range 1020:046c 1020:0526 187 +undefined-range 1020:0531 1020:0533 3 +undefined-range 1020:0582 1020:0585 4 +undefined-range 1020:0666 1020:0666 1 +undefined-range 1020:06b4 1020:06b9 6 +undefined-range 1020:0710 1020:072b 28 +undefined-range 1020:0760 1020:07fd 158 +undefined-range 1020:0866 1020:0870 11 +undefined-range 1020:098c 1020:09eb 96 +undefined-range 1020:0aee 1020:0aff 18 +undefined-range 1020:0dea 1020:0dea 1 +undefined-range 1020:100f 1020:1016 8 +undefined-range 1020:103b 1020:104e 20 +undefined-range 1020:1059 1020:10bd 101 +undefined-range 1020:111d 1020:14a3 903 +undefined-range 1020:14de 1020:1500 35 +undefined-range 1020:1539 1020:1545 13 +undefined-range 1020:16dd 1020:16e0 4 diff --git a/original/DECOMPILATION.md b/original/DECOMPILATION.md new file mode 100644 index 0000000..e2556dd --- /dev/null +++ b/original/DECOMPILATION.md @@ -0,0 +1,49 @@ +# TDKPIN.EXE decompilation + +## Target + +- File: `TDKPIN.EXE` +- SHA-256: `a9022f1894e3e6e21fc42e8f6c932f7c549ca77f63aaa0c488bb9d55d9d0174c` +- Format: Windows 3.x New Executable (NE), 16-bit protected-mode x86 +- NE entry point: segment 1, offset `fd85` (Ghidra address `1000:fd85`) +- Image: five executable segments, one data segment, and 63 resource blocks +- Companion import: `MMTIMER.DLL` + +The executable contains a Borland runtime copyright string, but it does not retain +useful original function or variable names. The `FUN_...` and `DAT_...` names in +the output are therefore analysis-generated identifiers. + +## Outputs + +- `TDKPIN_GHIDRA_RAW.c`: C-like Ghidra output for every recovered in-image function. +- `FUNCTIONS.tsv`: address ledger separating in-image functions from imported APIs. +- `COVERAGE.tsv`: executable-block, instruction, function-body, and undefined-range audit. +- `tools/ExportDecompilation.java`: deterministic decompiler exporter. +- `tools/SeedMissingEntrypoints.java`: seeds one missed NE export and the NE startup entry. +- `tools/AuditCoverage.java`: regenerates the byte-coverage audit. +- `tools/decompile.sh`: runs the import, repair, export, and audit from scratch. + +## Accounting + +- 301/301 NE exported entry points have corresponding in-image functions. +- 62 additional internal/startup functions were recovered. +- 363 in-image functions were submitted to the decompiler. +- 363 produced C-like output; none returned a decompiler failure. +- 292 imported Win16 APIs are recorded separately and are not represented as fake bodies. +- 91,332/93,064 executable-segment bytes (98.14%) are instructions in recovered function bodies. +- 1,730 executable-segment bytes remain undefined. Most are islands in the runtime-heavy fifth + segment and may include embedded tables or alignment, but they have not been fully classified. + +Ghidra's initial NE analysis missed export ordinal 10 at `1000:eab1` and the program entry at +`1000:fd85`. Both were verified as code from the image bytes, explicitly disassembled, and +included in the final output. + +## Fidelity boundary + +`TDKPIN_GHIDRA_RAW.c` is a decompilation artifact, not recovered original source and not yet a +buildable replacement. In particular, Ghidra still emits guessed parameter lists, generic data +types, unnamed globals, and several warnings around segmented pointers, stack tracking, and one +indirect jump table. The source has not been executed against Windows 3.x or compared +differentially with the original program. Consequently, the current result establishes broad +static code coverage, not source-level semantic parity or a reproducible binary build. + diff --git a/original/FUNCTIONS.tsv b/original/FUNCTIONS.tsv new file mode 100644 index 0000000..dd092ea --- /dev/null +++ b/original/FUNCTIONS.tsv @@ -0,0 +1,656 @@ +address name kind status message +1000:0002 FUN_1000_0002 internal ok +1000:0100 FUN_1000_0100 internal ok +1000:0121 FUN_1000_0121 internal ok +1000:016c FUN_1000_016c internal ok +1000:01d3 FUN_1000_01d3 internal ok +1000:0270 FUN_1000_0270 internal ok +1000:51f5 FUN_1000_51f5 internal ok +1000:531e FUN_1000_531e internal ok +1000:5390 FUN_1000_5390 internal ok +1000:58e7 FUN_1000_58e7 internal ok +1000:5956 FUN_1000_5956 internal ok +1000:59a0 FUN_1000_59a0 internal ok +1000:5a37 FUN_1000_5a37 internal ok +1000:5ab7 FUN_1000_5ab7 internal ok +1000:5aea FUN_1000_5aea internal ok +1000:5ba6 FUN_1000_5ba6 internal ok +1000:5be5 FUN_1000_5be5 internal ok +1000:5c13 FUN_1000_5c13 internal ok +1000:5ee6 FUN_1000_5ee6 internal ok +1000:5efc FUN_1000_5efc internal ok +1000:5f29 FUN_1000_5f29 internal ok +1000:5fc0 FUN_1000_5fc0 internal ok +1000:6040 FUN_1000_6040 internal ok +1000:6073 FUN_1000_6073 internal ok +1000:60e7 FUN_1000_60e7 internal ok +1000:6129 FUN_1000_6129 internal ok +1000:616e FUN_1000_616e internal ok +1000:6202 FUN_1000_6202 internal ok +1000:6218 FUN_1000_6218 internal ok +1000:6245 FUN_1000_6245 internal ok +1000:62dc FUN_1000_62dc internal ok +1000:635c FUN_1000_635c internal ok +1000:638e FUN_1000_638e internal ok +1000:6b37 FUN_1000_6b37 internal ok +1000:6bf8 FUN_1000_6bf8 internal ok +1000:6f27 FUN_1000_6f27 internal ok +1000:7440 FUN_1000_7440 internal ok +1000:7e12 FUN_1000_7e12 internal ok +1000:7e92 FUN_1000_7e92 internal ok +1000:7ed9 FUN_1000_7ed9 internal ok +1000:8b0d FUN_1000_8b0d internal ok +1000:99f0 FUN_1000_99f0 internal ok +1000:9ae0 FUN_1000_9ae0 internal ok +1000:9b69 FUN_1000_9b69 internal ok +1000:9bca FUN_1000_9bca internal ok +1000:9e85 FUN_1000_9e85 internal ok +1000:9f73 FUN_1000_9f73 internal ok +1000:a38e FUN_1000_a38e internal ok +1000:a604 FUN_1000_a604 internal ok +1000:a70e FUN_1000_a70e internal ok +1000:a72c FUN_1000_a72c internal ok +1000:a8ea FUN_1000_a8ea internal ok +1000:a99c FUN_1000_a99c internal ok +1000:ab3c FUN_1000_ab3c internal ok +1000:abe5 FUN_1000_abe5 internal ok +1000:acc2 FUN_1000_acc2 internal ok +1000:ae6e FUN_1000_ae6e internal ok +1000:b2c8 FUN_1000_b2c8 internal ok +1000:b30b FUN_1000_b30b internal ok +1000:b3b0 FUN_1000_b3b0 internal ok +1000:b3f3 FUN_1000_b3f3 internal ok +1000:b476 FUN_1000_b476 internal ok +1000:bc36 FUN_1000_bc36 internal ok +1000:bda2 FUN_1000_bda2 internal ok +1000:bdde FUN_1000_bdde internal ok +1000:beff FUN_1000_beff internal ok +1000:c36b FUN_1000_c36b internal ok +1000:c426 FUN_1000_c426 internal ok +1000:c4e1 FUN_1000_c4e1 internal ok +1000:c79c FUN_1000_c79c internal ok +1000:eab1 exported_ordinal_10 internal ok +1000:fd85 ne_program_entry internal ok +1008:0002 FUN_1008_0002 internal ok +1008:0023 FUN_1008_0023 internal ok +1008:00e2 FUN_1008_00e2 internal ok +1008:0138 FUN_1008_0138 internal ok +1008:0787 FUN_1008_0787 internal ok +1008:07b6 FUN_1008_07b6 internal ok +1008:0837 FUN_1008_0837 internal ok +1008:08bb FUN_1008_08bb internal ok +1008:093f FUN_1008_093f internal ok +1008:0996 FUN_1008_0996 internal ok +1008:0b9e FUN_1008_0b9e internal ok +1008:0dbd FUN_1008_0dbd internal ok +1008:0e08 FUN_1008_0e08 internal ok +1008:0f27 FUN_1008_0f27 internal ok +1008:0f2e FUN_1008_0f2e internal ok +1008:10e3 FUN_1008_10e3 internal ok +1008:1131 FUN_1008_1131 internal ok +1008:118f FUN_1008_118f internal ok +1008:11b8 FUN_1008_11b8 internal ok +1008:11c5 FUN_1008_11c5 internal ok +1008:1326 FUN_1008_1326 internal ok +1008:13a8 FUN_1008_13a8 internal ok +1008:149d FUN_1008_149d internal ok +1008:15c2 FUN_1008_15c2 internal ok +1008:15c7 FUN_1008_15c7 internal ok +1008:15e7 FUN_1008_15e7 internal ok +1008:1607 FUN_1008_1607 internal ok +1008:168e FUN_1008_168e internal ok +1008:16be FUN_1008_16be internal ok +1008:172f FUN_1008_172f internal ok +1008:1754 FUN_1008_1754 internal ok +1008:1779 FUN_1008_1779 internal ok +1008:17e2 FUN_1008_17e2 internal ok +1008:1818 FUN_1008_1818 internal ok +1008:185b FUN_1008_185b internal ok +1008:1865 FUN_1008_1865 internal ok +1008:18d0 FUN_1008_18d0 internal ok +1008:18ee FUN_1008_18ee internal ok +1008:19b7 FUN_1008_19b7 internal ok +1008:19f8 FUN_1008_19f8 internal ok +1008:1a39 FUN_1008_1a39 internal ok +1008:1a82 FUN_1008_1a82 internal ok +1008:1b11 FUN_1008_1b11 internal ok +1008:1be9 FUN_1008_1be9 internal ok +1008:1c03 FUN_1008_1c03 internal ok +1008:1c5f FUN_1008_1c5f internal ok +1008:1cc6 FUN_1008_1cc6 internal ok +1008:1d77 FUN_1008_1d77 internal ok +1008:1dcc FUN_1008_1dcc internal ok +1008:1e8a FUN_1008_1e8a internal ok +1008:1f0c FUN_1008_1f0c internal ok +1008:1f68 FUN_1008_1f68 internal ok +1008:1fe8 FUN_1008_1fe8 internal ok +1008:211a FUN_1008_211a internal ok +1008:2147 FUN_1008_2147 internal ok +1008:21ba FUN_1008_21ba internal ok +1008:21ce FUN_1008_21ce internal ok +1008:21e2 FUN_1008_21e2 internal ok +1008:2219 FUN_1008_2219 internal ok +1008:22fc FUN_1008_22fc internal ok +1008:233c FUN_1008_233c internal ok +1008:2374 FUN_1008_2374 internal ok +1008:238b FUN_1008_238b internal ok +1008:23fd FUN_1008_23fd internal ok +1008:2442 FUN_1008_2442 internal ok +1008:24a5 FUN_1008_24a5 internal ok +1008:2554 FUN_1008_2554 internal ok +1008:2608 FUN_1008_2608 internal ok +1008:2643 FUN_1008_2643 internal ok +1008:26b0 FUN_1008_26b0 internal ok +1008:2819 FUN_1008_2819 internal ok +1008:28a3 FUN_1008_28a3 internal ok +1008:2906 FUN_1008_2906 internal ok +1008:2932 FUN_1008_2932 internal ok +1008:295c FUN_1008_295c internal ok +1008:298a FUN_1008_298a internal ok +1008:2996 FUN_1008_2996 internal ok +1008:2a0e FUN_1008_2a0e internal ok +1008:2a45 FUN_1008_2a45 internal ok +1008:2ae3 FUN_1008_2ae3 internal ok +1008:2bb1 FUN_1008_2bb1 internal ok +1008:2bd1 FUN_1008_2bd1 internal ok +1008:2c08 FUN_1008_2c08 internal ok +1008:2c1f FUN_1008_2c1f internal ok +1008:2c83 FUN_1008_2c83 internal ok +1008:2cd9 FUN_1008_2cd9 internal ok +1008:2cf2 FUN_1008_2cf2 internal ok +1008:2d3a FUN_1008_2d3a internal ok +1008:2d66 FUN_1008_2d66 internal ok +1008:2d87 FUN_1008_2d87 internal ok +1008:2d99 FUN_1008_2d99 internal ok +1008:2db3 FUN_1008_2db3 internal ok +1008:2dcd FUN_1008_2dcd internal ok +1008:2de0 FUN_1008_2de0 internal ok +1008:2dff FUN_1008_2dff internal ok +1008:2e22 FUN_1008_2e22 internal ok +1008:2e76 FUN_1008_2e76 internal ok +1008:2e92 FUN_1008_2e92 internal ok +1008:2ea9 FUN_1008_2ea9 internal ok +1008:2ec0 FUN_1008_2ec0 internal ok +1008:2ee5 FUN_1008_2ee5 internal ok +1008:2f07 FUN_1008_2f07 internal ok +1008:2f2f FUN_1008_2f2f internal ok +1008:2f4d FUN_1008_2f4d internal ok +1008:2f70 FUN_1008_2f70 internal ok +1008:2fbb FUN_1008_2fbb internal ok +1008:2fe3 FUN_1008_2fe3 internal ok +1008:300a FUN_1008_300a internal ok +1008:302c FUN_1008_302c internal ok +1008:3099 FUN_1008_3099 internal ok +1010:0002 FUN_1010_0002 internal ok +1010:0079 FUN_1010_0079 internal ok +1010:00a2 FUN_1010_00a2 internal ok +1010:01c2 FUN_1010_01c2 internal ok +1010:03af FUN_1010_03af internal ok +1010:03e0 FUN_1010_03e0 internal ok +1010:0405 FUN_1010_0405 internal ok +1010:0472 FUN_1010_0472 internal ok +1018:0002 FUN_1018_0002 internal ok +1018:0045 FUN_1018_0045 internal ok +1018:0071 FUN_1018_0071 internal ok +1018:0097 FUN_1018_0097 internal ok +1018:0103 FUN_1018_0103 internal ok +1018:0133 FUN_1018_0133 internal ok +1018:018b FUN_1018_018b internal ok +1018:01dc FUN_1018_01dc internal ok +1018:02fa FUN_1018_02fa internal ok +1018:0341 FUN_1018_0341 internal ok +1018:03e9 FUN_1018_03e9 internal ok +1018:03ff FUN_1018_03ff internal ok +1018:0466 FUN_1018_0466 internal ok +1018:049e FUN_1018_049e internal ok +1018:0524 FUN_1018_0524 internal ok +1018:055c FUN_1018_055c internal ok +1018:05dc FUN_1018_05dc internal ok +1018:05f3 FUN_1018_05f3 internal ok +1018:060d FUN_1018_060d internal ok +1018:0627 FUN_1018_0627 internal ok +1018:0641 FUN_1018_0641 internal ok +1018:0673 FUN_1018_0673 internal ok +1018:069a FUN_1018_069a internal ok +1018:071c FUN_1018_071c internal ok +1018:080d FUN_1018_080d internal ok +1018:085a FUN_1018_085a internal ok +1018:08ac FUN_1018_08ac internal ok +1018:08c3 FUN_1018_08c3 internal ok +1018:08f0 FUN_1018_08f0 internal ok +1018:0a85 FUN_1018_0a85 internal ok +1018:0b25 FUN_1018_0b25 internal ok +1018:0b6c FUN_1018_0b6c internal ok +1018:0bb3 FUN_1018_0bb3 internal ok +1018:0c3d FUN_1018_0c3d internal ok +1018:0c59 FUN_1018_0c59 internal ok +1018:0cc7 FUN_1018_0cc7 internal ok +1018:0ce7 FUN_1018_0ce7 internal ok +1018:0d6a FUN_1018_0d6a internal ok +1018:0d8a FUN_1018_0d8a internal ok +1018:0d9b FUN_1018_0d9b internal ok +1018:0dcd FUN_1018_0dcd internal ok +1018:0e0a FUN_1018_0e0a internal ok +1018:0e46 FUN_1018_0e46 internal ok +1018:0e9e FUN_1018_0e9e internal ok +1018:0ec0 FUN_1018_0ec0 internal ok +1018:0ef4 FUN_1018_0ef4 internal ok +1018:0f22 FUN_1018_0f22 internal ok +1018:0f38 FUN_1018_0f38 internal ok +1018:0f8d FUN_1018_0f8d internal ok +1018:0fcc FUN_1018_0fcc internal ok +1018:0ffd FUN_1018_0ffd internal ok +1018:1054 FUN_1018_1054 internal ok +1018:10aa FUN_1018_10aa internal ok +1018:10e9 FUN_1018_10e9 internal ok +1018:1106 FUN_1018_1106 internal ok +1018:121b FUN_1018_121b internal ok +1018:1274 FUN_1018_1274 internal ok +1018:12f5 FUN_1018_12f5 internal ok +1018:1311 FUN_1018_1311 internal ok +1018:134f FUN_1018_134f internal ok +1018:1547 FUN_1018_1547 internal ok +1018:1586 FUN_1018_1586 internal ok +1018:15c0 FUN_1018_15c0 internal ok +1018:169d FUN_1018_169d internal ok +1018:16eb FUN_1018_16eb internal ok +1018:170c FUN_1018_170c internal ok +1018:1761 FUN_1018_1761 internal ok +1018:1788 FUN_1018_1788 internal ok +1018:17f8 FUN_1018_17f8 internal ok +1018:1868 FUN_1018_1868 internal ok +1018:18e9 FUN_1018_18e9 internal ok +1018:1960 FUN_1018_1960 internal ok +1018:1986 FUN_1018_1986 internal ok +1018:1a0e FUN_1018_1a0e internal ok +1018:1a61 FUN_1018_1a61 internal ok +1018:1b08 FUN_1018_1b08 internal ok +1018:1b35 FUN_1018_1b35 internal ok +1018:1b4b FUN_1018_1b4b internal ok +1018:1b57 FUN_1018_1b57 internal ok +1018:1bb0 FUN_1018_1bb0 internal ok +1018:1bdf FUN_1018_1bdf internal ok +1018:1bfc FUN_1018_1bfc internal ok +1018:1c7f FUN_1018_1c7f internal ok +1018:1cd6 FUN_1018_1cd6 internal ok +1018:1d22 FUN_1018_1d22 internal ok +1018:1d64 FUN_1018_1d64 internal ok +1018:1db1 FUN_1018_1db1 internal ok +1018:1e39 FUN_1018_1e39 internal ok +1018:1eb0 FUN_1018_1eb0 internal ok +1018:1f14 FUN_1018_1f14 internal ok +1018:1f56 FUN_1018_1f56 internal ok +1020:0002 FUN_1020_0002 internal ok +1020:005d FUN_1020_005d internal ok +1020:0061 FUN_1020_0061 internal ok +1020:00d2 FUN_1020_00d2 internal ok +1020:00f0 FUN_1020_00f0 internal ok +1020:012d FUN_1020_012d internal ok +1020:0147 FUN_1020_0147 internal ok +1020:0167 FUN_1020_0167 internal ok +1020:01ca FUN_1020_01ca internal ok +1020:0222 FUN_1020_0222 internal ok +1020:023c FUN_1020_023c internal ok +1020:026a FUN_1020_026a internal ok +1020:02a6 FUN_1020_02a6 internal ok +1020:02d7 FUN_1020_02d7 internal ok +1020:0327 FUN_1020_0327 internal ok +1020:0388 FUN_1020_0388 internal ok +1020:038f FUN_1020_038f internal ok +1020:039d FUN_1020_039d internal ok +1020:03cb FUN_1020_03cb internal ok +1020:03ef FUN_1020_03ef internal ok +1020:0439 FUN_1020_0439 internal ok +1020:0527 FUN_1020_0527 internal ok +1020:052c FUN_1020_052c internal ok +1020:0534 FUN_1020_0534 internal ok +1020:0586 FUN_1020_0586 internal ok +1020:05c7 FUN_1020_05c7 internal ok +1020:05d8 FUN_1020_05d8 internal ok +1020:0608 FUN_1020_0608 internal ok +1020:062d FUN_1020_062d internal ok +1020:064d FUN_1020_064d internal ok +1020:0667 FUN_1020_0667 internal ok +1020:06ab FUN_1020_06ab internal ok +1020:072c FUN_1020_072c internal ok +1020:0751 FUN_1020_0751 internal ok +1020:07fe FUN_1020_07fe internal ok +1020:082e FUN_1020_082e internal ok +1020:0871 FUN_1020_0871 internal ok +1020:0891 FUN_1020_0891 internal ok +1020:08a9 FUN_1020_08a9 internal ok +1020:08e6 FUN_1020_08e6 internal ok +1020:09ec FUN_1020_09ec internal ok +1020:0a10 FUN_1020_0a10 internal ok +1020:0a51 FUN_1020_0a51 internal ok +1020:0a7d FUN_1020_0a7d internal ok +1020:0ac3 FUN_1020_0ac3 internal ok +1020:0b00 FUN_1020_0b00 internal ok +1020:0b1b FUN_1020_0b1b internal ok +1020:0b7a FUN_1020_0b7a internal ok +1020:0be9 FUN_1020_0be9 internal ok +1020:0c76 FUN_1020_0c76 internal ok +1020:0cd0 FUN_1020_0cd0 internal ok +1020:0cd4 FUN_1020_0cd4 internal ok +1020:0d97 FUN_1020_0d97 internal ok +1020:0e93 FUN_1020_0e93 internal ok +1020:0e9a FUN_1020_0e9a internal ok +1020:0f11 FUN_1020_0f11 internal ok +1020:0f28 FUN_1020_0f28 internal ok +1020:0f3b FUN_1020_0f3b internal ok +1020:0f77 FUN_1020_0f77 internal ok +1020:0fe5 FUN_1020_0fe5 internal ok +1020:0feb FUN_1020_0feb internal ok +1020:0ff1 FUN_1020_0ff1 internal ok +1020:0ff7 FUN_1020_0ff7 internal ok +1020:0ffd FUN_1020_0ffd internal ok +1020:1007 FUN_1020_1007 internal ok +1020:100b FUN_1020_100b internal ok +1020:1017 FUN_1020_1017 internal ok +1020:1031 FUN_1020_1031 internal ok +1020:104f FUN_1020_104f internal ok +1020:10be FUN_1020_10be internal ok +1020:14a4 FUN_1020_14a4 internal ok +1020:14c1 FUN_1020_14c1 internal ok +1020:1501 FUN_1020_1501 internal ok +1020:1546 FUN_1020_1546 internal ok +1020:1562 FUN_1020_1562 internal ok +1020:1582 FUN_1020_1582 internal ok +1020:1629 FUN_1020_1629 internal ok +1020:1674 FUN_1020_1674 internal ok +1020:16a5 FUN_1020_16a5 internal ok +1020:16c9 FUN_1020_16c9 internal ok +1020:16e1 FUN_1020_16e1 internal ok +1020:16e6 FUN_1020_16e6 internal ok +1228:0000 GETVERSION external n/a imported function +1228:0004 GLOBALALLOC external n/a imported function +1228:0008 GLOBALFREE external n/a imported function +1228:000c GLOBALLOCK external n/a imported function +1228:0010 GLOBALUNLOCK external n/a imported function +1228:0014 GLOBALHANDLE external n/a imported function +1228:0018 GLOBALCOMPACT external n/a imported function +1228:001c WAITEVENT external n/a imported function +1228:0020 GETCURRENTTASK external n/a imported function +1228:0024 GETMODULEHANDLE external n/a imported function +1228:0028 GETMODULEFILENAME external n/a imported function +1228:002c GETPROCADDRESS external n/a imported function +1228:0030 MAKEPROCINSTANCE external n/a imported function +1228:0034 FREEPROCINSTANCE external n/a imported function +1228:0038 FINDRESOURCE external n/a imported function +1228:003c LOADRESOURCE external n/a imported function +1228:0040 LOCKRESOURCE external n/a imported function +1228:0044 FREERESOURCE external n/a imported function +1228:0048 _LCLOSE external n/a imported function +1228:004c _LREAD external n/a imported function +1228:0050 _LCREAT external n/a imported function +1228:0054 _LOPEN external n/a imported function +1228:0058 _LWRITE external n/a imported function +1228:005c INITTASK external n/a imported function +1228:0060 LOADLIBRARY external n/a imported function +1228:0064 FREELIBRARY external n/a imported function +1228:0068 SETERRORMODE external n/a imported function +1228:006c __AHINCR external n/a imported function +1228:0070 GETPRIVATEPROFILEINT external n/a imported function +1228:0074 GETDOSENVIRONMENT external n/a imported function +1228:0078 GETWINFLAGS external n/a imported function +1228:007c GETWINDOWSDIRECTORY external n/a imported function +1228:0080 GETSYSTEMDIRECTORY external n/a imported function +1228:0084 GETFREESPACE external n/a imported function +1228:0088 ALLOCCSTODSALIAS external n/a imported function +1228:008c FREESELECTOR external n/a imported function +1228:0090 PRESTOCHANGOSELECTOR external n/a imported function +1228:0094 SYSTEMTIMERMAKE external n/a imported function +1228:0098 SNDPLAYSOUND external n/a imported function +1228:009c WAVEOUTGETNUMDEVS external n/a imported function +1228:00a0 WAVEOUTGETDEVCAPS external n/a imported function +1228:00a4 WAVEOUTGETVOLUME external n/a imported function +1228:00a8 TIMEKILLEVENT external n/a imported function +1228:00ac GETVERSION external n/a imported function +1228:00b0 GLOBALALLOC external n/a imported function +1228:00b4 GLOBALFREE external n/a imported function +1228:00b8 GLOBALLOCK external n/a imported function +1228:00bc GLOBALUNLOCK external n/a imported function +1228:00c0 GLOBALHANDLE external n/a imported function +1228:00c4 GLOBALCOMPACT external n/a imported function +1228:00c8 WAITEVENT external n/a imported function +1228:00cc GETCURRENTTASK external n/a imported function +1228:00d0 GETMODULEHANDLE external n/a imported function +1228:00d4 GETMODULEFILENAME external n/a imported function +1228:00d8 GETPROCADDRESS external n/a imported function +1228:00dc MAKEPROCINSTANCE external n/a imported function +1228:00e0 FREEPROCINSTANCE external n/a imported function +1228:00e4 FINDRESOURCE external n/a imported function +1228:00e8 LOADRESOURCE external n/a imported function +1228:00ec LOCKRESOURCE external n/a imported function +1228:00f0 FREERESOURCE external n/a imported function +1228:00f4 _LCLOSE external n/a imported function +1228:00f8 _LREAD external n/a imported function +1228:00fc _LCREAT external n/a imported function +1228:0100 _LOPEN external n/a imported function +1228:0104 _LWRITE external n/a imported function +1228:0108 INITTASK external n/a imported function +1228:010c LOADLIBRARY external n/a imported function +1228:0110 FREELIBRARY external n/a imported function +1228:0114 SETERRORMODE external n/a imported function +1228:0118 __AHINCR external n/a imported function +1228:011c GETPRIVATEPROFILEINT external n/a imported function +1228:0120 GETDOSENVIRONMENT external n/a imported function +1228:0124 GETWINFLAGS external n/a imported function +1228:0128 GETWINDOWSDIRECTORY external n/a imported function +1228:012c GETSYSTEMDIRECTORY external n/a imported function +1228:0130 GETFREESPACE external n/a imported function +1228:0134 ALLOCCSTODSALIAS external n/a imported function +1228:0138 FREESELECTOR external n/a imported function +1228:013c PRESTOCHANGOSELECTOR external n/a imported function +1228:0140 SETBKCOLOR external n/a imported function +1228:0144 SETBKMODE external n/a imported function +1228:0148 SETTEXTCOLOR external n/a imported function +1228:014c TEXTOUT external n/a imported function +1228:0150 BITBLT external n/a imported function +1228:0154 SELECTOBJECT external n/a imported function +1228:0158 CREATECOMPATIBLEBITMAP external n/a imported function +1228:015c CREATECOMPATIBLEDC external n/a imported function +1228:0160 CREATEDC external n/a imported function +1228:0164 DELETEDC external n/a imported function +1228:0168 DELETEOBJECT external n/a imported function +1228:016c GETSTOCKOBJECT external n/a imported function +1228:0170 GETTEXTCOLOR external n/a imported function +1228:0174 GETTEXTMETRICS external n/a imported function +1228:0178 UNREALIZEOBJECT external n/a imported function +1228:017c SETTEXTALIGN external n/a imported function +1228:0180 CREATEPALETTE external n/a imported function +1228:0184 UPDATECOLORS external n/a imported function +1228:0188 CREATEDIBITMAP external n/a imported function +1228:018c MESSAGEBOX external n/a imported function +1228:0190 INITAPP external n/a imported function +1228:0194 POSTQUITMESSAGE external n/a imported function +1228:0198 GETTICKCOUNT external n/a imported function +1228:019c SETCAPTURE external n/a imported function +1228:01a0 RELEASECAPTURE external n/a imported function +1228:01a4 SETFOCUS external n/a imported function +1228:01a8 GETFOCUS external n/a imported function +1228:01ac REMOVEPROP external n/a imported function +1228:01b0 GETPROP external n/a imported function +1228:01b4 SETPROP external n/a imported function +1228:01b8 SCREENTOCLIENT external n/a imported function +1228:01bc ISICONIC external n/a imported function +1228:01c0 GETWINDOWRECT external n/a imported function +1228:01c4 GETCLIENTRECT external n/a imported function +1228:01c8 GETWINDOWTEXT external n/a imported function +1228:01cc SETWINDOWTEXT external n/a imported function +1228:01d0 BEGINPAINT external n/a imported function +1228:01d4 ENDPAINT external n/a imported function +1228:01d8 CREATEWINDOW external n/a imported function +1228:01dc SHOWWINDOW external n/a imported function +1228:01e0 GETPARENT external n/a imported function +1228:01e4 ISWINDOW external n/a imported function +1228:01e8 ISCHILD external n/a imported function +1228:01ec DESTROYWINDOW external n/a imported function +1228:01f0 REGISTERCLASS external n/a imported function +1228:01f4 SCROLLWINDOW external n/a imported function +1228:01f8 SETSCROLLPOS external n/a imported function +1228:01fc SETSCROLLRANGE external n/a imported function +1228:0200 GETDC external n/a imported function +1228:0204 RELEASEDC external n/a imported function +1228:0208 SETCURSOR external n/a imported function +1228:020c ENDDIALOG external n/a imported function +1228:0210 ISDIALOGMESSAGE external n/a imported function +1228:0214 GETDLGITEM external n/a imported function +1228:0218 SETDLGITEMTEXT external n/a imported function +1228:021c GETDLGITEMTEXT external n/a imported function +1228:0220 SENDDLGITEMMESSAGE external n/a imported function +1228:0224 MESSAGEBEEP external n/a imported function +1228:0228 GETKEYSTATE external n/a imported function +1228:022c DEFWINDOWPROC external n/a imported function +1228:0230 GETMESSAGE external n/a imported function +1228:0234 PEEKMESSAGE external n/a imported function +1228:0238 SENDMESSAGE external n/a imported function +1228:023c WAITMESSAGE external n/a imported function +1228:0240 TRANSLATEMESSAGE external n/a imported function +1228:0244 DISPATCHMESSAGE external n/a imported function +1228:0248 CALLWINDOWPROC external n/a imported function +1228:024c UPDATEWINDOW external n/a imported function +1228:0250 INVALIDATERECT external n/a imported function +1228:0254 GETWINDOWWORD external n/a imported function +1228:0258 GETWINDOWLONG external n/a imported function +1228:025c SETWINDOWLONG external n/a imported function +1228:0260 ENABLEMENUITEM external n/a imported function +1228:0264 GETSYSTEMMENU external n/a imported function +1228:0268 CREATECARET external n/a imported function +1228:026c DESTROYCARET external n/a imported function +1228:0270 SETCARETPOS external n/a imported function +1228:0274 SHOWCARET external n/a imported function +1228:0278 LOADCURSOR external n/a imported function +1228:027c LOADICON external n/a imported function +1228:0280 LOADBITMAP external n/a imported function +1228:0284 TRANSLATEACCELERATOR external n/a imported function +1228:0288 GETSYSTEMMETRICS external n/a imported function +1228:028c GETSYSCOLOR external n/a imported function +1228:0290 DIALOGBOXPARAM external n/a imported function +1228:0294 CREATEDIALOGPARAM external n/a imported function +1228:0298 ISZOOMED external n/a imported function +1228:029c SELECTPALETTE external n/a imported function +1228:02a0 REALIZEPALETTE external n/a imported function +1228:02a4 DEFDLGPROC external n/a imported function +1228:02a8 GETCLASSINFO external n/a imported function +1228:02ac WVSPRINTF external n/a imported function +1228:02b0 DEFMDICHILDPROC external n/a imported function +1228:02b4 TRANSLATEMDISYSACCEL external n/a imported function +1228:02b8 CREATEWINDOWEX external n/a imported function +1228:02bc Ordinal_5 external n/a imported function +1228:02c0 Ordinal_6 external n/a imported function +1228:02c4 GETVERSION external n/a imported function +1228:02c8 GLOBALALLOC external n/a imported function +1228:02cc GLOBALFREE external n/a imported function +1228:02d0 GLOBALLOCK external n/a imported function +1228:02d4 GLOBALUNLOCK external n/a imported function +1228:02d8 GLOBALHANDLE external n/a imported function +1228:02dc GLOBALCOMPACT external n/a imported function +1228:02e0 WAITEVENT external n/a imported function +1228:02e4 GETCURRENTTASK external n/a imported function +1228:02e8 GETMODULEHANDLE external n/a imported function +1228:02ec GETMODULEFILENAME external n/a imported function +1228:02f0 GETPROCADDRESS external n/a imported function +1228:02f4 MAKEPROCINSTANCE external n/a imported function +1228:02f8 FREEPROCINSTANCE external n/a imported function +1228:02fc FINDRESOURCE external n/a imported function +1228:0300 LOADRESOURCE external n/a imported function +1228:0304 LOCKRESOURCE external n/a imported function +1228:0308 FREERESOURCE external n/a imported function +1228:030c _LCLOSE external n/a imported function +1228:0310 _LREAD external n/a imported function +1228:0314 _LCREAT external n/a imported function +1228:0318 _LOPEN external n/a imported function +1228:031c _LWRITE external n/a imported function +1228:0320 INITTASK external n/a imported function +1228:0324 LOADLIBRARY external n/a imported function +1228:0328 FREELIBRARY external n/a imported function +1228:032c SETERRORMODE external n/a imported function +1228:0330 __AHINCR external n/a imported function +1228:0334 GETPRIVATEPROFILEINT external n/a imported function +1228:0338 GETDOSENVIRONMENT external n/a imported function +1228:033c GETWINFLAGS external n/a imported function +1228:0340 GETWINDOWSDIRECTORY external n/a imported function +1228:0344 GETSYSTEMDIRECTORY external n/a imported function +1228:0348 GETFREESPACE external n/a imported function +1228:034c ALLOCCSTODSALIAS external n/a imported function +1228:0350 FREESELECTOR external n/a imported function +1228:0354 PRESTOCHANGOSELECTOR external n/a imported function +1228:0358 MESSAGEBOX external n/a imported function +1228:035c INITAPP external n/a imported function +1228:0360 POSTQUITMESSAGE external n/a imported function +1228:0364 GETTICKCOUNT external n/a imported function +1228:0368 SETCAPTURE external n/a imported function +1228:036c RELEASECAPTURE external n/a imported function +1228:0370 SETFOCUS external n/a imported function +1228:0374 GETFOCUS external n/a imported function +1228:0378 REMOVEPROP external n/a imported function +1228:037c GETPROP external n/a imported function +1228:0380 SETPROP external n/a imported function +1228:0384 SCREENTOCLIENT external n/a imported function +1228:0388 ISICONIC external n/a imported function +1228:038c GETWINDOWRECT external n/a imported function +1228:0390 GETCLIENTRECT external n/a imported function +1228:0394 GETWINDOWTEXT external n/a imported function +1228:0398 SETWINDOWTEXT external n/a imported function +1228:039c BEGINPAINT external n/a imported function +1228:03a0 ENDPAINT external n/a imported function +1228:03a4 CREATEWINDOW external n/a imported function +1228:03a8 SHOWWINDOW external n/a imported function +1228:03ac GETPARENT external n/a imported function +1228:03b0 ISWINDOW external n/a imported function +1228:03b4 ISCHILD external n/a imported function +1228:03b8 DESTROYWINDOW external n/a imported function +1228:03bc REGISTERCLASS external n/a imported function +1228:03c0 SCROLLWINDOW external n/a imported function +1228:03c4 SETSCROLLPOS external n/a imported function +1228:03c8 SETSCROLLRANGE external n/a imported function +1228:03cc GETDC external n/a imported function +1228:03d0 RELEASEDC external n/a imported function +1228:03d4 SETCURSOR external n/a imported function +1228:03d8 ENDDIALOG external n/a imported function +1228:03dc ISDIALOGMESSAGE external n/a imported function +1228:03e0 GETDLGITEM external n/a imported function +1228:03e4 SETDLGITEMTEXT external n/a imported function +1228:03e8 GETDLGITEMTEXT external n/a imported function +1228:03ec SENDDLGITEMMESSAGE external n/a imported function +1228:03f0 MESSAGEBEEP external n/a imported function +1228:03f4 GETKEYSTATE external n/a imported function +1228:03f8 DEFWINDOWPROC external n/a imported function +1228:03fc GETMESSAGE external n/a imported function +1228:0400 PEEKMESSAGE external n/a imported function +1228:0404 SENDMESSAGE external n/a imported function +1228:0408 WAITMESSAGE external n/a imported function +1228:040c TRANSLATEMESSAGE external n/a imported function +1228:0410 DISPATCHMESSAGE external n/a imported function +1228:0414 CALLWINDOWPROC external n/a imported function +1228:0418 UPDATEWINDOW external n/a imported function +1228:041c INVALIDATERECT external n/a imported function +1228:0420 GETWINDOWWORD external n/a imported function +1228:0424 GETWINDOWLONG external n/a imported function +1228:0428 SETWINDOWLONG external n/a imported function +1228:042c ENABLEMENUITEM external n/a imported function +1228:0430 GETSYSTEMMENU external n/a imported function +1228:0434 CREATECARET external n/a imported function +1228:0438 DESTROYCARET external n/a imported function +1228:043c SETCARETPOS external n/a imported function +1228:0440 SHOWCARET external n/a imported function +1228:0444 LOADCURSOR external n/a imported function +1228:0448 LOADICON external n/a imported function +1228:044c LOADBITMAP external n/a imported function +1228:0450 TRANSLATEACCELERATOR external n/a imported function +1228:0454 GETSYSTEMMETRICS external n/a imported function +1228:0458 GETSYSCOLOR external n/a imported function +1228:045c DIALOGBOXPARAM external n/a imported function +1228:0460 CREATEDIALOGPARAM external n/a imported function +1228:0464 ISZOOMED external n/a imported function +1228:0468 SELECTPALETTE external n/a imported function +1228:046c REALIZEPALETTE external n/a imported function +1228:0470 DEFDLGPROC external n/a imported function +1228:0474 GETCLASSINFO external n/a imported function +1228:0478 WVSPRINTF external n/a imported function +1228:047c DEFMDICHILDPROC external n/a imported function +1228:0480 TRANSLATEMDISYSACCEL external n/a imported function +1228:0484 CREATEWINDOWEX external n/a imported function +1228:0488 Ordinal_5 external n/a imported function +1228:048c Ordinal_6 external n/a imported function diff --git a/original/HISCORES.DAT b/original/HISCORES.DAT new file mode 100755 index 0000000..86d6ddd Binary files /dev/null and b/original/HISCORES.DAT differ diff --git a/original/MMTIMER.DLL b/original/MMTIMER.DLL new file mode 100755 index 0000000..5042edb Binary files /dev/null and b/original/MMTIMER.DLL differ diff --git a/original/TDKPIN.EXE b/original/TDKPIN.EXE new file mode 100755 index 0000000..99fee49 Binary files /dev/null and b/original/TDKPIN.EXE differ diff --git a/original/TDKPIN.INI b/original/TDKPIN.INI new file mode 100755 index 0000000..32938ab --- /dev/null +++ b/original/TDKPIN.INI @@ -0,0 +1,27 @@ +; Pinball INI-File by KIWI Hamburg + +[Settings] +; The speed setting defines the "time resolution" of the graphics. +; The higher the setting, the "smoother" the ball will run. +; However, if your hardware is too slow for the current speed setting, +; the pinball machine might "hang" or not react correctly. +; The speed setting DOES NOT influence game speed. +; In any case, try setting your Windows graphics resolution to +; 640x480 pixel in 256 colours before changing this setting. +; Speed=1 for slow graphics hardware +; Speed=5 for very fast graphics hardware +; Default: Speed=3 +Speed=3 + +; Sound=1 for Sounds on +; Sound=0 for Sounds off +; Default: Sounds=1 +Sounds=1 + +;Language=1 for english helpscreen +;Language=2 for german helpscreen +;Language=3 for french helpscreen +;Language=4 for italian helpscreen +;Language=5 for spanish helpscreen +;Default: Language=1 +Language=2 diff --git a/original/TDKPIN.LOG b/original/TDKPIN.LOG new file mode 100755 index 0000000..e2a067d --- /dev/null +++ b/original/TDKPIN.LOG @@ -0,0 +1,70 @@ +KIWI Setup V1.06 at 06.01.1996 16:46:26 +========================================= + + OK copying A:\A00\BTIUnZIP.Dll --> C:\WINDOWS\BTIUnZIP.Dll, Attr=-R-H-S+A + +Externals/AtInit: + *END Externals/AtInit + +General: + Application = TDK Pinball + Source drive = A: + Dest drive = C: + Dest dir = C:\TDKPIN + Windows drive = C: + Windows dir = C:\WINDOWS + Windows system dir = C:\WINDOWS\SYSTEM + System current drive/dir = A:\A00 + +Externals/AtBegin: + *END Externals/AtBegin + +Disks: + 1: TDK Pinball Diskette, TDKPINBALL, + *END Disks + +Directories: + Directories section terminated normally + *END Directories + +Files: + Number of files to copy = 4 + OK copying A:\A00\CTL3DV2.DL_ --> C:\WINDOWS\SYSTEM\CTL3DV2.DLL, Attr=-R-H-S+A + OK copying A:\A00\READGERM.TXT --> C:\TDKPIN\READGERM.TXT, Attr=-R-H-S+A + OK copying A:\A00\TDK.001 --> C:\TDKPIN\TDK.ZIP (ZIP file) + UnZIPed file C:\TDKPIN\MMTIMER.DLL, Attr=-R-H-S+A + UnZIPed file C:\TDKPIN\TDKPIN.EXE, Attr=-R-H-S+A + *deleting C:\TDKPIN\TDK.ZIP + OK copying A:\A00\GERM.INI --> C:\TDKPIN\TDKPIN.INI, Attr=-R-H-S+A + Files section terminated normally + *END Files + +Externals/AfterCopy: + *END Externals/AfterCopy + +INI-Files: + Number of INI-File entries = 0 + INI-Files section terminated normally + *END INI-Files + +ProgramGroup + DDE: [CreateGroup("TDK")] + OK DDE create group command + DDE: [DeleteItem("TDK Pinball Machine")] + DDE: [DeleteItem("TDK Info")] + OK DDE delete command + DDE: [AddItem("C:\TDKPIN\TDKPIN.EXE","TDK Pinball Machine","C:\TDKPIN\TDKPIN.EXE",0,47,0,"C:\TDKPIN")] + DDE: [AddItem("C:\WINDOWS\NOTEPAD.EXE C:\TDKPIN\READGERM.TXT","TDK Info","C:\WINDOWS\NOTEPAD.EXE",0,142,0,"C:\WINDOWS")] + OK DDE add command + ProgramGroup section terminated normally + *END ProgramGroup + +Externals/AtEnd: + executing/Wait NotePad.Exe C:\TDKPIN\readgerm.txt, WinExec= 0 + *END Externals/AtEnd + +Deleting temporary files: + OK deleting file: C:\WINDOWS\BTIUnZIP.Dll + *END Deleting temporary files: + +Installation complete diff --git a/original/TDKPIN_GHIDRA_RAW.c b/original/TDKPIN_GHIDRA_RAW.c new file mode 100644 index 0000000..e3f49d6 --- /dev/null +++ b/original/TDKPIN_GHIDRA_RAW.c @@ -0,0 +1,16002 @@ +/* + * Raw Ghidra decompilation of TDKPIN.EXE. + * Function boundaries and names are analysis artifacts, not original source symbols. + */ + +/* ===== 1000:0002 FUN_1000_0002 ===== */ + +void __stdcall16far FUN_1000_0002(int param_1,undefined2 param_2) + +{ + undefined2 uVar1; + undefined2 uVar2; + undefined2 uVar3; + undefined2 uVar4; + undefined2 uVar5; + undefined2 uVar6; + undefined2 uVar7; + undefined2 uVar8; + undefined2 uVar9; + + uVar6 = param_2; + uVar1 = CREATECOMPATIBLEDC(); + uVar2 = CREATECOMPATIBLEDC(0x1228,param_2,uVar6); + uVar3 = CREATECOMPATIBLEDC(0x1228,param_2); + uVar4 = CREATECOMPATIBLEBITMAP(0x1228,0xe,0xe); + uVar5 = SELECTOBJECT(0x1228,DAT_1028_085b); + uVar6 = SELECTOBJECT(0x1228,*(undefined2 *)(param_1 * 2 + 0x430b)); + uVar7 = SELECTOBJECT(0x1228,uVar4); + BITBLT(0x1228,0x20,0xcc,0x4d,0x54,uVar1,0xe,0xe,0,0); + BITBLT(0x1228,0x20,0xcc,0,0,uVar2,0x7b,0x2a,0x4f,0x37); + uVar9 = uVar1; + BITBLT(0x1228,0x20,0xcc,0,0,uVar3,0xe,0xe,0x4d,0x54); + uVar8 = uVar3; + SELECTOBJECT(0x1228,uVar7); + uVar7 = uVar2; + SELECTOBJECT(0x1228,uVar6); + uVar6 = uVar1; + SELECTOBJECT(0x1228,uVar5); + DELETEOBJECT(0x1228,uVar4,uVar6,uVar7,uVar8,uVar9); + DELETEDC(0x1228,uVar3); + DELETEDC(0x1228,uVar2); + DELETEDC(0x1228,uVar1); + return; +} + + +/* ===== 1000:0100 FUN_1000_0100 ===== */ + +void __stdcall16far FUN_1000_0100(undefined4 param_1) + +{ + FUN_1018_1b57((int)param_1,(int)((ulong)param_1 >> 0x10)); + FUN_1010_03af(1,1,1,0x222,0x1028); + return; +} + + +/* ===== 1000:0121 FUN_1000_0121 ===== */ + +void __stdcall16far FUN_1000_0121(undefined4 param_1) + +{ + undefined2 uVar1; + undefined4 uVar2; + + if (DAT_1028_06fc == 0) { + uVar2 = FUN_1000_01d3(0,0,0x9e,0x22c,0x1028,0,0); + uVar1 = (undefined2)((ulong)param_1 >> 0x10); + *(undefined2 *)((int)param_1 + 8) = (int)uVar2; + *(undefined2 *)((int)param_1 + 10) = (int)((ulong)uVar2 >> 0x10); + } + else { + (*DAT_1028_0666)(); + FUN_1020_0061(); + } + return; +} + + +/* ===== 1000:016c FUN_1000_016c ===== */ + +void __stdcall16far FUN_1000_016c(undefined4 param_1,undefined2 *param_2) + +{ + undefined2 uVar1; + undefined2 uVar2; + undefined2 *puVar3; + undefined2 uVar4; + undefined2 uVar5; + + uVar4 = (undefined2)((ulong)param_2 >> 0x10); + puVar3 = (undefined2 *)param_2; + FUN_1018_1274((int)param_1,(int)((ulong)param_1 >> 0x10),puVar3,uVar4); + *param_2 = 0x3000; + uVar2 = DAT_1028_06fe; + uVar1 = LOADICON(0x1018,0x3e4,0); + puVar3[6] = uVar1; + uVar5 = 0; + uVar1 = LOADCURSOR(0x1228,0x7f00,0); + puVar3[7] = uVar1; + uVar2 = GETSTOCKOBJECT(0x1228,0,uVar5,uVar2); + puVar3[8] = uVar2; + puVar3[5] = DAT_1028_06fe; + puVar3[3] = 0; + puVar3[4] = 0; + return; +} + + +/* ===== 1000:01d3 FUN_1000_01d3 ===== */ + +undefined4 __stdcall16far +FUN_1000_01d3(undefined4 param_1,undefined2 param_2,undefined2 param_3,undefined2 param_4, + undefined2 param_5,undefined2 param_6) + +{ + int iVar1; + int iVar2; + undefined2 uVar3; + bool bVar4; + int iVar5; + + bVar4 = true; + FUN_1020_03ef(); + if (!bVar4) { + uVar3 = (undefined2)((ulong)param_1 >> 0x10); + iVar2 = (int)param_1; + FUN_1018_1106(iVar2,uVar3,0,param_3,param_4,param_5,param_6); + *(undefined2 *)(iVar2 + 0x2d) = 0x280; + *(undefined2 *)(iVar2 + 0x2f) = 0x1e0; + iVar5 = 0x1018; + iVar1 = GETSYSTEMMETRICS(0x1018,0,*(int *)(iVar2 + 0x2d) / 2); + *(int *)(iVar2 + 0x29) = iVar1 / 2 - iVar5; + iVar5 = 0x1228; + iVar1 = GETSYSTEMMETRICS(0x1228,1,*(int *)(iVar2 + 0x2f) / 2); + *(int *)(iVar2 + 0x2b) = iVar1 / 2 - iVar5; + *(undefined2 *)(iVar2 + 0x21) = 0; + *(undefined2 *)(iVar2 + 0x23) = 0x86ca; + } + return param_1; +} + + +/* ===== 1000:0270 FUN_1000_0270 ===== */ + +void __stdcall16far FUN_1000_0270(undefined4 param_1) + +{ + char cVar1; + undefined1 uVar2; + undefined2 uVar3; + int in_DX; + int iVar4; + int iVar5; + undefined2 uVar6; + undefined2 unaff_SS; + undefined4 uVar7; + undefined1 *puVar8; + undefined2 uVar9; + undefined2 uVar10; + undefined1 *puVar11; + undefined1 *puVar12; + undefined2 uVar13; + undefined2 uVar14; + undefined1 local_2d2 [256]; + undefined2 local_1d2; + undefined1 local_d0 [101]; + undefined1 local_6b [103]; + int local_4; + + DAT_1028_07cf = 0; + DAT_1028_0874 = 0; + DAT_1028_0875 = 0; + uVar6 = (undefined2)((ulong)param_1 >> 0x10); + iVar5 = (int)param_1; + *(undefined2 *)(iVar5 + 0x41) = 0; + *(undefined2 *)(iVar5 + 0x43) = 0; + *(undefined2 *)(iVar5 + 0x45) = 0; + *(undefined2 *)(iVar5 + 0x47) = 0; + FUN_1020_0167(); + if (in_DX < 0x40) { + (*DAT_1028_0666)(0x1020,0x2010,0x2aa,0x1028,0x260,0x1028,0); + FUN_1018_0f38(iVar5,uVar6); + FUN_1020_0061(0x1018); + } + FUN_1018_170c(iVar5,uVar6); + uVar14 = 0; + uVar3 = LOADCURSOR(0x1018,0x7f02,0); + SETCURSOR(0x1228,uVar3,uVar14); + FUN_1008_0023(*(undefined2 *)(iVar5 + 4)); + FUN_1008_1326(0x4450,0x1028,999,0,DAT_1028_06fe); + FUN_1008_11c5(); + DAT_1028_07cc = 1; + *(undefined2 *)(iVar5 + 0x4d) = 0; + *(undefined2 *)(iVar5 + 0x4f) = 0; + *(undefined1 *)(iVar5 + 0x51) = 0; + *(undefined1 *)(iVar5 + 0xbd8) = 0; + uVar7 = GETTICKCOUNT(0x1008); + DAT_1028_0722 = (undefined2)((ulong)uVar7 >> 0x10); + DAT_1028_0720 = (undefined2)uVar7; + *(undefined2 *)(iVar5 + 0xbe3) = 0; + DAT_1028_07c7 = 0; + DAT_1028_07c8 = 0; + DAT_1028_086d = 10; + DAT_1028_086f = 10; + DAT_1028_0873 = 0; + DAT_1028_07ca = 0; + DAT_1028_07cb = 0; + DAT_1028_07c9 = 1; + *(undefined2 *)(iVar5 + 0xbca) = 0; + *(undefined2 *)(iVar5 + 0xbcc) = 0; + *(undefined1 *)(iVar5 + 0xbd9) = 0; + *(undefined2 *)(iVar5 + 0xbc2) = 0xf588; + *(undefined2 *)(iVar5 + 0xbc4) = 4; + *(undefined2 *)(iVar5 + 0xbc6) = 0x4d48; + *(undefined2 *)(iVar5 + 0xbc8) = 6; + DAT_1028_07d3 = *(uint *)(iVar5 + 0xbc2); + DAT_1028_07d5 = *(int *)(iVar5 + 0xbc4); + DAT_1028_07d7 = *(uint *)(iVar5 + 0xbc6); + DAT_1028_07d9 = *(int *)(iVar5 + 0xbc8); + *(undefined1 *)(iVar5 + 0xbdd) = 0; + *(undefined1 *)(iVar5 + 0xbdf) = 0; + *(undefined1 *)(iVar5 + 0xbdc) = 0; + *(undefined1 *)(iVar5 + 0xbe0) = 0; + *(undefined1 *)(iVar5 + 0xbe1) = 0; + *(undefined1 *)(iVar5 + 0xbe2) = 0; + DAT_1028_07c5 = 0; + *(undefined1 *)(iVar5 + 0xbde) = 1; + DAT_1028_07d0 = 0; + DAT_1028_07d1 = 0; + *(undefined1 *)(iVar5 + 0x61) = 1; + DAT_1028_086b = 99; + DAT_1028_0869 = 0; + DAT_1028_0876 = 0; + DAT_1028_0878 = 0; + DAT_1028_087a = 0; + DAT_1028_087c = 0; + local_4 = 1; + while( true ) { + *(undefined1 *)(iVar5 + local_4 + 0x47b) = 0; + *(undefined1 *)(iVar5 + local_4 + 0x48f) = 0; + *(undefined1 *)(iVar5 + local_4 + 0x4a3) = 0; + *(undefined1 *)(iVar5 + local_4 + 0x4b7) = 0; + if (local_4 == 0x14) break; + local_4 = local_4 + 1; + } + local_4 = 1; + while( true ) { + *(undefined2 *)(local_4 * 4 + 0x97e) = 0; + *(undefined2 *)(local_4 * 4 + 0x980) = 0; + *(undefined2 *)(local_4 * 4 + 0x98e) = 0; + *(undefined2 *)(local_4 * 4 + 0x990) = 0; + *(undefined1 *)(local_4 + 0x9a1) = 1; + *(undefined2 *)(local_4 * 2 + 0x9a4) = 0; + *(undefined2 *)(local_4 * 2 + 0x81f) = 0xffff; + *(undefined1 *)(local_4 + 0x816) = 1; + *(undefined2 *)(local_4 * 4 + 0x835) = 1; + *(undefined2 *)(local_4 * 4 + 0x837) = 0; + *(undefined1 *)(local_4 + 0x81a) = 1; + if (local_4 == 4) break; + local_4 = local_4 + 1; + } + DAT_1028_0829 = 0x22e0; + DAT_1028_082b = 2; + DAT_1028_082d = 0xeb10; + DAT_1028_082f = 9; + DAT_1028_0831 = 0xd620; + DAT_1028_0833 = 0x13; + DAT_1028_0835 = 0x900; + DAT_1028_0837 = 0x3d; + *(undefined2 *)(iVar5 + 0xbaa) = 0; + *(undefined2 *)(iVar5 + 0xbac) = 0; + *(undefined2 *)(iVar5 + 0xbae) = 0; + *(undefined2 *)(iVar5 + 0xbb0) = 0; + *(undefined2 *)(iVar5 + 0xbce) = 0; + *(undefined2 *)(iVar5 + 0xbd0) = 0; + *(undefined2 *)(iVar5 + 0xbd2) = 0; + iVar4 = DAT_1028_07d5 + (uint)(0xfe0b < DAT_1028_07d3); + uVar3 = FUN_1020_08e6(); + *(undefined2 *)(iVar5 + 0xba2) = uVar3; + *(int *)(iVar5 + 0xba4) = iVar4; + *(undefined2 *)(iVar5 + 0xbb2) = 0; + *(undefined2 *)(iVar5 + 0xbb4) = 0; + iVar4 = DAT_1028_07d9 + (uint)(0xfe0b < DAT_1028_07d7); + uVar3 = FUN_1020_08e6(); + *(undefined2 *)(iVar5 + 0xba6) = uVar3; + *(int *)(iVar5 + 0xba8) = iVar4; + *(undefined2 *)(iVar5 + 0xbb6) = 0; + *(undefined2 *)(iVar5 + 3000) = 0; + *(undefined1 *)(iVar5 + 0xbda) = 0; + *(undefined1 *)(iVar5 + 0xbdb) = 0; + *(undefined2 *)(iVar5 + 0xbd4) = 0; + *(undefined2 *)(iVar5 + 0xbd6) = 0; + puVar12 = local_6b; + puVar11 = local_2d2; + uVar3 = unaff_SS; + uVar14 = unaff_SS; + FUN_1020_082e(0); + FUN_1008_2f2f(puVar11,uVar3,puVar12,uVar14); + puVar11 = local_d0; + puVar12 = local_6b; + uVar10 = 0x1008; + uVar9 = 0x26e; + puVar8 = local_2d2; + uVar3 = unaff_SS; + uVar14 = unaff_SS; + uVar13 = unaff_SS; + FUN_1020_082e(0); + uVar3 = FUN_1020_0a7d(puVar8,uVar3,uVar9,uVar10); + FUN_1008_2f07(uVar3,puVar12,uVar14,puVar11,uVar13); + FUN_1008_2f4d(0x2c3,0x1028,local_d0,unaff_SS); + uVar3 = 0x1028; + DAT_1028_07cd = GETPRIVATEPROFILEINT(0x1008,local_d0,unaff_SS,1,0x2d0,0x1028,0x2c7); + if ((DAT_1028_07cd == 0) || (5 < DAT_1028_07cd)) { + DAT_1028_07cd = 1; + } + uVar14 = 0x1028; + uVar2 = GETPRIVATEPROFILEINT(0x1228,local_d0,unaff_SS,3,0x2d9,0x1028,0x2c7); + *(undefined1 *)(iVar5 + 0x60) = uVar2; + if ((*(char *)(iVar5 + 0x60) == '\0') || (5 < *(byte *)(iVar5 + 0x60))) { + *(undefined1 *)(iVar5 + 0x60) = 3; + } + cVar1 = *(char *)(iVar5 + 0x60); + if (cVar1 == '\x01') { + *(undefined2 *)(iVar5 + 0x5a) = 0xf; + *(undefined2 *)(iVar5 + 0x5c) = 0; + *(undefined2 *)(iVar5 + 0x56) = 0xed8; + *(undefined2 *)(iVar5 + 0x58) = 0; + local_1d2 = 0x32; + DAT_1028_0871 = 5; + } + else if (cVar1 == '\x02') { + *(undefined2 *)(iVar5 + 0x5a) = 0xf; + *(undefined2 *)(iVar5 + 0x5c) = 0; + *(undefined2 *)(iVar5 + 0x56) = 0xed8; + *(undefined2 *)(iVar5 + 0x58) = 0; + local_1d2 = 0x28; + DAT_1028_0871 = 4; + } + else if (cVar1 == '\x03') { + *(undefined2 *)(iVar5 + 0x5a) = 0xf; + *(undefined2 *)(iVar5 + 0x5c) = 0; + *(undefined2 *)(iVar5 + 0x56) = 0xed8; + *(undefined2 *)(iVar5 + 0x58) = 0; + local_1d2 = 0x1e; + DAT_1028_0871 = 3; + } + else if (cVar1 == '\x04') { + *(undefined2 *)(iVar5 + 0x5a) = 0xf; + *(undefined2 *)(iVar5 + 0x5c) = 0; + *(undefined2 *)(iVar5 + 0x56) = 0xed8; + *(undefined2 *)(iVar5 + 0x58) = 0; + local_1d2 = 0x14; + DAT_1028_0871 = 2; + } + else if (cVar1 == '\x05') { + *(undefined2 *)(iVar5 + 0x5a) = 0xf; + *(undefined2 *)(iVar5 + 0x5c) = 0; + *(undefined2 *)(iVar5 + 0x56) = 0xed8; + *(undefined2 *)(iVar5 + 0x58) = 0; + local_1d2 = 10; + DAT_1028_0871 = 1; + } + else { + *(undefined2 *)(iVar5 + 0x5a) = 0xf; + *(undefined2 *)(iVar5 + 0x5c) = 0; + *(undefined2 *)(iVar5 + 0x56) = 0xed8; + *(undefined2 *)(iVar5 + 0x58) = 0; + local_1d2 = 0x1e; + DAT_1028_0871 = 3; + } + uVar7 = FUN_1008_28a3(0,0,0x5c0,0,1,local_1d2,*(undefined2 *)(iVar5 + 4)); + *(undefined2 *)(iVar5 + 0x49) = (int)uVar7; + *(undefined2 *)(iVar5 + 0x4b) = (int)((ulong)uVar7 >> 0x10); + if (*(int *)(iVar5 + 0x49) == 0 && *(int *)(iVar5 + 0x4b) == 0) { + (*DAT_1028_0666)(0x1008,0x2010,0x2aa,0x1028,0x2df,0x1028,*(undefined2 *)(iVar5 + 4),uVar14,uVar3 + ); + FUN_1020_0061(0x1008); + } + FUN_1008_0138(0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0xcd7d,0xcccc,0x4ccc,0x9a80,0x9999,0x1999,0,0, + 0x1c9,0,0x7d,0,0x1a1,0,7,0,0,0,2,1,1); + FUN_1008_0138(0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0xcd7d,0xcccc,0x4ccc,0x9a80,0x9999,0x1999,0,0, + 0x1db,0,300,0,0x1db,0,10,0,0,0,2,1,2); + FUN_1008_0138(0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0xcd7d,0xcccc,0x4ccc,0xcd7d,0xcccc,0x4ccc,0,0, + 0x1d8,0,0x78,0,0x1c4,0,0x78,0,0,0,2,1,0xa9); + FUN_1008_0138(0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0xcd7d,0xcccc,0x4ccc,0xcd7d,0xcccc,0x4ccc,0,0, + 0x1c4,0,0xc3,0,0x1d8,0,0xc3,0,0,0,2,1,0xaa); + FUN_1008_0138(0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0xcd7d,0xcccc,0x4ccc,0xcd7d,0xcccc,0x4ccc,0,0, + 0x1bd,0,0x86,0,0x1ce,0,0x86,0,0,0,2,1,3); + FUN_1008_0138(0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0xcd7d,0xcccc,0x4ccc,0x9a80,0x9999,0x1999,8,0, + 0,0,0,0,0x1be,0,0x8d,0,0,1,1,1,4); + FUN_1008_0138(0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0xcd7d,0xcccc,0x4ccc,0x9a80,0x9999,0x1999,0,0, + 0x1d3,0,0x94,0,0x1bd,0,0x94,0,0,0,2,1,5); + FUN_1008_0138(0x1b5,0xa3,0x185,0x97,0,0,0,0,2,0,0,6,0x102,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x1d3,0,0xa4 + ,0,0x1be,0,0x94,0,0,0,4,0,6); + FUN_1008_0138(0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0xcd7d,0xcccc,0x4ccc,0x9a80,0x9999,0x1999,0,0, + 0x1d2,0,0xa4,0,0x1bd,0,0xa5,0,0,0,2,1,7); + FUN_1008_0138(0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0xcd7d,0xcccc,0x4ccc,0x9a80,0x9999,0x1999,8,0, + 0,0,0,0,0x1be,0,0xac,0,0,1,1,1,8); + FUN_1008_0138(0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0xcd7d,0xcccc,0x4ccc,0xcd7d,0xcccc,0x4ccc,0,0, + 0x1d3,0,0xb4,0,0x1bd,0,0xb3,0,0,0,2,1,9); + FUN_1008_0138(0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0xcd7d,0xcccc,0x4ccc,0x9a80,0x9999,0x1999,0,0, + 0x19e,0,0x130,0,0x1c9,0,0xb7,0,0,0,2,1,10); + FUN_1008_0138(0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0xcd7d,0xcccc,0x4ccc,0x9a80,0x9999,0x1999,0,0, + 0x3d,0,0x12a,0,0xa5,0,0x12a,0,0,0,2,1,0xb); + FUN_1008_0138(0,0,0,0,0,0,0,0,1,5000,0,0,0,0,0,0,0,0,0,0xcd7d,0xcccc,0x4ccc,0x9a80,0x9999,0x1999,0 + ,0,0x8e,0,0x12a,0,0x8e,0,0x136,0,0,0,2,1,0xc); + FUN_1008_0138(0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0xcd7d,0xcccc,0x4ccc,0x9a80,0x9999,0x1999,7,0, + 0,0,0,0,0x88,0,0x12a,0,0,1,1,1,0xd); + FUN_1008_0138(0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0xcd7d,0xcccc,0x4ccc,0x9a80,0x9999,0x1999,0,0, + 0x68,0,0x124,0,0x88,0,0x123,0,0,0,2,1,0xe); + FUN_1008_0138(0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0xcd7d,0xcccc,0x4ccc,0xcd7f,0xcccc,0x4ccc,0,0, + 100,0,0x119,0,0x6d,0,300,0,0,0,2,1,0xf); + FUN_1008_0138(0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0xcd7d,0xcccc,0x4ccc,0xcd7f,0xcccc,0x4ccc,0,0, + 0x87,0,0x113,0,0x60,0,0x122,0,0,0,2,1,0x10); + FUN_1008_0138(0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0xcd7d,0xcccc,0x4ccc,0x9a80,0x9999,0x1999,7,0, + 0,0,0,0,0x86,0,0x10d,0,0,1,1,1,0x11); + FUN_1008_0138(0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0xcd7d,0xcccc,0x4ccc,0x9a80,0x9999,0x1999,7,0, + 0,0,0,0,0x73,0,0x101,0,0,1,1,1,0x1a); + FUN_1008_0138(0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0xcd7d,0xcccc,0x4ccc,0x9a80,0x9999,0x1999,0,0, + 0x72,0,0xf8,0,0x8b,0,0x108,0,0,0,2,1,0x12); + FUN_1008_0138(0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0xcd7d,0xcccc,0x4ccc,0x9a80,0x9999,0x1999,0,0, + 0x5b,0,0x101,0,0x72,0,0xf9,0,0,0,2,1,0x13); + FUN_1008_0138(0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0xcd7d,0xcccc,0x4ccc,0x9a80,0x9999,0x1999,0,0, + 0x31,0,0x115,0,0x5b,0,0x101,0,0,0,2,1,0x14); + FUN_1008_0138(0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0xcd7d,0xcccc,0x4ccc,0x9a80,0x9999,0x1999,0,0, + 0x20,0,0x11f,0,0x33,0,0x115,0,0,0,2,1,0x15); + FUN_1008_0138(0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0xcd7d,0xcccc,0x4ccc,0x9a80,0x9999,0x1999,0,0, + 0x30,0,0x12f,0,0x2a,0,0x11b,0,0,0,2,1,0x16); + FUN_1008_0138(0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0xcd7d,0xcccc,0x4ccc,0x9a80,0x9999,0x1999,0,0, + 0x44,0,0x140,0,0x30,0,0x12e,0,0,0,2,1,0x17); + FUN_1008_0138(0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0xcd7d,0xcccc,0x4ccc,0x9a80,0x9999,0x1999,0,0, + 0x1c9,0,0x140,0,0x44,0,0x140,0,0,0,2,1,0x18); + FUN_1008_0138(0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0xcd7d,0xcccc,0x4ccc,0xcd7d,0xcccc,0x4ccc,0,0, + 0x1b1,0,0x14c,0,0x1b1,0,0x13b,0,0,0,2,1,0x19); + FUN_1008_0138(0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0xcd7e,0xcccc,0x4ccc,0x9a80,0x9999,0x1999,0,0, + 0x43,0,0x146,0,0x4e,0,0x148,0,0,0,2,1,0x1b); + FUN_1008_0138(0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0xcd7e,0xcccc,0x4ccc,0x9a80,0x9999,0x1999,0,0, + 0x39,0,0x142,0,0x43,0,0x146,0,0,0,2,1,0x1c); + FUN_1008_0138(0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0xcd7e,0xcccc,0x4ccc,0x9a80,0x9999,0x1999,0,0, + 0x30,0,0x13c,0,0x39,0,0x142,0,0,0,2,1,0x1d); + FUN_1008_0138(0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0xcd7e,0xcccc,0x4ccc,0x9a80,0x9999,0x1999,0,0, + 0x29,0,0x133,0,0x30,0,0x13c,0,0,0,2,1,0x1e); + FUN_1008_0138(0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0xcd7e,0xcccc,0x4ccc,0x9a80,0x9999,0x1999,0,0, + 0x24,0,0x128,0,0x29,0,0x133,0,0,0,2,1,0x1f); + FUN_1008_0138(0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0xcd7e,0xcccc,0x4ccc,0x9a80,0x9999,0x1999,0,0, + 0x23,0,0x11d,0,0x24,0,0x128,0,0,0,2,1,0x20); + FUN_1008_0138(0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0xcd7d,0xcccc,0x4ccc,0x9a80,0x9999,0x1999,0,0, + 0x23,0,0x70,0,0x23,0,0x11d,0,0,0,2,1,0x21); + FUN_1008_0138(0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0xcd7d,0xcccc,0x4ccc,0x9a80,0x9999,0x1999,0,0, + 0x28,0,99,0,0x22,0,0x79,0,0,0,2,1,0x22); + FUN_1008_0138(0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0xcd7d,0xcccc,0x4ccc,0x9a80,0x9999,0x1999,0,0, + 0x33,0,0x4e,0,0x28,0,100,0,0,0,2,1,0x23); + FUN_1008_0138(0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0xcd7d,0xcccc,0x4ccc,0x9a80,0x9999,0x1999,0,0, + 0x45,0,0x42,0,0x32,0,0x4f,0,0,0,2,1,0x24); + FUN_1008_0138(0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0xcd7d,0xcccc,0x4ccc,0x9a80,0x9999,0x1999,0,0, + 0x5d,0,0x39,0,0x41,0,0x44,0,0,0,2,1,0x25); + FUN_1008_0138(0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0xcd7d,0xcccc,0x4ccc,0x9a80,0x9999,0x1999,0,0, + 0xae,0,0x3b,0,0x52,0,0x3b,0,0,0,2,1,0x26); + FUN_1008_0138(0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0xcd7d,0xcccc,0x4ccc,0x9a80,0x9999,0x1999,0,0, + 0xbe,0,0x43,0,0xa7,0,0x3a,0,0,0,2,1,0x27); + FUN_1008_0138(0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0xcd7d,0xcccc,0x4ccc,0x9a80,0x9999,0x1999,8,0, + 0,0,0,0,0xc1,0,0x3c,0,0,1,1,1,0x28); + FUN_1008_0138(0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0xcd7d,0xcccc,0x4ccc,0x9a80,0x9999,0x1999,0,0, + 0xd2,0,0x29,0,199,0,0x40,0,0,0,2,1,0x29); + FUN_1008_0138(0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0xcd7d,0xcccc,0x4ccc,0x9a80,0x9999,0x1999,8,0, + 0,0,0,0,0xcb,0,0x26,0,0,1,1,1,0x2a); + FUN_1008_0138(0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0xcd7d,0xcccc,0x4ccc,0x9a80,0x9999,0x1999,0,0, + 0xb9,0,0x16,0,0xce,0,0x1f,0,0,0,2,1,0x2b); + FUN_1008_0138(0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0xcd7d,0xcccc,0x4ccc,0x9a80,0x9999,0x1999,0,0, + 0x1f,0,0x16,0,0xb9,0,0x16,0,0,0,2,1,0x2c); + FUN_1008_0138(0,0,0,0,0,0,0,0,1,0x86a0,1,0,0,0,0,0,0,0,0,0xcd7d,0xcccc,0x4ccc,0xcd7f,0xcccc,0x4ccc + ,0,0,0x21,0,0xb,0,0x21,0,0x17,0,0,0,2,1,0x2d); + FUN_1008_0138(0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0xcd7d,0xcccc,0x4ccc,0x9a80,0x9999,0x1999,0,0, + 0xbe,0,0xd,0,0x1e,0,0xd,0,0,0,2,1,0x2e); + FUN_1008_0138(0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0xcd7d,0xcccc,0x4ccc,0x9a80,0x9999,0x1999,0,0, + 0xfa,0,0x20,0,0xb9,0,0xc,0,0,0,2,1,0x2f); + FUN_1008_0138(0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0xcd7d,0xcccc,0x4ccc,0x9a80,0x9999,0x1999,8,0, + 0,0,0,0,0xfb,0,0x19,0,0,1,1,1,0x30); + FUN_1008_0138(0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0xcd7d,0xcccc,0x4ccc,0x9a80,0x9999,0x1999,0,0, + 0x140,0,10,0,0xfb,0,0x21,0,0,0,2,1,0x31); + FUN_1008_0138(0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0xcd7d,0xcccc,0x4ccc,0x9a80,0x9999,0x1999,0,0, + 0x1ab,0,0xc,0,0x119,0,0xc,0,0,0,2,1,0x32); + FUN_1008_0138(0xa3,0xb4,0x85,0x96,0,0,0,0,1,1000,0,0,0x40,0xcd7f,0xcccc,0x4ccc,0xcd7d,0xcccc, + 0xcccc,0xcd7d,0xcccc,0x4ccc,0xcd80,0xcccc,0x4ccc,0x17,0,0,0,0,0,0xa8,0,0xa5,0,0,1,1, + 1,0x33); + FUN_1008_0138(0x7d,0xdd,0x5f,0xbf,0,0,0,0,1,1000,0,0,0x40,0xcd7f,0xcccc,0x4ccc,0xcd7d,0xcccc, + 0xcccc,0xcd7d,0xcccc,0x4ccc,0xcd80,0xcccc,0x4ccc,0x17,0,0,0,0,0,0x82,0,0xce,0,0,1,1, + 1,0x34); + FUN_1008_0138(0xb4,0xea,0x96,0xcc,0,0,0,0,1,1000,0,0,0x40,0xcd7f,0xcccc,0x4ccc,0xcd7d,0xcccc, + 0xcccc,0xcd7d,0xcccc,0x4ccc,0xcd80,0xcccc,0x4ccc,0x17,0,0,0,0,0,0xb9,0,0xdb,0,0,1,1, + 1,0x35); + FUN_1008_0138(0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0xcd7d,0xcccc,0x4ccc,0x80,0,0,8,0,0,0,0,0, + 0x138,0,0x35,0,0,1,1,1,0x36); + FUN_1008_0138(0,0,0,0,0,0,0,0,2,0,0,0,0,0xcd7f,0xcccc,0x4ccc,0xcd7f,0xcccc,0xcccc,0xcd7d,0xcccc, + 0x4ccc,0x80,0,0,0,0,0x48,0,0x30,0,0xfffb,0xffff,6,0,1,0,2,1,0x37); + FUN_1008_0138(0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0xcd7d,0xcccc,0x4ccc,0x80,0,0,8,0,0,0,0,0,0,0, + 0xfff7,0xffff,1,1,1,1,0x38); + FUN_1008_0138(0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0xcd7d,0xcccc,0x4ccc,0x80,0,0,0,0,0xffe6, + 0xffff,0xffd1,0xffff,7,0,0xffff,0xffff,1,0,2,1,0x39); + FUN_1008_0138(0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0xcd7d,0xcccc,0x4ccc,0x80,0,0,8,0,0,0,0,0, + 0xfff9,0xffff,3,0,1,1,1,1,0x3a); + FUN_1008_0138(0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0xcd7d,0xcccc,0x4ccc,0x80,0,0,0,0,0xffd3, + 0xffff,0,0,0,0,0xfff8,0xffff,1,0,2,1,0x3b); + FUN_1008_0138(0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0xcd7d,0xcccc,0x4ccc,0x9a80,0x9999,0x1999,10,0 + ,0,0,0,0,0x13a,0,0x1d,0,0,1,1,1,0x3c); + FUN_1008_0138(0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0xcd7d,0xcccc,0x4ccc,0x80,0,0,0,0,0x16f,0,0x25 + ,0,0x138,0,0x25,0,0,0,2,1,0x3d); + FUN_1008_0138(0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0xcd7c,0xcccc,0x4ccc,0xcd7f,0xcccc,0x4ccc,0,0, + 0x194,0,0x6e,0,0x16f,0,0x25,0,0,0,2,1,0x3e); + FUN_1008_0138(0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0xcd7d,0xcccc,0x4ccc,0x9a80,0x9999,0x1999,0,0, + 0x195,0,0x13,0,0x1ac,0,0x5c,0,0,0,2,1,0x3f); + FUN_1008_0138(0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0xcd7d,0xcccc,0x4ccc,0x9a80,0x9999,0x1999,0,0, + 0x137,0,0x13,0,0x195,0,0x13,0,0,0,2,1,0x40); + FUN_1008_0138(0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0xcd7d,0xcccc,0x4ccc,0x80,0,0,0xf,0,0,0,0,0, + 0x1a1,0,0x67,0,0,1,1,1,0x41); + FUN_1008_0138(0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0xcd7e,0xcccc,0x4ccc,0x80,0,0,0,0,0x1b1,0,0x8d + ,0,0x196,0,0x70,0,0,0,2,1,0x42); + FUN_1008_0138(0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0xcd7e,0xcccc,0x4ccc,0x80,0,0,9,0,0,0,0,0, + 0x1b7,0,0x86,0,0,1,1,1,0x43); + FUN_1008_0138(0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0xcd7e,0xcccc,0x4ccc,0x80,0,0,0,0,0x1af,0,0x61 + ,0,0x1bf,0,0x82,0,0,0,2,1,0x44); + FUN_1008_0138(0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0xcd7d,0xcccc,0x4ccc,0x80,0,0,8,0,0,0,0,0, + 0x138,0,0x104,0,0,1,1,1,0x45); + FUN_1008_0138(0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0xcd7d,0xcccc,0x4ccc,0x80,0,0,0,0,0x2d,0,0,0,0 + ,0,7,0,1,0,2,1,0x46); + FUN_1008_0138(0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0xcd7d,0xcccc,0x4ccc,0x80,0,0,8,0,0,0,0,0, + 0xffff,0xffff,0xfff9,0xffff,1,1,1,1,0x47); + FUN_1008_0138(0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0xcd7d,0xcccc,0x4ccc,0x80,0,0,0,0,0x16,0, + 0xffd1,0xffff,8,0,1,0,1,0,2,1,0x48); + FUN_1008_0138(0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0xcd7d,0xcccc,0x4ccc,0x80,0,0,8,0,0,0,0,0, + 0xfff8,0xffff,0,0,1,1,1,1,0x49); + FUN_1008_0138(0,0,0,0,0,0,0,0,2,0,0,0,0,0xcd7f,0xcccc,0x4ccc,0xcd7f,0xcccc,0xcccc,0xcd7d,0xcccc, + 0x4ccc,0x80,0,0,0,0,0xffb9,0xffff,0x32,0,0xfffe,0xffff,0xfff7,0xffff,1,0,2,1,0x4a); + FUN_1008_0138(0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0xcd7d,0xcccc,0x4ccc,0x9a80,0x9999,0x1999,9,0, + 0,0,0,0,0x138,0,0x11c,0,0,1,1,1,0x4b); + FUN_1008_0138(0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0xcd7d,0xcccc,0x4ccc,0x80,0,0,0,0,0x195,0, + 0x124,0,0x137,0,0x124,0,0,0,2,1,0x4c); + FUN_1008_0138(0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0xcd7d,0xcccc,0x4ccc,0x9a80,0x9999,0x1999,0,0, + 0x1ac,0,0xdd,0,0x195,0,0x124,0,0,0,2,1,0x4d); + FUN_1008_0138(0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0xcd7c,0xcccc,0x4ccc,0x80,0,0,0,0,0x16f,0, + 0x113,0,0x194,0,0xcd,0,0,0,2,1,0x4e); + FUN_1008_0138(0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0xcd7d,0xcccc,0x4ccc,0x9a80,0x9999,0x1999,0,0, + 0x138,0,0x113,0,0x16f,0,0x113,0,0,0,2,1,0x4f); + FUN_1008_0138(0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0xcd7e,0xcccc,0x4ccc,0x80,0,0,0xf,0,0,0,0,0, + 0x1a1,0,0xd2,0,0,1,1,1,0x50); + FUN_1008_0138(0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0xcd7e,0xcccc,0x4ccc,0x80,0,0,0,0,0x1bf,0,0xb1 + ,0,0x1af,0,0xd8,0,0,0,2,1,0x51); + FUN_1008_0138(0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0xcd7e,0xcccc,0x4ccc,0x80,0,0,9,0,0,0,0,0, + 0x1b7,0,0xb3,0,0,1,1,1,0x52); + FUN_1008_0138(0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0xcd7e,0xcccc,0x4ccc,0x80,0,0,0,0,0x196,0,0xc9 + ,0,0x1b1,0,0xac,0,0,0,2,1,0x53); + FUN_1008_0138(0,0,0,0,0,0,0,0,3,0x5dc,0,0,4,0,0,0,0,0,0,0,0,0,0x9a80,0x9999,0x1999,0,0,0xdd,0,0x28 + ,0,0xcd,0,0x49,0,0,0,2,1,0x54); + FUN_1008_0138(0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0x9a80,0x9999,0x1999,0,0,0xcd,0,0x49,0, + 0xc1,0,0x43,0,0,0,2,1,0x55); + FUN_1008_0138(0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0x9a80,0x9999,0x1999,0,0,0xd1,0,0x22,0, + 0xdd,0,0x28,0,0,0,2,1,0x56); + FUN_1008_0138(0,0,0,0,0,0,0,0,3,0x5dc,0,0x55,6,0,0,0,0,0,0,0,0,0,0x9a80,0x9999,0x1999,0,0,0xe7,0, + 0x2a,0,0xd5,0,0x4c,0,0,0,2,0,0x57); + FUN_1008_0138(0,0,0,0,0,0,0,0,3,0x5dc,0,0x56,6,0,0,0,0,0,0,0,0,0,0x9a80,0x9999,0x1999,0,0,0xef,0, + 0x2d,0,0xdd,0,0x4f,0,0,0,2,0,0x58); + FUN_1008_0138(0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0x9a80,0x9999,0x1999,0x13,0,0,0,0,0,0x72 + ,0,0x121,0,0,0,3,1,0x59); + FUN_1008_0138(0xf6,0x132,0xe7,0x11a,0,0,0,0,3,0x5dc,0,0x5a,0x208a,0,0,0,0,0,0,0,0,0,0x9a80,0x9999, + 0x1999,0,0,0xf7,0,0x124,0,0x111,0,0x124,0,0,0,2,1,0x5a); + FUN_1008_0138(0xf6,0x132,0xe7,0x11a,0,0,0,0,3,0x5dc,0,0x5a,0x208a,0,0,0,0,0,0,0,0,0,0xcd7f,0xcccc, + 0x4ccc,0,0,0x111,0,0x124,0,0x111,0,0x12e,0,0,0,2,1,0x5b); + FUN_1008_0138(0xf6,0x132,0xe7,0x11a,0,0,0,0,3,0x5dc,0,0x5a,0x208a,0,0,0,0,0,0,0,0,0,0xcd7f,0xcccc, + 0x4ccc,0,0,0xf7,0,0x12e,0,0xf7,0,0x124,0,0,0,2,1,0x5c); + FUN_1008_0138(0xe7,0x132,0xd9,0x11a,0,0,0,0,3,0x5dc,0,0x5d,0x208a,0,0,0,0,0,0,0,0,0,0x9a80,0x9999, + 0x1999,0,0,0xe7,0,0x124,0,0x100,0,0x124,0,0,0,2,1,0x5d); + FUN_1008_0138(0xe7,0x132,0xd9,0x11a,0,0,0,0,3,0x5dc,0,0x5d,0x208a,0,0,0,0,0,0,0,0,0,0xcd7f,0xcccc, + 0x4ccc,0,0,0x100,0,0x124,0,0x100,0,0x12e,0,0,0,2,1,0x5e); + FUN_1008_0138(0xe7,0x132,0xd9,0x11a,0,0,0,0,3,0x5dc,0,0x5d,0x208a,0,0,0,0,0,0,0,0,0,0xcd7f,0xcccc, + 0x4ccc,0,0,0xe7,0,0x12e,0,0xe7,0,0x124,0,0,0,2,1,0x5f); + FUN_1008_0138(0xd8,0x132,0xca,0x11a,0,0,0,0,3,0x5dc,0,0x60,0x208a,0,0,0,0,0,0,0,0,0,0x9a80,0x9999, + 0x1999,0,0,0xd9,0,0x124,0,0xf1,0,0x124,0,0,0,2,1,0x60); + FUN_1008_0138(0xd8,0x132,0xca,0x11a,0,0,0,0,3,0x5dc,0,0x60,0x208a,0,0,0,0,0,0,0,0,0,0xcd7f,0xcccc, + 0x4ccc,0,0,0xf1,0,0x124,0,0xf1,0,0x12e,0,0,0,2,1,0x61); + FUN_1008_0138(0xd8,0x132,0xca,0x11a,0,0,0,0,3,0x5dc,0,0x60,0x208a,0,0,0,0,0,0,0,0,0,0xcd7f,0xcccc, + 0x4ccc,0,0,0xd9,0,0x12e,0,0xd9,0,0x124,0,0,0,2,1,0x62); + FUN_1008_0138(0xc9,0x132,0xbb,0x11a,0,0,0,0,3,0x5dc,0,99,0x208a,0,0,0,0,0,0,0,0,0,0x9a80,0x9999, + 0x1999,0,0,0xc9,0,0x124,0,0xe2,0,0x124,0,0,0,2,1,99); + FUN_1008_0138(0xc9,0x132,0xbb,0x11a,0,0,0,0,3,0,0,99,0x208a,0,0,0,0,0,0,0,0,0,0xcd7f,0xcccc,0x4ccc + ,0,0,0xe2,0,0x124,0,0xe2,0,0x12e,0,0,0,2,1,100); + FUN_1008_0138(0xc9,0x132,0xbb,0x11a,0,0,0,0,3,0,0,99,0x208a,0,0,0,0,0,0,0,0,0,0xcd7f,0xcccc,0x4ccc + ,0,0,0xca,0,0x12e,0,0xca,0,0x124,0,0,0,2,1,0x65); + FUN_1008_0138(0xba,0x132,0xae,0x11a,0,0,0,0,3,0x5dc,0,0x66,0x208a,0,0,0,0,0,0,0,0,0,0x9a80,0x9999, + 0x1999,0,0,0xbb,0,0x124,0,0xd2,0,0x124,0,0,0,2,1,0x66); + FUN_1008_0138(0xba,0x132,0xae,0x11a,0,0,0,0,3,0,0,0x66,0x208a,0,0,0,0,0,0,0,0,0,0xcd7f,0xcccc, + 0x4ccc,0,0,0xd1,0,0x124,0,0xd2,0,0x12e,0,0,0,2,1,0x67); + FUN_1008_0138(0xba,0x132,0xae,0x11a,0,0,0,0,3,0,0,0x66,0x208a,0,0,0,0,0,0,0,0,0,0xcd7f,0xcccc, + 0x4ccc,0,0,0xb7,0,0x12e,0,0xbc,0,0x124,0,0,0,2,1,0x68); + FUN_1008_0138(0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0xcd7e,0xcccc,0x4ccc,0x9a80,0x9999,0x1999,0,0, + 0xe0,0,0x94,0,0xf2,0,0xcb,0,0,0,2,1,0x69); + FUN_1008_0138(0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0xcd7d,0xcccc,0x4ccc,0x9a80,0x9999,0x1999,0xe, + 0,0,0,0,0,0xd4,0,0x9c,0,0,1,1,1,0x6a); + FUN_1008_0138(0,0,0,0,0,0,0,0,3,0,0,0,0,0x9a7f,0x9999,0x1999,0xcd7f,0xcccc,0xcccc,0xcd7d,0xcccc, + 0x4ccc,0x9a80,0x9999,0x1999,0,0,0xd9,0,0xd7,0,0xc6,0,0x9e,0,0,0,2,1,0x6b); + FUN_1008_0138(0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0xcd7d,0xcccc,0x4ccc,0x9a80,0x9999,0x1999,0xe, + 0,0,0,0,0,0xe6,0,0xd2,0,0,1,1,1,0x6c); + FUN_1008_0138(0xec,0xce,0xd6,0xc0,0,0,0,0,3,0x5dc,0,0x6d,0x2092,0,0,0,0,0,0,0,0,0,0x9a80,0x9999, + 0x1999,0,0,0xf6,0,0xbb,0,0xfd,0,0xd1,0,0,0,2,1,0x6d); + FUN_1008_0138(0xdc,0xcd,0xd6,0xc0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0x9a80,0x9999,0x1999,0,0, + 0xfd,0,0xd1,0,0xee,0,0xd6,0,0,0,2,1,0x6e); + FUN_1008_0138(0xdc,0xcd,0xd6,0xc0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0x9a80,0x9999,0x1999,0,0, + 0xea,0,0xbf,0,0xf6,0,0xbb,0,0,0,2,1,0x6f); + FUN_1008_0138(0xe7,0xbf,0xd1,0xb2,0,0,0,0,3,0x5dc,0,0x70,0x2092,0,0,0,0,0,0,0,0,0,0x9a80,0x9999, + 0x1999,0,0,0xef,0,0xa9,0,0xf9,0,0xc6,0,0,0,2,1,0x70); + FUN_1008_0138(0xdc,0xcd,0xd6,0xc0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0x9a80,0x9999,0x1999,0,0, + 0xf9,0,0xc6,0,0xed,0,0xca,0,0,0,2,1,0x71); + FUN_1008_0138(0xdc,0xcd,0xd6,0xc0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0x9a80,0x9999,0x1999,0,0, + 0xe3,0,0xad,0,0xef,0,0xa9,0,0,0,2,1,0x72); + FUN_1008_0138(0xe2,0xb1,0xcc,0xa3,0,0,0,0,3,0x5dc,0,0x73,0x2092,0,0,0,0,0,0,0,0,0,0x9a80,0x9999, + 0x1999,0,0,0xe9,0,0x99,0,0xf3,0,0xb6,0,0,0,2,1,0x73); + FUN_1008_0138(0xdc,0xcd,0xd6,0xc0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0x9a80,0x9999,0x1999,0,0, + 0xf3,0,0xb6,0,0xe7,0,0xba,0,0,0,2,1,0x74); + FUN_1008_0138(0xdc,0xcd,0xd6,0xc0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0x9a80,0x9999,0x1999,0,0, + 0xdd,0,0x9d,0,0xe9,0,0x99,0,0,0,2,1,0x75); + FUN_1008_0138(0xdd,0xa3,0xc6,0x95,0,0,0,0,3,0x5dc,0,0x76,0x2092,0,0,0,0,0,0,0,0,0,0x9a80,0x9999, + 0x1999,0,0,0xe2,0,0x8b,0,0xed,0,0xa3,0,0,0,2,1,0x76); + FUN_1008_0138(0xdc,0xcd,0xd6,0xc0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0x9a80,0x9999,0x1999,0,0, + 0xed,0,0xa3,0,0xe1,0,0xa7,0,0,0,2,1,0x77); + FUN_1008_0138(0xdc,0xcd,0xd6,0xc0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0x9a80,0x9999,0x1999,0,0, + 0xd3,0,0x90,0,0xe2,0,0x8b,0,0,0,2,1,0x78); + FUN_1008_0138(0,0,0,0,0,0,0,0,1,2000,0,0,0x400,0,0,0,0,0,0,0,0,0,0x9a80,0x9999,0x1999,0,0,0xa0,0, + 0x54,0,0x95,0,0x69,0,0,0,2,1,0x79); + FUN_1008_0138(0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0x9a80,0x9999,0x1999,0,0,0x95,0,0x69,0, + 0x8b,0,0x65,0,0,0,2,1,0x7a); + FUN_1008_0138(0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0x9a80,0x9999,0x1999,0,0,0x96,0,0x50,0, + 0xa0,0,0x54,0,0,0,2,1,0x7b); + FUN_1008_0138(0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0xcd7d,0xcccc,0x4ccc,0x9a80,0x9999,0x1999,0,0, + 0x97,0,0x57,0,0x8b,0,0x6f,0,0,0,2,1,0x7c); + FUN_1008_0138(0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0xcd7d,0xcccc,0x4ccc,0x9a80,0x9999,0x1999,8,0, + 0,0,0,0,0x92,0,0x54,0,0,1,1,1,0x7d); + FUN_1008_0138(0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0xcd7d,0xcccc,0x4ccc,0x9a80,0x9999,0x1999,0,0, + 0x6c,0,0x4d,0,0x93,0,0x4d,0,0,0,2,1,0x7e); + FUN_1008_0138(0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0xcd7d,0xcccc,0x4ccc,0x9a80,0x9999,0x1999,0,0, + 0x6a,0,0x57,0,0x6c,0,0x4d,0,0,0,2,1,0x7f); + FUN_1008_0138(0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0xcd7d,0xcccc,0x4ccc,0x9a80,0x9999,0x1999,0,0, + 0x8d,0,0x6e,0,0x6a,0,0x57,0,0,0,2,1,0x80); + FUN_1008_0138(0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0x9a80,0x9999,0x1999,0x13,0,0,0,0,0,0x60 + ,0,0x60,0,0,0,3,1,0x81); + FUN_1008_0138(0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0x9a80,0x9999,0x1999,0x13,0,0,0,0,0,0x45 + ,0,0x73,0,0,0,3,1,0x82); + FUN_1008_0138(0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0x9a80,0x9999,0x1999,0x13,0,0,0,0,0,0x50 + ,0,0x93,0,0,0,3,1,0x83); + FUN_1008_0138(0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0x9a80,0x9999,0x1999,0x13,0,0,0,0,0,0x70 + ,0,0x93,0,0,0,3,1,0x84); + FUN_1008_0138(0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0x9a80,0x9999,0x1999,0x13,0,0,0,0,0,0x7b + ,0,0x73,0,0,0,3,1,0x85); + FUN_1008_0138(0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0xcd7d,0xcccc,0x4ccc,0x9a80,0x9999,0x1999,0x14 + ,0,0,0,0,0,0x60,0,0x7c,0,0,1,1,1,0x86); + FUN_1008_0138(0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0xcd7d,0xcccc,0x4ccc,0x9a80,0x9999,0x1999,0x11 + ,0,0,0,0,0,0x4e,0,100,0,0,1,1,1,0x87); + FUN_1008_0138(0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0xcd7d,0xcccc,0x4ccc,0x9a80,0x9999,0x1999,0x11 + ,0,0,0,0,0,0x44,0,0x85,0,0,1,1,1,0x88); + FUN_1008_0138(0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0xcd7d,0xcccc,0x4ccc,0x9a80,0x9999,0x1999,0x11 + ,0,0,0,0,0,0x60,0,0x9a,0,0,1,1,1,0x89); + FUN_1008_0138(0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0xcd7d,0xcccc,0x4ccc,0x9a80,0x9999,0x1999,0x11 + ,0,0,0,0,0,0x7d,0,0x85,0,0,1,1,1,0x8a); + FUN_1008_0138(0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0xcd7d,0xcccc,0x4ccc,0x9a80,0x9999,0x1999,0x11 + ,0,0,0,0,0,0x72,0,100,0,0,1,1,1,0x8b); + FUN_1008_0138(0xbc,0x1f,0xae,0x11,0,0,0,0,1,1000,0,0,0xc0,0,0,0,0,0,0,0,0,0,0,0,0,0xc,0,0,0,0,0, + 0xca,0,0x18,0,0,0,4,1,0x8c); + FUN_1008_0138(0xa9,0x19,0x9b,0xb,0,0,0,0,1,1000,0,0,0xc0,0,0,0,0,0,0,0,0,0,0,0,0,0xc,0,0,0,0,0, + 0xb6,0,0x12,0,0,0,4,1,0x8d); + FUN_1008_0138(0x96,0x18,0x88,10,0,0,0,0,1,0x5dc,0,0,0xc0,0,0,0,0,0,0,0,0,0,0,0,0,0xc,0,0,0,0,0, + 0xa4,0,0x11,0,0,0,4,1,0x8e); + FUN_1008_0138(0x83,0x18,0x75,10,0,0,0,0,1,0x5dc,0,0,0xc0,0,0,0,0,0,0,0,0,0,0,0,0,0xc,0,0,0,0,0, + 0x91,0,0x11,0,0,0,4,1,0x8f); + FUN_1008_0138(0x70,0x18,0x62,10,0,0,0,0,1,2000,0,0,0xc0,0,0,0,0,0,0,0,0,0,0,0,0,0xc,0,0,0,0,0,0x7e + ,0,0x11,0,0,0,4,1,0x90); + FUN_1008_0138(0x5d,0x18,0x4f,10,0,0,0,0,1,2000,0,0,0xc0,0,0,0,0,0,0,0,0,0,0,0,0,0xc,0,0,0,0,0,0x6b + ,0,0x11,0,0,0,4,1,0x91); + FUN_1008_0138(0x4f,0x18,0x3c,10,0,0,0,0,1,0x9c4,0,0,0xc0,0,0,0,0,0,0,0,0,0,0,0,0,0xc,0,0,0,0,0, + 0x57,0,0x11,0,0,0,4,1,0x92); + FUN_1008_0138(0x37,0x18,0x29,10,0,0,0,0,1,3000,0,0,0xc0,0,0,0,0,0,0,0,0,0,0,0,0,0xc,0,0,0,0,0,0x44 + ,0,0x11,0,0,0,4,1,0x93); + FUN_1008_0138(0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0x9a80,0x9999,0x1999,0x13,0,0,0,0,0,0x2b + ,0,0x11,0,0,0,3,1,0x94); + FUN_1008_0138(0x49,0x4d,0x39,0x3c,0,0,0,0,1,500,0,0,0x140,0,0,0,0,0,0,0,0,0,0,0,0,0x10,0,0,0,0,0, + 0x55,0,0x44,0,0,0,4,0,0x95); + FUN_1008_0138(0x32,0xd3,0x28,199,0,0,0,0,1,500,0,0,0x1000,0,0,0,0,0,0,0,0,0,0,0,0,0xb,0,0,0,0,0, + 0x43,0,0xcd,0,0,0,4,1,0x96); + FUN_1008_0138(0x33,0xf0,0x29,0xe4,0,0,0,0,1,500,0,0,0x1000,0,0,0,0,0,0,0,0,0,0,0,0,0xb,0,0,0,0,0, + 0x42,0,0xe9,0,0,0,4,1,0x97); + FUN_1008_0138(0x34,0x10d,0x2a,0x101,0,0,0,0,1,500,0,0,0x1000,0,0,0,0,0,0,0,0,0,0,0,0,0xb,0,0,0,0,0 + ,0x42,0,0x108,0,0,0,4,1,0x98); + FUN_1008_0138(0x188,0x17,0x158,0xb,0,0,0,0,2,0,0,0,0x100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x194,0,0x1b, + 0,0x154,0,6,0,0,0,4,0,0x99); + FUN_1008_0138(0x18a,0x12f,0x15a,0x123,0,0,0,0,2,0,0,0,0x100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x192,0, + 0x133,0,0x154,0,0x11b,0,0,0,4,0,0x9a); + FUN_1008_0138(0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0xcd7d,0xcccc,0x4ccc,0x9a80,0x9999,0x1999,0xb, + 0,0,0,0,0,0x4f,0,0xb7,0,0,1,1,1,0x9b); + FUN_1008_0138(0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0xcd7d,0xcccc,0x4ccc,0x9a80,0x9999,0x1999,0,0, + 0x34,0,0xb8,0,0x4b,0,0xac,0,0,0,2,1,0x9c); + FUN_1008_0138(0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0xcd7d,0xcccc,0x4ccc,0x9a80,0x9999,0x1999,0xb, + 0,0,0,0,0,0x38,0,0xc3,0,0,1,1,1,0x9d); + FUN_1008_0138(0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0xcd7d,0xcccc,0x4ccc,0x9a80,0x9999,0x1999,0,0, + 0x52,0,0xc1,0,0x3d,0,0xcd,0,0,0,2,1,0x9e); + FUN_1008_0138(0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0xcd7d,0xcccc,0x4ccc,0x9a80,0x9999,0x1999,0xb, + 0,0,0,0,0,0x4f,0,0xd4,0,0,1,1,1,0x9f); + FUN_1008_0138(0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0xcd7d,0xcccc,0x4ccc,0x9a80,0x9999,0x1999,0,0, + 0x34,0,0xd5,0,0x4b,0,0xc9,0,0,0,2,1,0xa0); + FUN_1008_0138(0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0xcd7d,0xcccc,0x4ccc,0x9a80,0x9999,0x1999,0xb, + 0,0,0,0,0,0x38,0,0xe0,0,0,1,1,1,0xa1); + FUN_1008_0138(0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0xcd7d,0xcccc,0x4ccc,0x9a80,0x9999,0x1999,0,0, + 0x52,0,0xde,0,0x3d,0,0xea,0,0,0,2,1,0xa2); + FUN_1008_0138(0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0xcd7d,0xcccc,0x4ccc,0x9a80,0x9999,0x1999,0xb, + 0,0,0,0,0,0x4f,0,0xf1,0,0,1,1,1,0xa3); + FUN_1008_0138(0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0xcd7d,0xcccc,0x4ccc,0x9a80,0x9999,0x1999,0,0, + 0x34,0,0xf2,0,0x4b,0,0xe6,0,0,0,2,1,0xa4); + FUN_1008_0138(0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0xcd7d,0xcccc,0x4ccc,0x9a80,0x9999,0x1999,0xb, + 0,0,0,0,0,0x38,0,0xfd,0,0,1,1,1,0xa5); + FUN_1008_0138(0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0xcd7d,0xcccc,0x4ccc,0x9a80,0x9999,0x1999,0,0, + 0x52,0,0xfb,0,0x3d,0,0x107,0,0,0,2,1,0xa6); + FUN_1008_0138(0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0x9a80,0x9999,0x1999,9,0,0,0,0,0,0x10c,0 + ,299,0,0,0,1,1,0xa7); + FUN_1008_0138(0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0x9a80,0x9999,0x1999,0,0,0x111,0,0x123,0 + ,0x123,0,0x12a,0,0,0,2,1,0xa8); + FUN_1008_0138(0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0xcd7d,0xcccc,0x4ccc,0x9a80,0x9999,0x1999,0,0, + 0x4e,0,0x148,0,0x1ba,0,0x148,0,0,0,2,1,0xa9); + FUN_1008_0138(0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0x9a80,0x9999,0x1999,0,0,100,0,0x12a,0, + 0x1a4,0,0x12a,0,0,0,2,1,0xaa); + FUN_1008_0138(0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0x9a80,0x9999,0x1999,0,0,0xbe,0,0x12a,0, + 0x10b,0,0x12a,0,0,0,2,1,0xab); + FUN_1008_0138(0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0x9a80,0x9999,0x1999,9,0,0,0,0,0,0xbf,0, + 299,0,0,0,1,1,0xac); + FUN_1008_0138(0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0x9a80,0x9999,0x1999,0,0,0xa5,0,0x12a,0, + 0xbc,0,0x123,0,0,0,2,1,0xad); + FUN_1008_0138(0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0x6680,0x6666,0x6666,0x11,0,0,0,0,0,0,0, + 0,0,0,1,1,1,0xae); + FUN_1008_0138(0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0x6680,0x6666,0x6666,0x11,0,0,0,0,0,0,0, + 0,0,0,1,1,0,0xaf); + FUN_1008_0787(0x143,0x79,0x130,0x67,1); + FUN_1008_0787(299,0x89,0x118,0x77,2); + FUN_1008_0787(0x123,0xa6,0x110,0x94,3); + FUN_1008_0787(299,0xc3,0x118,0xb1,4); + FUN_1008_0787(0x142,0xd3,0x12f,0xc1,5); + FUN_1008_0787(0x14,0,0x14,0,6); + FUN_1008_0787(0x14,0,0x14,0,7); + FUN_1008_0787(0x14,0,0x14,0,8); + FUN_1008_0787(0x14,0,0x14,0,9); + FUN_1008_0787(0x14,0,0x14,0,10); + FUN_1008_0787(0x14,0,0x14,0,0xb); + FUN_1008_0787(0x14,0,0x14,0,0xc); + FUN_1008_0787(0x14,0,0x14,0,0xd); + FUN_1008_0787(0x14,0,0x14,0,0xe); + FUN_1008_0787(0x54,0x67,0x44,0x57,0xf); + FUN_1008_0787(0x39,0x7b,0x29,0x69,0x10); + FUN_1008_0787(0x43,0x9a,0x33,0x8a,0x11); + FUN_1008_0787(99,0x9a,0x53,0x8a,0x12); + FUN_1008_0787(0x6e,0x7a,0x5e,0x6a,0x13); + FUN_1008_0787(0x1e,0x19,0xe,9,0x14); + local_4 = 1; + while( true ) { + *(undefined1 *)(iVar5 + local_4 + 0x3cc) = *(undefined1 *)(local_4 * 0x53 + 0x98f); + *(undefined2 *)(iVar5 + local_4 * 2 + 0xa42) = *(undefined2 *)(local_4 * 0x53 + 0x99e); + *(undefined1 *)(iVar5 + local_4 + 0x61) = 0; + if (local_4 == 0xaf) break; + local_4 = local_4 + 1; + } + return; +} + + +/* ===== 1000:51f5 FUN_1000_51f5 ===== */ + +void __stdcall16far FUN_1000_51f5(undefined4 param_1) + +{ + int *piVar1; + undefined2 uVar2; + undefined2 uVar3; + uint uVar4; + int iVar5; + undefined2 unaff_CS; + undefined2 uVar6; + int local_4; + + uVar6 = 0; + uVar2 = LOADCURSOR(unaff_CS,0x7f02,0); + uVar3 = SETCURSOR(0x1228,uVar2,uVar6); + FUN_1008_10e3(uVar2,uVar6,uVar3); + uVar2 = (undefined2)((ulong)param_1 >> 0x10); + iVar5 = (int)param_1; + *(undefined1 *)(iVar5 + 0xbd9) = 1; + *(undefined1 *)(iVar5 + 0xbd8) = 1; + uVar4 = *(uint *)(iVar5 + 0x49) | *(uint *)(iVar5 + 0x4b); + if (uVar4 != 0) { + piVar1 = (int *)*(undefined4 *)(iVar5 + 0x49); + (*(code *)*(undefined2 *)(*piVar1 + 8)) + (0x1008,(int *)piVar1,(int)((ulong)piVar1 >> 0x10),CONCAT11((char)(uVar4 >> 8),1)); + } + FUN_1008_00e2(); + DELETEOBJECT(0x1008,*(undefined2 *)(iVar5 + 0x52)); + DELETEOBJECT(0x1228,DAT_1028_0859); + DELETEOBJECT(0x1228,DAT_1028_0863); + DELETEOBJECT(0x1228,DAT_1028_0865); + DELETEOBJECT(0x1228,DAT_1028_085f); + DELETEOBJECT(0x1228,DAT_1028_085b); + DELETEOBJECT(0x1228,DAT_1028_0861); + DELETEOBJECT(0x1228,DAT_1028_085d); + local_4 = 0; + while( true ) { + DELETEOBJECT(0x1228,*(undefined2 *)(local_4 * 2 + 0x430b)); + if (local_4 == 7) break; + local_4 = local_4 + 1; + } + local_4 = 1; + while( true ) { + DELETEOBJECT(0x1228,*(undefined2 *)(local_4 * 2 + 0x4319)); + if (local_4 == 4) break; + local_4 = local_4 + 1; + } + local_4 = 1; + while( true ) { + DELETEOBJECT(0x1228,((undefined2 *)&DAT_1028_4321)[local_4]); + if (local_4 == 9) break; + local_4 = local_4 + 1; + } + SETCURSOR(0x1228,uVar3); + POSTQUITMESSAGE(0x1228,0x12); + FUN_1018_121b(iVar5,uVar2,0); + INVALIDATERECT(0x1018,1,0,0,*(undefined2 *)(iVar5 + 4)); + FUN_1020_0439(); + return; +} + + +/* ===== 1000:531e FUN_1000_531e ===== */ + +void __stdcall16far FUN_1000_531e(int param_1,byte param_2) + +{ + undefined2 uVar1; + undefined2 uVar2; + undefined2 unaff_SS; + undefined2 uVar3; + undefined2 uVar4; + + uVar4 = *(undefined2 *)(param_1 + 0xe); + uVar1 = CREATECOMPATIBLEDC(); + *(undefined2 *)(param_1 + -0xc) = uVar1; + uVar1 = *(undefined2 *)(param_1 + -0xc); + uVar2 = SELECTOBJECT(0x1228,*(undefined2 *)(param_1 + -2)); + *(undefined2 *)(param_1 + -4) = uVar2; + uVar2 = *(undefined2 *)(param_1 + 0xe); + BITBLT(0x1228,0x20,0xcc,0,0,*(undefined2 *)(param_1 + -0xc),0xd,(param_2 - 1) * 7,0x148,0xca); + uVar3 = *(undefined2 *)(param_1 + -0xc); + SELECTOBJECT(0x1228,*(undefined2 *)(param_1 + -4)); + DELETEOBJECT(0x1228,*(undefined2 *)(param_1 + -0xc),uVar3,uVar2,uVar1,uVar4); + return; +} + + +/* ===== 1000:5390 FUN_1000_5390 ===== */ + +void __stdcall16far +FUN_1000_5390(undefined4 param_1,undefined2 param_2,undefined2 param_3,undefined2 param_4) + +{ + undefined2 uVar1; + undefined2 uVar2; + int iVar3; + undefined2 unaff_CS; + undefined2 uVar4; + undefined2 unaff_SS; + undefined2 uVar5; + undefined2 uVar6; + undefined2 uVar7; + undefined2 uVar8; + undefined2 uVar9; + int local_20; + undefined1 local_16 [4]; + int local_12; + int local_10; + undefined2 local_e; + undefined2 local_c; + undefined2 local_a; + undefined2 local_8; + undefined2 local_6; + undefined2 local_4; + + uVar2 = param_4; + uVar1 = SELECTPALETTE(unaff_CS,0,DAT_1028_444e); + UNREALIZEOBJECT(0x1228,DAT_1028_444e,uVar2); + REALIZEPALETTE(0x1228,param_4); + uVar4 = 0x1008; + FUN_1008_00e2(); + iVar3 = (int)param_1; + uVar2 = (undefined2)((ulong)param_1 >> 0x10); + if (DAT_1028_07cc != '\0') { + local_4 = FUN_1008_149d(0x3e3,0,DAT_1028_06fe); + uVar6 = CREATECOMPATIBLEDC(0x1008,param_4); + local_e = uVar6; + local_6 = SELECTOBJECT(0x1228,local_4); + uVar5 = param_4; + BITBLT(0x1228,0x20,0xcc,0,0,local_e,0x1e0,0x280,0,0); + uVar4 = local_e; + SELECTOBJECT(0x1228,local_6); + DELETEOBJECT(0x1228,local_e,uVar4,uVar5,uVar6); + DELETEOBJECT(0x1228,local_4); + local_4 = FUN_1008_149d(0x3e2,0,DAT_1028_06fe); + FUN_1000_531e(&stack0xfffe,2); + FUN_1008_0f2e(); + FUN_1000_531e(&stack0xfffe,3); + FUN_1000_531e(&stack0xfffe,4); + DAT_1028_085d = FUN_1008_149d(0x3e6,0,DAT_1028_06fe); + FUN_1000_531e(&stack0xfffe,5); + DAT_1028_085b = FUN_1008_149d(0x3e6,0,DAT_1028_06fe); + FUN_1000_531e(&stack0xfffe,6); + DAT_1028_0861 = LOADBITMAP(0x1000,500,0); + local_20 = 0; + while( true ) { + FUN_1000_531e(&stack0xfffe,local_20 + 7); + uVar4 = FUN_1008_149d(local_20 + 400,local_20 + 400 >> 0xf,DAT_1028_06fe); + *(undefined2 *)(local_20 * 2 + 0x430b) = uVar4; + if (local_20 == 7) break; + local_20 = local_20 + 1; + } + local_20 = 1; + while( true ) { + FUN_1000_531e(&stack0xfffe,local_20 + 0xe); + uVar4 = FUN_1008_149d(local_20 + 700,local_20 + 700 >> 0xf,DAT_1028_06fe); + *(undefined2 *)(local_20 * 2 + 0x4319) = uVar4; + if (local_20 == 4) break; + local_20 = local_20 + 1; + } + local_20 = 1; + while( true ) { + FUN_1000_531e(&stack0xfffe,local_20 + 0x12); + uVar4 = FUN_1008_149d(local_20 + 800,local_20 + 800 >> 0xf,DAT_1028_06fe); + ((undefined2 *)&DAT_1028_4321)[local_20] = uVar4; + if (local_20 == 9) break; + local_20 = local_20 + 1; + } + FUN_1000_531e(&stack0xfffe,0x1c); + uVar4 = LOADBITMAP(0x1000,0x66,0); + *(undefined2 *)(iVar3 + 0x54) = uVar4; + FUN_1000_531e(&stack0xfffe,0x1d); + DAT_1028_0863 = FUN_1008_149d(900,0,DAT_1028_06fe); + FUN_1000_531e(&stack0xfffe,0x1e); + uVar4 = LOADBITMAP(0x1000,0x65,0); + *(undefined2 *)(iVar3 + 0x52) = uVar4; + FUN_1000_531e(&stack0xfffe,0x1f); + DAT_1028_085f = FUN_1008_149d(0x3e5,0,DAT_1028_06fe); + FUN_1000_531e(&stack0xfffe,0x20); + DAT_1028_0865 = FUN_1008_149d(0x385,0,DAT_1028_06fe); + FUN_1000_531e(&stack0xfffe,0x21); + DAT_1028_0859 = FUN_1008_149d(600,0,DAT_1028_06fe); + FUN_1000_531e(&stack0xfffe,0x22); + DAT_1028_07cc = '\0'; + FUN_1000_531e(&stack0xfffe,0x23); + DELETEOBJECT(0x1000,local_4); + uVar5 = param_4; + SELECTPALETTE(0x1228,0,uVar1); + uVar7 = 0; + uVar6 = LOADCURSOR(0x1228,0x7f00,0); + uVar4 = 0x1228; + SETCURSOR(0x1228,uVar6,uVar7,uVar5); + } + if (*(char *)(iVar3 + 0xbd8) == '\0') { + *(undefined1 *)(iVar3 + 0xbd9) = 1; + local_c = CREATECOMPATIBLEDC(uVar4,param_4); + local_e = CREATECOMPATIBLEDC(0x1228,param_4); + GETCLIENTRECT(0x1228,local_16,unaff_SS); + local_a = CREATECOMPATIBLEBITMAP(0x1228,local_10 + 1,local_12 + 1); + local_6 = SELECTOBJECT(0x1228,DAT_1028_085b); + local_8 = SELECTOBJECT(0x1228,local_a); + uVar9 = local_e; + BITBLT(0x1228,0x20,0xcc,0,0,local_c,local_10,local_12,0,0); + uVar8 = local_c; + BITBLT(0x1228,0x20,0xcc,0,0,local_e,local_10,local_12,0,0); + uVar5 = 0xcc; + uVar4 = 0x20; + uVar7 = param_4; + BITBLT(0x1228,0x20,0xcc,0,0,local_e,local_10,local_12,0,0); + uVar6 = local_e; + SELECTOBJECT(0x1228,local_8); + DELETEOBJECT(0x1228,local_a,uVar6,uVar7,uVar8,uVar9); + DELETEDC(0x1228,local_e); + uVar7 = 0x1228; + uVar6 = 0x5706; + uVar8 = local_6; + uVar9 = local_c; + SELECTOBJECT(0x1228,local_6); + if ((((0 < *(int *)(iVar3 + 0xba4)) || + ((-1 < *(int *)(iVar3 + 0xba4) && (*(int *)(iVar3 + 0xba2) != 0)))) && + ((0 < *(int *)(iVar3 + 0xba8) || + ((-1 < *(int *)(iVar3 + 0xba8) && (*(int *)(iVar3 + 0xba6) != 0)))))) && + (*(char *)(iVar3 + 0xbde) == '\0')) { + uVar8 = local_c; + local_6 = SELECTOBJECT(0x1228,*(undefined2 *)(iVar3 + 0x54)); + uVar7 = param_4; + BITBLT(0x1228,0xc6,0x88,0,0,local_c,*(int *)(iVar3 + 0xba6) + 0x13, + *(int *)(iVar3 + 0xba2) + 0x13,*(undefined2 *)(iVar3 + 0xba6), + *(undefined2 *)(iVar3 + 0xba2)); + uVar6 = local_c; + SELECTOBJECT(0x1228,*(undefined2 *)(iVar3 + 0x52)); + uVar5 = param_4; + BITBLT(0x1228,0x86,0xee,0,0,local_c,*(int *)(iVar3 + 0xba6) + 0x13, + *(int *)(iVar3 + 0xba2) + 0x13,*(undefined2 *)(iVar3 + 0xba6), + *(undefined2 *)(iVar3 + 0xba2)); + uVar4 = local_c; + SELECTOBJECT(0x1228,local_6); + } + DELETEDC(0x1228,local_c,uVar4,uVar5,uVar6,uVar7,uVar8,uVar9); + *(undefined2 *)(iVar3 + 0x4d) = 0; + *(undefined2 *)(iVar3 + 0x4f) = 0; + *(undefined1 *)(iVar3 + 0xbd9) = 0; + SELECTPALETTE(0x1228,0,uVar1); + uVar4 = 0; + uVar1 = LOADCURSOR(0x1228,0x7f00,0); + SETCURSOR(0x1228,uVar1,uVar4,param_4); + uVar1 = *(undefined2 *)(iVar3 + 4); + GETCLIENTRECT(0x1228,local_16,unaff_SS); + local_e = GETDC(0x1228,*(undefined2 *)(iVar3 + 4),uVar1); + uVar2 = *(undefined2 *)((uint)DAT_1028_07d1 * 4 + 0x990); + uVar1 = FUN_1020_08a9(); + FUN_1008_0996(local_e,uVar1,uVar2); + local_20 = 1; + while( true ) { + iVar3 = *(int *)(local_20 * 4 + 0x980); + if ((0 < iVar3) || ((-1 < iVar3 && (*(int *)(local_20 * 4 + 0x97e) != 0)))) { + FUN_1008_0996(local_e,local_20,local_20 >> 0xf); + } + if (local_20 == 4) break; + local_20 = local_20 + 1; + } + DAT_1028_086b = 99; + FUN_1008_0b9e(DAT_1028_07d1,local_e); + RELEASEDC(0x1008,local_e); + DAT_1028_07cb = 1; + } + return; +} + + +/* ===== 1000:58e7 FUN_1000_58e7 ===== */ + +undefined2 __stdcall16far FUN_1000_58e7(undefined4 param_1,undefined4 param_2) + +{ + int iVar1; + int iVar2; + undefined2 uVar3; + undefined2 uVar4; + undefined2 local_4; + + uVar3 = (undefined2)((ulong)param_2 >> 0x10); + iVar2 = (int)param_2; + if (*(int *)(iVar2 + 4) == 0) { + DAT_1028_07c4 = '\0'; + local_4 = 0; + } + else if (DAT_1028_07c4 == '\0') { + uVar4 = (undefined2)((ulong)param_1 >> 0x10); + iVar1 = ISICONIC(); + if (iVar1 == 0) { + DAT_1028_07c4 = '\x01'; + INVALIDATERECT(0x1228,0,0,0,*(undefined2 *)((int)param_1 + 4)); + UPDATEWINDOW(0x1228,*(undefined2 *)((int)param_1 + 4)); + *(undefined2 *)(iVar2 + 10) = 0; + *(undefined2 *)(iVar2 + 0xc) = 0; + local_4 = 0; + } + } + return local_4; +} + + +/* ===== 1000:5956 FUN_1000_5956 ===== */ + +void __stdcall16far FUN_1000_5956(undefined4 param_1,undefined4 param_2) + +{ + int iVar1; + undefined2 uVar2; + undefined2 uVar3; + undefined2 unaff_CS; + + uVar2 = (undefined2)((ulong)param_2 >> 0x10); + iVar1 = (int)param_2; + if ((*(int *)(iVar1 + 4) == 0) && (DAT_1028_07c4 == '\0')) { + DAT_1028_07c4 = '\x01'; + uVar3 = (undefined2)((ulong)param_1 >> 0x10); + INVALIDATERECT(unaff_CS,0,0,0,*(undefined2 *)((int)param_1 + 4)); + UPDATEWINDOW(0x1228,*(undefined2 *)((int)param_1 + 4)); + *(undefined2 *)(iVar1 + 10) = 0; + *(undefined2 *)(iVar1 + 0xc) = 0; + } + return; +} + + +/* ===== 1000:59a0 FUN_1000_59a0 ===== */ + +undefined2 __stdcall16far FUN_1000_59a0(undefined4 param_1,undefined4 param_2) + +{ + int iVar1; + undefined2 uVar2; + undefined2 uVar3; + int iVar4; + int iVar5; + undefined2 uVar6; + undefined2 uVar7; + undefined2 uVar8; + undefined2 uVar9; + undefined2 local_4; + + local_4 = 1; + uVar6 = (undefined2)((ulong)param_2 >> 0x10); + iVar4 = (int)param_2; + uVar7 = (undefined2)((ulong)param_1 >> 0x10); + iVar5 = (int)param_1; + if (*(int *)(iVar4 + 4) != *(int *)(iVar5 + 4)) { + uVar9 = *(undefined2 *)(iVar4 + 4); + iVar1 = GETPARENT(); + if (iVar1 != *(int *)(iVar5 + 4)) { + uVar7 = *(undefined2 *)(iVar5 + 4); + uVar2 = GETDC(0x1228,uVar7,uVar9); + uVar8 = uVar2; + uVar3 = SELECTPALETTE(0x1228,1,DAT_1028_444e); + REALIZEPALETTE(0x1228,uVar2,uVar8,uVar7,uVar9,uVar3); + UPDATECOLORS(0x1228,uVar2); + SELECTPALETTE(0x1228,0,uVar3); + RELEASEDC(0x1228,uVar2); + *(undefined2 *)(iVar4 + 10) = 0; + *(undefined2 *)(iVar4 + 0xc) = 0; + local_4 = 0; + } + } + return local_4; +} + + +/* ===== 1000:5a37 FUN_1000_5a37 ===== */ + +int __stdcall16far FUN_1000_5a37(undefined4 param_1,undefined4 param_2) + +{ + undefined2 uVar1; + undefined2 uVar2; + int iVar3; + undefined2 uVar4; + undefined2 uVar5; + undefined2 uVar6; + + uVar4 = (undefined2)((ulong)param_1 >> 0x10); + uVar5 = *(undefined2 *)((int)param_1 + 4); + uVar1 = GETDC(); + uVar6 = uVar1; + uVar2 = SELECTPALETTE(0x1228,0,DAT_1028_444e); + iVar3 = REALIZEPALETTE(0x1228,uVar1,uVar6,uVar5); + SELECTPALETTE(0x1228,0,uVar2); + RELEASEDC(0x1228,uVar1); + if (0 < iVar3) { + INVALIDATERECT(0x1228,0,0,0,*(undefined2 *)((int)param_1 + 4)); + } + uVar5 = (undefined2)((ulong)param_2 >> 0x10); + *(int *)((int)param_2 + 10) = iVar3; + *(undefined2 *)((int)param_2 + 0xc) = 0; + return iVar3; +} + + +/* ===== 1000:5ab7 FUN_1000_5ab7 ===== */ + +void __stdcall16far FUN_1000_5ab7(undefined4 param_1,uint *param_2) + +{ + uint uVar1; + undefined2 uVar2; + + uVar2 = (undefined2)((ulong)param_2 >> 0x10); + FUN_1018_1274((int)param_1,(int)((ulong)param_1 >> 0x10),(uint *)param_2,uVar2); + uVar1 = GETSTOCKOBJECT(0x1018,5); + ((uint *)param_2)[8] = uVar1; + *param_2 = *param_2 | 0x3800; + return; +} + + +/* ===== 1000:5aea FUN_1000_5aea ===== */ + +undefined4 __stdcall16far +FUN_1000_5aea(undefined4 param_1,undefined2 param_2,undefined2 param_3,undefined2 param_4, + undefined2 param_5,undefined2 param_6) + +{ + uint uVar1; + int iVar2; + undefined2 uVar3; + bool bVar4; + + bVar4 = true; + FUN_1020_03ef(); + if (!bVar4) { + uVar3 = (undefined2)((ulong)param_1 >> 0x10); + iVar2 = (int)param_1; + FUN_1018_1106(iVar2,uVar3,0,param_3,param_4,param_5,param_6); + *(undefined2 *)(iVar2 + 0x41) = param_5; + *(undefined2 *)(iVar2 + 0x43) = param_6; + *(undefined2 *)(iVar2 + 0x2d) = 0x168; + *(undefined2 *)(iVar2 + 0x2f) = 300; + *(int *)(iVar2 + 0x29) = 0x140 - *(int *)(iVar2 + 0x2d) / 2; + *(int *)(iVar2 + 0x2b) = 0xe6 - *(int *)(iVar2 + 0x2f) / 2; + uVar1 = *(uint *)(iVar2 + 0x23); + *(uint *)(iVar2 + 0x21) = *(uint *)(iVar2 + 0x21) | 2; + *(uint *)(iVar2 + 0x23) = uVar1 | 0x4680; + SETFOCUS(0x1018,*(undefined2 *)(iVar2 + 4)); + } + return param_1; +} + + +/* ===== 1000:5ba6 FUN_1000_5ba6 ===== */ + +void __stdcall16far FUN_1000_5ba6(undefined4 param_1) + +{ + int iVar1; + int iVar2; + undefined2 uVar3; + undefined2 uVar4; + undefined2 uVar5; + + uVar5 = DAT_1028_0867; + DELETEOBJECT(); + uVar3 = (undefined2)((ulong)param_1 >> 0x10); + iVar1 = (int)param_1; + uVar4 = (undefined2)((ulong)*(undefined4 *)(iVar1 + 0x41) >> 0x10); + iVar2 = (int)*(undefined4 *)(iVar1 + 0x41); + *(undefined2 *)(iVar2 + 0x41) = 0; + *(undefined2 *)(iVar2 + 0x43) = 0; + *(undefined2 *)(iVar1 + 0x41) = 0; + *(undefined2 *)(iVar1 + 0x43) = 0; + FUN_1018_121b(iVar1,uVar3,0); + FUN_1020_0439(uVar5); + return; +} + + +/* ===== 1000:5be5 FUN_1000_5be5 ===== */ + +void __stdcall16far FUN_1000_5be5(undefined4 param_1) + +{ + undefined2 uVar1; + + uVar1 = (undefined2)((ulong)param_1 >> 0x10); + FUN_1018_170c((int)param_1,uVar1); + DAT_1028_0867 = FUN_1008_149d(0x3e1,0,DAT_1028_06fe); + SETFOCUS(0x1008,*(undefined2 *)((int)param_1 + 4)); + return; +} + + +/* ===== 1000:5c13 FUN_1000_5c13 ===== */ + +void __stdcall16far FUN_1000_5c13(void) + +{ + undefined2 uVar1; + undefined2 uVar2; + undefined2 unaff_CS; + undefined2 unaff_SS; + undefined2 in_stack_0000000c; + undefined1 *puVar3; + int iVar4; + undefined1 *puVar5; + undefined2 uVar6; + undefined2 uVar7; + undefined1 local_26c [256]; + undefined2 local_16c; + undefined2 local_16a; + undefined2 local_168; + undefined2 local_166; + undefined2 local_164; + undefined2 local_162; + int local_160; + int local_15e; + undefined1 local_15c [256]; + undefined1 local_5c [41]; + undefined1 local_33 [41]; + undefined2 local_a; + undefined4 local_8; + undefined2 local_4; + + uVar1 = in_stack_0000000c; + local_4 = SELECTPALETTE(unaff_CS,0,DAT_1028_444e); + UNREALIZEOBJECT(0x1228,DAT_1028_444e,uVar1); + REALIZEPALETTE(0x1228,in_stack_0000000c); + uVar1 = CREATECOMPATIBLEDC(0x1228,in_stack_0000000c); + local_16a = uVar1; + local_164 = SELECTOBJECT(0x1228,DAT_1028_0867); + local_16c = CREATECOMPATIBLEDC(0x1228,in_stack_0000000c,uVar1); + local_168 = CREATECOMPATIBLEBITMAP(0x1228,300,0x168); + uVar1 = local_16c; + local_166 = SELECTOBJECT(0x1228,local_168); + local_8 = GETTEXTCOLOR(0x1228,local_16c,uVar1,in_stack_0000000c); + local_a = SETTEXTALIGN(0x1228,6); + local_162 = SETBKMODE(0x1228,1); + BITBLT(0x1228,0x20,0xcc,0,0,local_16a,300,0x168,0,0); + SETTEXTCOLOR(0x1228,0,0); + FUN_1008_2ee5(0x2f4,0x1028,local_33,unaff_SS); + uVar7 = 0xb4; + uVar6 = 0x1b; + puVar3 = local_33; + uVar1 = unaff_SS; + uVar2 = FUN_1008_2e92(local_33,unaff_SS); + TEXTOUT(0x1008,uVar2,puVar3,uVar1,uVar6,uVar7); + local_15e = 1; + while( true ) { + local_160 = local_15e * 0x14 + 0x28; + SETTEXTALIGN(0x1228,0); + if (local_15e < 10) { + FUN_1008_2ee5(0x300,0x1028,local_33,unaff_SS); + } + else { + FUN_1008_2ee5(0x2ff,0x1028,local_33,unaff_SS); + } + FUN_1020_1629(0xff,local_15c,unaff_SS,0,local_15e,local_15e >> 0xf); + FUN_1008_2f2f(local_15c,unaff_SS,local_5c,unaff_SS); + FUN_1008_2f4d(local_5c,unaff_SS,local_33,unaff_SS); + FUN_1008_2f4d(0x303,0x1028,local_33,unaff_SS); + puVar3 = local_5c; + puVar5 = local_26c; + uVar1 = unaff_SS; + uVar2 = unaff_SS; + FUN_1020_0b00(0x16,local_15e * 0x16 + 0x890,0x1028); + FUN_1008_2f2f(puVar5,uVar1,puVar3,uVar2); + FUN_1008_2f4d(local_5c,unaff_SS,local_33,unaff_SS); + uVar6 = 0x1e; + puVar3 = local_33; + uVar1 = unaff_SS; + iVar4 = local_160; + uVar2 = FUN_1008_2e92(local_33,unaff_SS); + TEXTOUT(0x1008,uVar2,puVar3,uVar1,iVar4,uVar6); + SETTEXTALIGN(0x1228,2); + FUN_1020_1629(0xff,local_15c,unaff_SS,0,*(undefined2 *)(local_15e * 4 + 0x87a), + *(undefined2 *)(local_15e * 4 + 0x87c)); + FUN_1008_2f2f(local_15c,unaff_SS,local_33,unaff_SS); + uVar6 = 0x140; + puVar3 = local_33; + uVar1 = unaff_SS; + iVar4 = local_160; + uVar2 = FUN_1008_2e92(local_33,unaff_SS); + TEXTOUT(0x1008,uVar2,puVar3,uVar1,iVar4,uVar6); + if (local_15e == 10) break; + local_15e = local_15e + 1; + } + BITBLT(0x1228,0x20,0xcc,0,0,local_16c,300,0x168,0,0); + uVar7 = local_16c; + SETTEXTCOLOR(0x1228,local_8); + uVar6 = local_16c; + SETTEXTALIGN(0x1228,local_a); + uVar2 = local_16c; + SETBKMODE(0x1228,local_162); + uVar1 = local_16c; + SELECTOBJECT(0x1228,local_166); + DELETEOBJECT(0x1228,local_168,uVar1,uVar2,uVar6,uVar7); + DELETEDC(0x1228,local_16c); + uVar1 = local_16a; + SELECTOBJECT(0x1228,local_164); + DELETEDC(0x1228,local_16a,uVar1); + SELECTPALETTE(0x1228,0,local_4); + return; +} + + +/* ===== 1000:5ee6 FUN_1000_5ee6 ===== */ + +void __stdcall16far FUN_1000_5ee6(undefined4 param_1) + +{ + FUN_1008_00e2(); + FUN_1018_0f38((int)param_1,(int)((ulong)param_1 >> 0x10)); + return; +} + + +/* ===== 1000:5efc FUN_1000_5efc ===== */ + +undefined2 __stdcall16far FUN_1000_5efc(undefined4 param_1,undefined4 param_2) + +{ + undefined2 local_4; + + if ((*(uint *)((int)param_2 + 8) & 0xff) != 0x1c) { + FUN_1008_00e2(); + FUN_1018_0f38((int)param_1,(int)((ulong)param_1 >> 0x10)); + } + return local_4; +} + + +/* ===== 1000:5f29 FUN_1000_5f29 ===== */ + +undefined2 __stdcall16far FUN_1000_5f29(undefined4 param_1,undefined4 param_2) + +{ + int iVar1; + undefined2 uVar2; + undefined2 uVar3; + int iVar4; + int iVar5; + undefined2 uVar6; + undefined2 uVar7; + undefined2 uVar8; + undefined2 uVar9; + undefined2 local_4; + + local_4 = 1; + uVar6 = (undefined2)((ulong)param_2 >> 0x10); + iVar4 = (int)param_2; + uVar7 = (undefined2)((ulong)param_1 >> 0x10); + iVar5 = (int)param_1; + if (*(int *)(iVar4 + 4) != *(int *)(iVar5 + 4)) { + uVar9 = *(undefined2 *)(iVar4 + 4); + iVar1 = GETPARENT(); + if (iVar1 != *(int *)(iVar5 + 4)) { + uVar7 = *(undefined2 *)(iVar5 + 4); + uVar2 = GETDC(0x1228,uVar7,uVar9); + uVar8 = uVar2; + uVar3 = SELECTPALETTE(0x1228,1,DAT_1028_444e); + REALIZEPALETTE(0x1228,uVar2,uVar8,uVar7,uVar9,uVar3); + UPDATECOLORS(0x1228,uVar2); + SELECTPALETTE(0x1228,0,uVar3); + RELEASEDC(0x1228,uVar2); + *(undefined2 *)(iVar4 + 10) = 0; + *(undefined2 *)(iVar4 + 0xc) = 0; + local_4 = 0; + } + } + return local_4; +} + + +/* ===== 1000:5fc0 FUN_1000_5fc0 ===== */ + +int __stdcall16far FUN_1000_5fc0(undefined4 param_1,undefined4 param_2) + +{ + undefined2 uVar1; + undefined2 uVar2; + int iVar3; + undefined2 uVar4; + undefined2 uVar5; + undefined2 uVar6; + + uVar4 = (undefined2)((ulong)param_1 >> 0x10); + uVar5 = *(undefined2 *)((int)param_1 + 4); + uVar1 = GETDC(); + uVar6 = uVar1; + uVar2 = SELECTPALETTE(0x1228,0,DAT_1028_444e); + iVar3 = REALIZEPALETTE(0x1228,uVar1,uVar6,uVar5); + SELECTPALETTE(0x1228,0,uVar2); + RELEASEDC(0x1228,uVar1); + if (0 < iVar3) { + INVALIDATERECT(0x1228,0,0,0,*(undefined2 *)((int)param_1 + 4)); + } + uVar5 = (undefined2)((ulong)param_2 >> 0x10); + *(int *)((int)param_2 + 10) = iVar3; + *(undefined2 *)((int)param_2 + 0xc) = 0; + return iVar3; +} + + +/* ===== 1000:6040 FUN_1000_6040 ===== */ + +void __stdcall16far FUN_1000_6040(undefined4 param_1,uint *param_2) + +{ + uint uVar1; + undefined2 uVar2; + + uVar2 = (undefined2)((ulong)param_2 >> 0x10); + FUN_1018_1274((int)param_1,(int)((ulong)param_1 >> 0x10),(uint *)param_2,uVar2); + uVar1 = GETSTOCKOBJECT(0x1018,5); + ((uint *)param_2)[8] = uVar1; + *param_2 = *param_2 | 0x3800; + return; +} + + +/* ===== 1000:6073 FUN_1000_6073 ===== */ + +undefined4 __stdcall16far +FUN_1000_6073(undefined4 param_1,undefined2 param_2,undefined2 param_3,undefined2 param_4, + undefined2 param_5,undefined2 param_6) + +{ + int iVar1; + undefined2 uVar2; + bool bVar3; + + bVar3 = true; + FUN_1020_03ef(); + if (!bVar3) { + uVar2 = (undefined2)((ulong)param_1 >> 0x10); + iVar1 = (int)param_1; + FUN_1018_1106(iVar1,uVar2,0,param_3,param_4,param_5,param_6); + *(undefined2 *)(iVar1 + 0x41) = param_5; + *(undefined2 *)(iVar1 + 0x43) = param_6; + *(undefined2 *)(iVar1 + 0x2d) = 0x280; + *(undefined2 *)(iVar1 + 0x2f) = 0x1cc; + *(undefined2 *)(iVar1 + 0x29) = 0; + *(undefined2 *)(iVar1 + 0x2b) = 0; + *(undefined2 *)(iVar1 + 0x21) = 2; + *(undefined2 *)(iVar1 + 0x23) = 0x4600; + SETFOCUS(0x1018,*(undefined2 *)(iVar1 + 4)); + } + return param_1; +} + + +/* ===== 1000:60e7 FUN_1000_60e7 ===== */ + +void __stdcall16far FUN_1000_60e7(undefined4 param_1) + +{ + int iVar1; + int iVar2; + undefined2 uVar3; + undefined2 uVar4; + + uVar3 = (undefined2)((ulong)param_1 >> 0x10); + iVar1 = (int)param_1; + uVar4 = (undefined2)((ulong)*(undefined4 *)(iVar1 + 0x41) >> 0x10); + iVar2 = (int)*(undefined4 *)(iVar1 + 0x41); + *(undefined2 *)(iVar2 + 0x45) = 0; + *(undefined2 *)(iVar2 + 0x47) = 0; + *(undefined2 *)(iVar1 + 0x41) = 0; + *(undefined2 *)(iVar1 + 0x43) = 0; + uVar4 = DAT_1028_0867; + DELETEOBJECT(); + FUN_1018_121b(iVar1,uVar3,0); + FUN_1020_0439(uVar4); + return; +} + + +/* ===== 1000:6129 FUN_1000_6129 ===== */ + +void __stdcall16far FUN_1000_6129(undefined4 param_1) + +{ + undefined2 uVar1; + undefined2 uVar2; + undefined2 uVar3; + + uVar2 = (undefined2)((ulong)param_1 >> 0x10); + FUN_1018_170c((int)param_1,uVar2); + uVar3 = 0; + uVar1 = LOADCURSOR(0x1018,0x7f02,0); + SETCURSOR(0x1228,uVar1,uVar3); + DAT_1028_0867 = FUN_1008_149d(DAT_1028_07cd + 1000,0,DAT_1028_06fe); + SETFOCUS(0x1008,*(undefined2 *)((int)param_1 + 4)); + return; +} + + +/* ===== 1000:616e FUN_1000_616e ===== */ + +void __stdcall16far FUN_1000_616e(void) + +{ + undefined2 uVar1; + undefined2 uVar2; + undefined2 uVar3; + undefined2 uVar4; + undefined2 unaff_CS; + undefined2 in_stack_0000000c; + undefined2 uVar5; + undefined2 uVar6; + + uVar4 = in_stack_0000000c; + uVar1 = SELECTPALETTE(unaff_CS,0,DAT_1028_444e); + UNREALIZEOBJECT(0x1228,DAT_1028_444e,uVar4); + REALIZEPALETTE(0x1228,in_stack_0000000c); + uVar2 = CREATECOMPATIBLEDC(0x1228,in_stack_0000000c); + uVar6 = uVar2; + uVar3 = SELECTOBJECT(0x1228,DAT_1028_0867); + uVar5 = in_stack_0000000c; + BITBLT(0x1228,0x20,0xcc,0,0,uVar2,0x1cc,0x280,0,0); + uVar4 = uVar2; + SELECTOBJECT(0x1228,uVar3); + DELETEDC(0x1228,uVar2,uVar4,uVar5,uVar6); + SELECTPALETTE(0x1228,0,uVar1); + uVar5 = 0; + uVar4 = LOADCURSOR(0x1228,0x7f00,0); + SETCURSOR(0x1228,uVar4,uVar5,in_stack_0000000c); + return; +} + + +/* ===== 1000:6202 FUN_1000_6202 ===== */ + +void __stdcall16far FUN_1000_6202(undefined4 param_1) + +{ + FUN_1008_00e2(); + FUN_1018_0f38((int)param_1,(int)((ulong)param_1 >> 0x10)); + return; +} + + +/* ===== 1000:6218 FUN_1000_6218 ===== */ + +undefined2 __stdcall16far FUN_1000_6218(undefined4 param_1,undefined4 param_2) + +{ + undefined2 local_4; + + if ((*(uint *)((int)param_2 + 8) & 0xff) != 0x3b) { + FUN_1008_00e2(); + FUN_1018_0f38((int)param_1,(int)((ulong)param_1 >> 0x10)); + } + return local_4; +} + + +/* ===== 1000:6245 FUN_1000_6245 ===== */ + +undefined2 __stdcall16far FUN_1000_6245(undefined4 param_1,undefined4 param_2) + +{ + int iVar1; + undefined2 uVar2; + undefined2 uVar3; + int iVar4; + int iVar5; + undefined2 uVar6; + undefined2 uVar7; + undefined2 uVar8; + undefined2 uVar9; + undefined2 local_4; + + local_4 = 1; + uVar6 = (undefined2)((ulong)param_2 >> 0x10); + iVar4 = (int)param_2; + uVar7 = (undefined2)((ulong)param_1 >> 0x10); + iVar5 = (int)param_1; + if (*(int *)(iVar4 + 4) != *(int *)(iVar5 + 4)) { + uVar9 = *(undefined2 *)(iVar4 + 4); + iVar1 = GETPARENT(); + if (iVar1 != *(int *)(iVar5 + 4)) { + uVar7 = *(undefined2 *)(iVar5 + 4); + uVar2 = GETDC(0x1228,uVar7,uVar9); + uVar8 = uVar2; + uVar3 = SELECTPALETTE(0x1228,1,DAT_1028_444e); + REALIZEPALETTE(0x1228,uVar2,uVar8,uVar7,uVar9,uVar3); + UPDATECOLORS(0x1228,uVar2); + SELECTPALETTE(0x1228,0,uVar3); + RELEASEDC(0x1228,uVar2); + *(undefined2 *)(iVar4 + 10) = 0; + *(undefined2 *)(iVar4 + 0xc) = 0; + local_4 = 0; + } + } + return local_4; +} + + +/* ===== 1000:62dc FUN_1000_62dc ===== */ + +int __stdcall16far FUN_1000_62dc(undefined4 param_1,undefined4 param_2) + +{ + undefined2 uVar1; + undefined2 uVar2; + int iVar3; + undefined2 uVar4; + undefined2 uVar5; + undefined2 uVar6; + + uVar4 = (undefined2)((ulong)param_1 >> 0x10); + uVar5 = *(undefined2 *)((int)param_1 + 4); + uVar1 = GETDC(); + uVar6 = uVar1; + uVar2 = SELECTPALETTE(0x1228,0,DAT_1028_444e); + iVar3 = REALIZEPALETTE(0x1228,uVar1,uVar6,uVar5); + SELECTPALETTE(0x1228,0,uVar2); + RELEASEDC(0x1228,uVar1); + if (0 < iVar3) { + INVALIDATERECT(0x1228,0,0,0,*(undefined2 *)((int)param_1 + 4)); + } + uVar5 = (undefined2)((ulong)param_2 >> 0x10); + *(int *)((int)param_2 + 10) = iVar3; + *(undefined2 *)((int)param_2 + 0xc) = 0; + return iVar3; +} + + +/* ===== 1000:635c FUN_1000_635c ===== */ + +void __stdcall16far +FUN_1000_635c(undefined2 param_1,undefined2 param_2,undefined2 param_3,undefined2 param_4, + undefined2 param_5,undefined2 param_6) + +{ + FUN_1008_07b6(param_1,param_2,param_3,param_4,param_5,param_6); + FUN_1008_093f(param_2,param_3,param_4,param_5,param_6); + return; +} + + +/* ===== 1000:638e FUN_1000_638e ===== */ + +undefined2 __stdcall16far FUN_1000_638e(undefined4 param_1,undefined4 param_2) + +{ + uint uVar1; + uint uVar2; + uint uVar3; + int iVar4; + int iVar5; + undefined2 in_BX; + int iVar6; + int iVar7; + undefined2 uVar8; + undefined2 uVar9; + undefined2 uVar10; + bool bVar11; + undefined2 uVar12; + byte local_a; + byte local_9; + + uVar8 = (undefined2)((ulong)param_1 >> 0x10); + iVar6 = (int)param_1; + iVar7 = (int)param_2; + uVar9 = (undefined2)((ulong)param_2 >> 0x10); + if ((*(int *)(iVar6 + 0x41) == 0 && *(int *)(iVar6 + 0x43) == 0) && + (*(int *)(iVar6 + 0x45) == 0 && *(int *)(iVar6 + 0x47) == 0)) { + uVar1 = *(uint *)(iVar7 + 8) & 0xff; + if ((DAT_1028_07cf != '\0') && (uVar1 == 0x3c)) { + DAT_1028_0855 = 0; + DAT_1028_0857 = 0; + DAT_1028_07c7 = 1; + } + if ((DAT_1028_07cf != '\0') && (uVar1 == 0x41)) { + DAT_1028_07d3 = DAT_1028_3340; + DAT_1028_07d5 = DAT_1028_3342; + DAT_1028_07d7 = DAT_1028_3344; + DAT_1028_07d9 = DAT_1028_3346; + *(undefined2 *)(iVar6 + 0xbaa) = 0; + *(undefined2 *)(iVar6 + 0xbac) = 0; + *(undefined2 *)(iVar6 + 0xbae) = 0; + *(undefined2 *)(iVar6 + 0xbb0) = 0; + } + if ((((*(char *)(iVar6 + 0xbdd) == '\0') && (*(char *)(iVar6 + 0xbdf) == '\0')) && + (uVar1 == 0x50)) && (DAT_1028_07d0 != 0)) { + iVar4 = *(int *)(iVar6 + 0x5c); + FUN_1020_08a9(); + FUN_1020_100b(); + uVar3 = FUN_1020_1017(); + uVar1 = *(uint *)(iVar6 + 0xbae); + iVar5 = *(int *)(iVar6 + 0xbb0); + *(int *)(iVar6 + 0xbae) = uVar1 - uVar3; + *(int *)(iVar6 + 0xbb0) = (iVar5 - iVar4) - (uint)(uVar1 < uVar3); + iVar4 = *(int *)(iVar6 + 0x56); + iVar5 = (~*(uint *)(iVar6 + 0x58) + 1) - (uint)(iVar4 != 0); + if ((*(int *)(iVar6 + 0xbb0) < iVar5) || + ((*(int *)(iVar6 + 0xbb0) <= iVar5 && + (*(uint *)(iVar6 + 0xbae) <= (uint)-iVar4 && -*(uint *)(iVar6 + 0xbae) != iVar4)))) { + uVar3 = FUN_1020_14a4(*(undefined2 *)(iVar6 + 0x56)); + iVar4 = *(int *)(iVar6 + 0x56); + uVar1 = *(uint *)(iVar6 + 0x58); + uVar2 = -iVar4; + *(int *)(iVar6 + 0xbae) = uVar2 + uVar3 / 0x28; + *(int *)(iVar6 + 0xbb0) = + ((~uVar1 + 1) - (uint)(iVar4 != 0)) + (uint)CARRY2(uVar2,uVar3 / 0x28); + } + else { + uVar1 = *(uint *)(iVar6 + 0x58); + FUN_1020_100b(); + FUN_1020_0ff7(); + iVar4 = FUN_1020_1017(); + iVar5 = (~uVar1 + 1) - (uint)(iVar4 != 0); + if ((iVar5 < *(int *)(iVar6 + 0xbb0)) || + ((iVar5 <= *(int *)(iVar6 + 0xbb0) && + ((uint)-iVar4 < *(uint *)(iVar6 + 0xbae) || -*(uint *)(iVar6 + 0xbae) == iVar4)))) { + uVar3 = FUN_1020_14a4(*(undefined2 *)(iVar6 + 0x56)); + uVar1 = *(uint *)(iVar6 + 0xbae); + iVar4 = *(int *)(iVar6 + 0xbb0); + *(int *)(iVar6 + 0xbae) = uVar1 - uVar3 / 0x28; + *(int *)(iVar6 + 0xbb0) = iVar4 - (uint)(uVar1 < uVar3 / 0x28); + } + } + DAT_1028_07fb = *(uint *)(iVar6 + 0xbae); + DAT_1028_07fd = *(int *)(iVar6 + 0xbb0); + *(undefined1 *)(iVar6 + 0xbdd) = 1; + *(undefined1 *)(iVar6 + 0xbde) = 0; + FUN_1008_0002(2); + uVar8 = GETDC(0x1008,*(undefined2 *)(iVar6 + 4)); + FUN_1000_635c(DAT_1028_0865,0x12,0x15,0x1aa,0x13a,uVar8); + RELEASEDC(0x1000,uVar8); + } + else if (uVar1 == 0x1d) { + *(undefined1 *)(iVar6 + 0xbda) = 0; + } + else if (uVar1 == 0x1c) { + *(undefined1 *)(iVar6 + 0xbdb) = 0; + } + else if ((DAT_1028_07c6 == '\0') && (((uVar1 == 0x2a || (uVar1 == 0x51)) || (uVar1 == 0x39)))) { + FUN_1008_0002(0x13); + if (uVar1 == 0x2a) { + FUN_1020_14a4(0x14); + iVar5 = 0; + uVar2 = FUN_1020_08a9(); + uVar3 = *(uint *)(iVar6 + 0xbaa); + iVar4 = *(int *)(iVar6 + 0xbac); + *(int *)(iVar6 + 0xbaa) = uVar3 - uVar2; + *(int *)(iVar6 + 0xbac) = (iVar4 - iVar5) - (uint)(uVar3 < uVar2); + } + else if (uVar1 == 0x51) { + FUN_1020_14a4(0x14); + iVar5 = 0; + uVar2 = FUN_1020_08a9(); + uVar3 = *(uint *)(iVar6 + 0xbaa); + iVar4 = *(int *)(iVar6 + 0xbac); + *(int *)(iVar6 + 0xbaa) = uVar2 + *(uint *)(iVar6 + 0xbaa); + *(int *)(iVar6 + 0xbac) = iVar5 + iVar4 + (uint)CARRY2(uVar2,uVar3); + } + else if (uVar1 == 0x39) { + iVar4 = *(int *)(iVar6 + 0x5c); + uVar10 = FUN_1020_100b(); + FUN_1020_14c1(uVar10,in_BX,iVar4); + FUN_1020_0ff7(); + FUN_1020_0feb(); + FUN_1020_0ff7(); + uVar2 = FUN_1020_1017(); + uVar3 = *(uint *)(iVar6 + 0xbaa); + iVar5 = *(int *)(iVar6 + 0xbac); + *(int *)(iVar6 + 0xbaa) = uVar2 + *(uint *)(iVar6 + 0xbaa); + *(int *)(iVar6 + 0xbac) = iVar4 + iVar5 + (uint)CARRY2(uVar2,uVar3); + FUN_1020_14a4(0x14); + iVar5 = 0; + uVar2 = FUN_1020_08a9(); + uVar3 = *(uint *)(iVar6 + 0xbae); + iVar4 = *(int *)(iVar6 + 0xbb0); + *(int *)(iVar6 + 0xbae) = uVar3 - uVar2; + *(int *)(iVar6 + 0xbb0) = (iVar4 - iVar5) - (uint)(uVar3 < uVar2); + } + if (1 < *(byte *)(iVar6 + 0x61)) { + if (uVar1 == 0x2a) { + iVar4 = *(int *)(iVar6 + 0x5c); + uVar1 = FUN_1020_08a9(); + bVar11 = DAT_1028_07f3 < uVar1; + DAT_1028_07f3 = DAT_1028_07f3 - uVar1; + DAT_1028_07f5 = (DAT_1028_07f5 - iVar4) - (uint)bVar11; + iVar4 = *(int *)(iVar6 + 0x5c); + uVar1 = FUN_1020_08a9(); + bVar11 = DAT_1028_07f7 < uVar1; + DAT_1028_07f7 = DAT_1028_07f7 - uVar1; + DAT_1028_07f9 = (DAT_1028_07f9 - iVar4) - (uint)bVar11; + } + else if (uVar1 == 0x51) { + iVar4 = *(int *)(iVar6 + 0x5c); + uVar1 = FUN_1020_08a9(); + bVar11 = CARRY2(uVar1,DAT_1028_07f3); + DAT_1028_07f3 = uVar1 + DAT_1028_07f3; + DAT_1028_07f5 = iVar4 + DAT_1028_07f5 + (uint)bVar11; + iVar4 = *(int *)(iVar6 + 0x5c); + uVar1 = FUN_1020_08a9(); + bVar11 = CARRY2(uVar1,DAT_1028_07f7); + DAT_1028_07f7 = uVar1 + DAT_1028_07f7; + DAT_1028_07f9 = iVar4 + DAT_1028_07f9 + (uint)bVar11; + } + else if (uVar1 == 0x39) { + FUN_1020_14a4(0x15); + uVar1 = FUN_1020_08a9(); + FUN_1020_14a4(100); + FUN_1020_08a9(); + uVar3 = FUN_1020_08a9(); + bVar11 = CARRY2(uVar1,DAT_1028_07f3); + DAT_1028_07f3 = uVar1 + DAT_1028_07f3; + DAT_1028_07f5 = ((int)uVar1 >> 0xf) + DAT_1028_07f5 + (uint)bVar11; + bVar11 = CARRY2(uVar1,DAT_1028_07f7); + DAT_1028_07f7 = uVar1 + DAT_1028_07f7; + DAT_1028_07f9 = ((int)uVar1 >> 0xf) + DAT_1028_07f9 + (uint)bVar11; + bVar11 = CARRY2(uVar3,DAT_1028_07fb); + DAT_1028_07fb = uVar3 + DAT_1028_07fb; + DAT_1028_07fd = ((int)uVar3 >> 0xf) + DAT_1028_07fd + (uint)bVar11; + bVar11 = CARRY2(uVar3,DAT_1028_07ff); + DAT_1028_07ff = uVar3 + DAT_1028_07ff; + DAT_1028_0801 = ((int)uVar3 >> 0xf) + DAT_1028_0801 + (uint)bVar11; + } + } + *(int *)(iVar6 + 0x5e) = *(int *)(iVar6 + 0x5e) + 0x19; + iVar4 = FUN_1020_14a4(10); + if (iVar4 + 0x1eU < *(uint *)(iVar6 + 0x5e)) { + FUN_1008_0002(0x14); + DAT_1028_07c6 = '\x01'; + *(undefined1 *)(iVar6 + 0xbda) = 0; + *(undefined1 *)(iVar6 + 0xbdb) = 0; + uVar8 = GETDC(0x1008,*(undefined2 *)(iVar6 + 4)); + FUN_1008_0837(0x14,0x94,0xf3,0x54,uVar8); + FUN_1008_093f(0x14,0x94,0xf3,0x54,uVar8); + RELEASEDC(0x1008,uVar8); + } + } + else if (uVar1 == 0x58) { + if (DAT_1028_43f2 == '\0') { + if (DAT_1028_43ee != 0) { + DAT_1028_43f2 = '\x01'; + } + } + else { + DAT_1028_43f2 = '\0'; + } + } + else if (((*(char *)(iVar6 + 0xbde) != '\0') && ((uVar1 == 0x4e || (uVar1 == 0x1b)))) && + (DAT_1028_07d0 < 4)) { + DAT_1028_07c9 = 0; + uVar10 = 0x1008; + FUN_1008_0002(1); + DAT_1028_07d0 = DAT_1028_07d0 + 1; + *(undefined1 *)(iVar6 + 0xbdd) = 0; + *(undefined1 *)(iVar6 + 0xbdf) = 0; + DAT_1028_07c5 = 1; + *(undefined1 *)(iVar6 + 0x61) = 1; + DAT_1028_0874 = 0; + local_9 = 1; + while( true ) { + *(undefined2 *)((uint)local_9 * 2 + 0x81f) = 0xffff; + local_a = 1; + while( true ) { + *(undefined1 *)(iVar6 + (uint)local_9 * 0xaf + (uint)local_a + 0x61) = + *(undefined1 *)(iVar6 + (uint)local_a + 0x3cc); + *(undefined2 *)(iVar6 + (uint)local_9 * 0x15e + (uint)local_a * 2 + 0x36c) = + *(undefined2 *)(iVar6 + (uint)local_a * 2 + 0xa42); + if (local_a == 0xaf) break; + local_a = local_a + 1; + } + uVar10 = GETDC(uVar10,*(undefined2 *)(iVar6 + 4)); + if (DAT_1028_07d0 < local_9) { + *(undefined2 *)((uint)local_9 * 4 + 0x97e) = 0; + *(undefined2 *)((uint)local_9 * 4 + 0x980) = 0; + FUN_1008_08bb(0x2a,0x11c,(local_9 - 1) * 0x2d + 0x10e,0x15c,uVar10); + FUN_1008_093f(0x2a,0x11c,(local_9 - 1) * 0x2d + 0x10e,0x15c,uVar10); + } + FUN_1008_0dbd(0,uVar10); + uVar12 = *(undefined2 *)(iVar6 + 4); + RELEASEDC(0x1008,uVar10); + if (local_9 == 1) { + uVar10 = GETDC(0x1228,*(undefined2 *)(iVar6 + 4),uVar12); + FUN_1008_0837(0x1e,0x11c,0xe8,0x173,uVar10); + FUN_1008_093f(0x1e,0x11c,0xe8,0x173,uVar10); + FUN_1008_0996(uVar10,0,0); + FUN_1008_0b9e(1,uVar10); + RELEASEDC(0x1008,uVar10); + } + uVar10 = 0x1228; + if (local_9 == 4) break; + local_9 = local_9 + 1; + } + local_a = 1; + while( true ) { + *(undefined1 *)((uint)local_a * 0x53 + 0x98f) = + *(undefined1 *)(iVar6 + (uint)local_a + 0x3cc); + *(undefined2 *)((uint)local_a * 0x53 + 0x99e) = + *(undefined2 *)(iVar6 + (uint)local_a * 2 + 0xa42); + if (local_a == 0xaf) break; + local_a = local_a + 1; + } + DAT_1028_07d1 = 1; + } + } + *(undefined2 *)(iVar7 + 10) = 0; + *(undefined2 *)(iVar7 + 0xc) = 0; + return 0; +} + + +/* ===== 1000:6b37 FUN_1000_6b37 ===== */ + +void __stdcall16far FUN_1000_6b37(int param_1,undefined2 param_2) + +{ + undefined2 uVar1; + undefined2 uVar2; + undefined2 unaff_SS; + undefined2 uVar3; + undefined2 uVar4; + + uVar2 = *(undefined2 *)(param_1 + -0xc); + uVar1 = CREATECOMPATIBLEDC(); + *(undefined2 *)(param_1 + -0xe) = uVar1; + uVar2 = CREATECOMPATIBLEDC(0x1228,*(undefined2 *)(param_1 + -0xc),uVar2); + *(undefined2 *)(param_1 + -0x10) = uVar2; + uVar2 = SELECTOBJECT(0x1228,DAT_1028_085b); + *(undefined2 *)(param_1 + -0x12) = uVar2; + uVar2 = *(undefined2 *)(param_1 + -0x10); + uVar1 = SELECTOBJECT(0x1228,DAT_1028_0865); + *(undefined2 *)(param_1 + -0x14) = uVar1; + uVar1 = *(undefined2 *)(param_1 + -0xe); + BITBLT(0x1228,0x20,0xcc,0,param_2,*(undefined2 *)(param_1 + -0x10),0x12,0x15,0x1aa,0x13a); + uVar4 = *(undefined2 *)(param_1 + -0x10); + SELECTOBJECT(0x1228,*(undefined2 *)(param_1 + -0x14)); + uVar3 = *(undefined2 *)(param_1 + -0xe); + SELECTOBJECT(0x1228,*(undefined2 *)(param_1 + -0x12)); + DELETEDC(0x1228,*(undefined2 *)(param_1 + -0x10),uVar3,uVar4,uVar1,uVar2); + DELETEDC(0x1228,*(undefined2 *)(param_1 + -0xe)); + FUN_1008_093f(0x12,0x15,0x1aa,0x13a,*(undefined2 *)(param_1 + -0xc)); + return; +} + + +/* ===== 1000:6bf8 FUN_1000_6bf8 ===== */ + +undefined2 __stdcall16far FUN_1000_6bf8(undefined4 param_1,undefined4 param_2) + +{ + int iVar1; + uint uVar2; + uint uVar3; + undefined2 uVar4; + uint uVar5; + uint uVar6; + int iVar7; + int iVar8; + int iVar9; + undefined2 uVar10; + undefined2 uVar11; + undefined4 uVar12; + undefined2 local_4; + + uVar10 = (undefined2)((ulong)param_1 >> 0x10); + iVar8 = (int)param_1; + uVar6 = *(uint *)(iVar8 + 0x5c); + iVar1 = FUN_1020_08a9(); + iVar9 = (int)param_2; + uVar11 = (undefined2)((ulong)param_2 >> 0x10); + if ((*(int *)(iVar8 + 0x41) == 0 && *(int *)(iVar8 + 0x43) == 0) && + (*(int *)(iVar8 + 0x45) == 0 && *(int *)(iVar8 + 0x47) == 0)) { + uVar2 = *(uint *)(iVar9 + 8) & 0xff; + if (uVar2 == 0x3b) { + uVar12 = FUN_1000_6073(0,0,0x17e,0x306,0x1028,iVar8,uVar10); + uVar12 = (*(code *)*(undefined2 *)(*DAT_1028_064e + 0x34)) + (0x1000,(int *)DAT_1028_064e,(int)((ulong)DAT_1028_064e >> 0x10),uVar12); + *(undefined2 *)(iVar8 + 0x45) = (int)uVar12; + *(undefined2 *)(iVar8 + 0x47) = (int)((ulong)uVar12 >> 0x10); + FUN_1018_0e9e((int)*(undefined4 *)(iVar8 + 0x45), + (int)((ulong)*(undefined4 *)(iVar8 + 0x45) >> 0x10),1); + return local_4; + } + if (((*(char *)(iVar8 + 0xbdd) == '\0') && (*(char *)(iVar8 + 0xbdf) == '\0')) && + (uVar2 == 0x50)) { + uVar5 = uVar6; + uVar3 = FUN_1020_08e6(); + uVar2 = *(uint *)(iVar8 + 0xbae); + iVar7 = *(int *)(iVar8 + 0xbb0); + *(int *)(iVar8 + 0xbae) = uVar2 - uVar3; + *(int *)(iVar8 + 0xbb0) = (iVar7 - uVar5) - (uint)(uVar2 < uVar3); + *(undefined2 *)(iVar8 + 0xbaa) = 0; + *(undefined2 *)(iVar8 + 0xbac) = 0; + if (DAT_1028_07d0 != '\0') { + uVar4 = GETDC(0x1020,*(undefined2 *)(iVar8 + 4)); + iVar7 = (~uVar6 + 1) - (uint)(iVar1 != 0); + if ((iVar7 < *(int *)(iVar8 + 0xbb0)) || + ((iVar7 <= *(int *)(iVar8 + 0xbb0) && ((uint)-iVar1 < *(uint *)(iVar8 + 0xbae))))) { + FUN_1000_6b37(&stack0xfffe,0x15); + } + else { + uVar2 = uVar6; + uVar5 = FUN_1020_08a9(); + if (((int)uVar2 < *(int *)(iVar8 + 0xbb0)) || + (((int)uVar2 <= *(int *)(iVar8 + 0xbb0) && (uVar5 < *(uint *)(iVar8 + 0xbae))))) { + FUN_1000_6b37(&stack0xfffe,0x2a); + } + else { + uVar2 = uVar6; + uVar5 = FUN_1020_08a9(); + if (((int)uVar2 < *(int *)(iVar8 + 0xbb0)) || + (((int)uVar2 <= *(int *)(iVar8 + 0xbb0) && (uVar5 < *(uint *)(iVar8 + 0xbae))))) { + FUN_1000_6b37(&stack0xfffe,0x3f); + } + else { + uVar2 = uVar6; + uVar5 = FUN_1020_08a9(); + if (((int)uVar2 < *(int *)(iVar8 + 0xbb0)) || + (((int)uVar2 <= *(int *)(iVar8 + 0xbb0) && (uVar5 < *(uint *)(iVar8 + 0xbae))))) { + FUN_1000_6b37(&stack0xfffe,0x54); + } + else { + uVar2 = uVar6; + uVar5 = FUN_1020_08a9(); + if (((int)uVar2 < *(int *)(iVar8 + 0xbb0)) || + (((int)uVar2 <= *(int *)(iVar8 + 0xbb0) && (uVar5 < *(uint *)(iVar8 + 0xbae))))) + { + FUN_1000_6b37(&stack0xfffe,0x69); + } + else { + uVar2 = uVar6; + uVar5 = FUN_1020_08a9(); + if (((int)uVar2 < *(int *)(iVar8 + 0xbb0)) || + (((int)uVar2 <= *(int *)(iVar8 + 0xbb0) && (uVar5 < *(uint *)(iVar8 + 0xbae)))) + ) { + FUN_1000_6b37(&stack0xfffe,0x7e); + } + else { + uVar2 = uVar6; + uVar5 = FUN_1020_08a9(); + if (((int)uVar2 < *(int *)(iVar8 + 0xbb0)) || + (((int)uVar2 <= *(int *)(iVar8 + 0xbb0) && (uVar5 < *(uint *)(iVar8 + 0xbae)) + ))) { + FUN_1000_6b37(&stack0xfffe,0x93); + } + else { + uVar2 = uVar6; + uVar5 = FUN_1020_08a9(); + if (((int)uVar2 < *(int *)(iVar8 + 0xbb0)) || + (((int)uVar2 <= *(int *)(iVar8 + 0xbb0) && + (uVar5 < *(uint *)(iVar8 + 0xbae))))) { + FUN_1000_6b37(&stack0xfffe,0xa8); + } + else { + uVar2 = uVar6; + uVar5 = FUN_1020_08a9(); + if (((int)uVar2 < *(int *)(iVar8 + 0xbb0)) || + (((int)uVar2 <= *(int *)(iVar8 + 0xbb0) && + (uVar5 < *(uint *)(iVar8 + 0xbae))))) { + FUN_1000_6b37(&stack0xfffe,0xbd); + } + else { + uVar2 = FUN_1020_08a9(); + if (((int)uVar6 < *(int *)(iVar8 + 0xbb0)) || + (((int)uVar6 <= *(int *)(iVar8 + 0xbb0) && + (uVar2 < *(uint *)(iVar8 + 0xbae))))) { + FUN_1000_6b37(&stack0xfffe,0xd2); + } + else { + FUN_1000_6b37(&stack0xfffe,0xe7); + } + } + } + } + } + } + } + } + } + } + RELEASEDC(0x1000,uVar4); + } + } + else if (DAT_1028_07c6 == '\0') { + if (uVar2 == 0x1d) { + *(undefined1 *)(iVar8 + 0xbda) = 1; + } + if (uVar2 == 0x1c) { + *(undefined1 *)(iVar8 + 0xbdb) = 1; + } + } + } + *(undefined2 *)(iVar9 + 10) = 0; + *(undefined2 *)(iVar9 + 0xc) = 0; + return 0; +} + + +/* ===== 1000:6f27 FUN_1000_6f27 ===== */ + +void __stdcall16far FUN_1000_6f27(int param_1) + +{ + undefined1 uVar1; + int iVar2; + undefined2 uVar3; + undefined2 uVar4; + undefined2 uVar5; + undefined2 uVar6; + undefined2 uVar7; + undefined2 uVar8; + undefined2 uVar9; + undefined2 uVar10; + undefined2 unaff_SS; + undefined2 uVar11; + undefined2 uVar12; + undefined2 uVar13; + undefined2 uVar14; + undefined2 uVar15; + undefined2 uVar16; + undefined2 local_24; + undefined2 local_22; + undefined2 local_20; + undefined2 local_1e; + undefined2 local_1c; + undefined2 local_1a; + undefined2 local_18; + undefined2 local_16; + undefined2 local_14; + undefined2 local_12; + undefined2 local_10; + + uVar10 = *(undefined2 *)((int)*(undefined4 *)(param_1 + 6) + 4); + uVar3 = GETDC(); + uVar4 = CREATECOMPATIBLEDC(0x1228,uVar3,uVar10); + uVar5 = CREATECOMPATIBLEDC(0x1228,uVar3); + uVar14 = uVar3; + uVar6 = CREATECOMPATIBLEBITMAP(0x1228,0x5a,0x5b); + uVar9 = uVar4; + uVar7 = SELECTOBJECT(0x1228,DAT_1028_0859); + uVar10 = uVar5; + uVar8 = SELECTOBJECT(0x1228,uVar6); + if ((DAT_1028_0857 < 0) || ((DAT_1028_0857 < 1 && (DAT_1028_0855 < 6)))) { + uVar16 = 0; + uVar15 = 0; + uVar13 = 0x5b; + uVar12 = 0x5a; + uVar11 = uVar4; + uVar9 = FUN_1020_08a9(uVar4,0x5a,0x5b,0,0,uVar5,uVar10,uVar9,uVar14); + uVar10 = 0x1228; + BITBLT(0x1020,0x20,0xcc,0,uVar9,uVar11,uVar12,uVar13,uVar15,uVar16); + } + else { + SELECTOBJECT(0x1228,DAT_1028_085d); + BITBLT(0x1228,0x20,0xcc,0x21,0x4f,uVar4,0x5a,0x5b,0,0); + SELECTOBJECT(0x1228,DAT_1028_0859); + iVar2 = DAT_1028_3371; + DAT_1028_3371 = DAT_1028_33c4; + DAT_1028_33c4 = DAT_1028_3417; + DAT_1028_3417 = DAT_1028_346a; + DAT_1028_346a = DAT_1028_34bd; + DAT_1028_34bd = iVar2; + uVar1 = *(undefined1 *)((int)*(undefined4 *)(param_1 + 6) + (uint)DAT_1028_07d1 * 0x14 + 0x476); + *(undefined1 *)((int)*(undefined4 *)(param_1 + 6) + (uint)DAT_1028_07d1 * 0x14 + 0x476) = + *(undefined1 *)((int)*(undefined4 *)(param_1 + 6) + (uint)DAT_1028_07d1 * 0x14 + 0x477); + *(undefined1 *)((int)*(undefined4 *)(param_1 + 6) + (uint)DAT_1028_07d1 * 0x14 + 0x477) = + *(undefined1 *)((int)*(undefined4 *)(param_1 + 6) + (uint)DAT_1028_07d1 * 0x14 + 0x478); + *(undefined1 *)((int)*(undefined4 *)(param_1 + 6) + (uint)DAT_1028_07d1 * 0x14 + 0x478) = + *(undefined1 *)((int)*(undefined4 *)(param_1 + 6) + (uint)DAT_1028_07d1 * 0x14 + 0x479); + *(undefined1 *)((int)*(undefined4 *)(param_1 + 6) + (uint)DAT_1028_07d1 * 0x14 + 0x479) = + *(undefined1 *)((int)*(undefined4 *)(param_1 + 6) + (uint)DAT_1028_07d1 * 0x14 + 0x47a); + *(undefined1 *)((int)*(undefined4 *)(param_1 + 6) + (uint)DAT_1028_07d1 * 0x14 + 0x47a) = uVar1; + local_10 = 0xf; + while( true ) { + uVar10 = 0x1000; + FUN_1000_7e92(param_1,local_10); + if (local_10 == 0x13) break; + local_10 = local_10 + 1; + } + } + if (DAT_1028_0855 == 1) { + uVar10 = 0x1008; + FUN_1008_0002(0xb); + local_12 = 9; + local_1c = 0x29; + local_14 = 0x17; + local_1e = 0xb; + local_16 = 0x38; + local_20 = 0xe; + local_18 = 0x3f; + local_22 = 0x2f; + local_1a = 0x23; + local_24 = 0x3f; + } + else if (DAT_1028_0855 == 2) { + local_12 = 0xb; + local_1c = 0x2d; + local_14 = 0x12; + local_1e = 0xd; + local_16 = 0x34; + local_20 = 0xb; + local_18 = 0x3f; + local_22 = 0x2a; + local_1a = 0x27; + local_24 = 0x40; + } + else if (DAT_1028_0855 == 3) { + local_12 = 0xd; + local_1c = 0x32; + local_14 = 0xf; + local_1e = 0x11; + local_16 = 0x2e; + local_20 = 9; + local_18 = 0x40; + local_22 = 0x25; + local_1a = 0x2c; + local_24 = 0x3e; + } + else if (DAT_1028_0855 == 4) { + local_12 = 0x11; + local_1c = 0x37; + local_14 = 0xb; + local_1e = 0x17; + local_16 = 0x27; + local_20 = 7; + local_18 = 0x40; + local_22 = 0x1e; + local_1a = 0x32; + local_24 = 0x3b; + } + else if (DAT_1028_0855 == 5) { + local_12 = 0x15; + local_1c = 0x3c; + local_14 = 9; + local_1e = 0x1c; + local_16 = 0x23; + local_20 = 7; + local_18 = 0x3e; + local_22 = 0x19; + local_1a = 0x36; + local_24 = 0x38; + } + else if (DAT_1028_0855 == 6) { + local_12 = 8; + local_1c = 0x23; + local_14 = 0x1a; + local_1e = 8; + local_16 = 0x3b; + local_20 = 0x12; + local_18 = 0x3b; + local_22 = 0x32; + local_1a = 0x1b; + local_24 = 0x3d; + } + if (DAT_1028_3371 != 0) { + BITBLT(uVar10,0xc6,0x88,0x11,0x1c7,uVar4,0x11,0x11,local_1c,local_12); + uVar10 = 0x1228; + BITBLT(0x1228,0x86,0xee,0,0x1c7,uVar4,0x11,0x11,local_1c,local_12); + } + if (DAT_1028_33c4 != 0) { + BITBLT(uVar10,0xc6,0x88,0x11,0x1c7,uVar4,0x11,0x11,local_1e,local_14); + uVar10 = 0x1228; + BITBLT(0x1228,0x86,0xee,0,0x1c7,uVar4,0x11,0x11,local_1e,local_14); + } + if (DAT_1028_3417 != 0) { + BITBLT(uVar10,0xc6,0x88,0x11,0x1c7,uVar4,0x11,0x11,local_20,local_16); + uVar10 = 0x1228; + BITBLT(0x1228,0x86,0xee,0,0x1c7,uVar4,0x11,0x11,local_20,local_16); + } + if (DAT_1028_346a != 0) { + BITBLT(uVar10,0xc6,0x88,0x11,0x1c7,uVar4,0x11,0x11,local_22,local_18); + uVar10 = 0x1228; + BITBLT(0x1228,0x86,0xee,0,0x1c7,uVar4,0x11,0x11,local_22,local_18); + } + if (DAT_1028_34bd != 0) { + BITBLT(uVar10,0xc6,0x88,0x11,0x1c7,uVar4,0x11,0x11,local_24,local_1a); + uVar10 = 0x1228; + BITBLT(0x1228,0x86,0xee,0,0x1c7,uVar4,0x11,0x11,local_24,local_1a); + } + uVar14 = uVar3; + BITBLT(uVar10,0x20,0xcc,0,0,uVar5,0x5a,0x5b,0x21,0x4f); + uVar9 = uVar4; + SELECTOBJECT(0x1228,uVar7); + uVar10 = uVar5; + SELECTOBJECT(0x1228,uVar8); + DELETEOBJECT(0x1228,uVar6,uVar10,uVar9,uVar14); + DELETEDC(0x1228,uVar5); + DELETEDC(0x1228,uVar4); + RELEASEDC(0x1228,uVar3); + return; +} + + +/* ===== 1000:7440 FUN_1000_7440 ===== */ + +void __stdcall16far FUN_1000_7440(int param_1) + +{ + undefined2 uVar1; + undefined2 uVar2; + undefined2 uVar3; + undefined2 uVar4; + undefined2 uVar5; + undefined2 uVar6; + undefined2 uVar7; + int iVar8; + undefined2 uVar9; + undefined2 unaff_SS; + undefined2 uVar10; + undefined2 uVar11; + undefined2 uVar12; + undefined2 uVar13; + undefined2 uVar14; + undefined2 uVar15; + undefined2 uVar16; + undefined2 uVar17; + undefined2 uVar18; + undefined2 uVar19; + + uVar7 = *(undefined2 *)((int)*(undefined4 *)(param_1 + 6) + 4); + uVar1 = GETDC(); + uVar2 = CREATECOMPATIBLEDC(0x1228,uVar1,uVar7); + uVar7 = uVar2; + uVar3 = SELECTOBJECT(0x1228,DAT_1028_085f); + uVar4 = CREATECOMPATIBLEDC(0x1228,uVar1,uVar7); + uVar5 = CREATECOMPATIBLEBITMAP(0x1228,0x7b,0x5b); + uVar19 = uVar4; + uVar6 = SELECTOBJECT(0x1228,uVar5); + uVar14 = 0x4f; + uVar12 = 0; + uVar7 = uVar2; + uVar16 = uVar4; + BITBLT(0x1228,0x20,0xcc,0,0x4f,uVar2,0x7b,0x5b,0,0); + uVar18 = 0x1228; + uVar9 = 0x1228; + uVar17 = 0x74c1; + uVar13 = DAT_1028_0859; + uVar15 = uVar2; + SELECTOBJECT(0x1228,DAT_1028_0859); + if (((int)DAT_1028_0851 < 1) || (0x2c < (int)DAT_1028_0851)) { + if (((int)DAT_1028_0851 < 0x2d) || (0x39 < (int)DAT_1028_0851)) { + if (((int)DAT_1028_0851 < 0x3a) || (0x41 < (int)DAT_1028_0851)) { + if (((int)DAT_1028_0851 < 0x42) || (0x80 < (int)DAT_1028_0851)) { + if (((int)DAT_1028_0851 < 0x81) || (0x9e < (int)DAT_1028_0851)) { + if (((int)DAT_1028_0851 < 0x9f) || (0xdd < (int)DAT_1028_0851)) { + if (((int)DAT_1028_0851 < 0xde) || (0xe5 < (int)DAT_1028_0851)) { + if (((int)DAT_1028_0851 < 0xe6) || (0xed < (int)DAT_1028_0851)) { + if ((0xed < (int)DAT_1028_0851) && ((int)DAT_1028_0851 < 0x11a)) { + if ((DAT_1028_0853 == 0) && (DAT_1028_0851 == 0xee)) { + uVar9 = 0x1008; + FUN_1008_0002(0xd); + } + uVar17 = uVar4; + BITBLT(uVar9,0xc6,0x88,0x5a,0x16a,uVar2,0x5a,0x5b,0x21,0); + uVar7 = uVar4; + BITBLT(0x1228,0x86,0xee,0x5a,0x1c5,uVar2,0x5a,0x5b,0x21,0); + uVar16 = 0x14; + uVar15 = 0; + uVar13 = 0x2d; + uVar17 = FUN_1020_08a9(0x2d,0,0x14,uVar4,uVar7,uVar17); + uVar18 = 0x2d; + uVar7 = uVar2; + iVar8 = FUN_1020_08a9(0x2d,uVar2,uVar17); + BITBLT(0x1020,0xc6,0x88,iVar8 + 0x5a,uVar18,uVar7,uVar17,uVar13,uVar15,uVar16); + uVar16 = 0x14; + uVar15 = 0; + uVar13 = 0x2d; + uVar17 = FUN_1020_08a9(0x2d,0,0x14,uVar4); + uVar18 = 0; + uVar7 = uVar2; + iVar8 = FUN_1020_08a9(0,uVar2,uVar17); + BITBLT(0x1020,0x86,0xee,iVar8 + 0x5a,uVar18,uVar7,uVar17,uVar13,uVar15,uVar16); + if ((DAT_1028_0853 == 0) && (DAT_1028_0851 == 0x119)) { + SELECTOBJECT(0x1228,DAT_1028_085b); + SELECTOBJECT(0x1228,DAT_1028_085d); + BITBLT(0x1228,0x20,0xcc,0,0x4f,uVar2,0x5a,0x5b,0,0x4f); + SELECTOBJECT(0x1228,uVar5); + } + } + } + else { + if ((DAT_1028_0853 == 0) && (DAT_1028_0851 == 0xe6)) { + uVar9 = 0x1008; + FUN_1008_0002(0xc); + } + BITBLT(uVar9,0xc6,0x88,0x5a,0x16a,uVar2,0x5a,0x5b,0x21,0); + BITBLT(0x1228,0x86,0xee,0x5a,0x1c5,uVar2,0x5a,0x5b,0x21,0); + BITBLT(0x1228,0xc6,0x88,0x5a,0x2d,uVar2,0x58,0x2d,0,0x14); + BITBLT(0x1228,0x86,0xee,0x5a,0,uVar2,0x58,0x2d,0,0x14); + } + } + else { + if ((DAT_1028_0853 == 0) && (DAT_1028_0851 == 0xde)) { + uVar9 = 0x1008; + FUN_1008_118f(); + } + BITBLT(uVar9,0xc6,0x88,0x5a,0x16a,uVar2,0x5a,0x5b,0x21,0); + BITBLT(0x1228,0x86,0xee,0x5a,0x1c5,uVar2,0x5a,0x5b,0x21,0); + BITBLT(0x1228,0xc6,0x88,0x5a,0x87,uVar2,0x58,0x2d,0,0x14); + BITBLT(0x1228,0x86,0xee,0x5a,0x5a,uVar2,0x58,0x2d,0,0x14); + } + } + else { + if ((DAT_1028_0853 == 0) && (DAT_1028_0851 == 0x9f)) { + uVar9 = 0x1008; + FUN_1008_0002(0xd); + } + uVar7 = uVar4; + BITBLT(uVar9,0x20,0xcc,0x5a,0xb4,uVar2,0x5a,0x5b,0x21,0); + if ((DAT_1028_0853 < 0) || ((DAT_1028_0853 < 1 && (DAT_1028_0851 < 0xcc)))) { + uVar16 = 0; + uVar15 = 0; + uVar13 = 0x5b; + uVar17 = FUN_1020_08a9(0x5b,0,0,uVar4,uVar7); + uVar18 = 0x16a; + uVar7 = uVar2; + iVar8 = FUN_1020_08a9(0x16a,uVar2,uVar17); + BITBLT(0x1020,0xc6,0x88,iVar8 + 0x5a,uVar18,uVar7,uVar17,uVar13,uVar15,uVar16); + uVar16 = 0; + uVar15 = 0; + uVar13 = 0x5b; + uVar17 = FUN_1020_08a9(0x5b,0,0,uVar4); + uVar18 = 0x1c5; + uVar7 = uVar2; + iVar8 = FUN_1020_08a9(0x1c5,uVar2,uVar17); + BITBLT(0x1020,0x86,0xee,iVar8 + 0x5a,uVar18,uVar7,uVar17,uVar13,uVar15,uVar16); + } + else { + uVar17 = 0; + uVar7 = FUN_1020_08a9(0,uVar4); + BITBLT(0x1020,0xc6,0x88,0x5a,0x16a,uVar2,0x5a,0x5b,uVar7,uVar17); + uVar17 = 0; + uVar7 = FUN_1020_08a9(0,uVar4); + BITBLT(0x1020,0x86,0xee,0x5a,0x1c5,uVar2,0x5a,0x5b,uVar7,uVar17); + } + if ((0 < DAT_1028_0853) || ((-1 < DAT_1028_0853 && (0xb0 < DAT_1028_0851)))) { + if ((DAT_1028_0853 == 0) && (DAT_1028_0851 == 0xdd)) { + BITBLT(0x1228,0xc6,0x88,0x5a,0x87,uVar2,0x58,0x2d,0,0x14); + BITBLT(0x1228,0x86,0xee,0x5a,0x5a,uVar2,0x58,0x2d,0,0x14); + } + else { + uVar16 = 0x14; + uVar15 = 0; + uVar13 = 0x2d; + uVar17 = FUN_1020_08a9(0x2d,0,0x14,uVar4); + uVar18 = 0x87; + uVar7 = uVar2; + iVar8 = FUN_1020_08a9(0x87,uVar2,uVar17); + BITBLT(0x1020,0xc6,0x88,iVar8 + 0x59,uVar18,uVar7,uVar17,uVar13,uVar15,uVar16); + uVar16 = 0x14; + uVar15 = 0; + uVar13 = 0x2d; + uVar17 = FUN_1020_08a9(0x2d,0,0x14,uVar4); + uVar18 = 0x5a; + uVar7 = uVar2; + iVar8 = FUN_1020_08a9(0x5a,uVar2,uVar17); + BITBLT(0x1020,0x86,0xee,iVar8 + 0x59,uVar18,uVar7,uVar17,uVar13,uVar15,uVar16); + } + } + } + } + else { + if ((DAT_1028_0853 == 0) && (DAT_1028_0851 == 0x81)) { + uVar9 = 0x1008; + FUN_1008_118f(); + } + BITBLT(uVar9,0x20,0xcc,0x5a,0xb4,uVar2,0x5a,0x5b,0x21,0); + } + } + else { + if ((DAT_1028_0853 == 0) && (DAT_1028_0851 == 0x42)) { + uVar9 = 0x1008; + FUN_1008_0002(0xd); + } + uVar7 = uVar4; + BITBLT(uVar9,0x20,0xcc,0x5a,0xb4,uVar2,0x5a,0x5b,0x21,0); + if ((DAT_1028_0853 < 0) || ((DAT_1028_0853 < 1 && (DAT_1028_0851 < 0x53)))) { + uVar17 = 0; + uVar7 = FUN_1020_08a9(0,uVar4); + BITBLT(0x1020,0xc6,0x88,0x5a,0x16a,uVar2,0x5a,0x5b,uVar7,uVar17); + uVar17 = 0; + uVar7 = FUN_1020_08a9(0,uVar4); + BITBLT(0x1020,0x86,0xee,0x5a,0x10f,uVar2,0x5a,0x5b,uVar7,uVar17); + } + else { + uVar16 = 0; + uVar15 = 0; + uVar13 = 0x5b; + uVar17 = FUN_1020_08a9(0x5b,0,0,uVar4,uVar7); + uVar18 = 0x16a; + uVar7 = uVar2; + iVar8 = FUN_1020_08a9(0x16a,uVar2,uVar17); + BITBLT(0x1020,0xc6,0x88,iVar8 + 0x5a,uVar18,uVar7,uVar17,uVar13,uVar15,uVar16); + uVar16 = 0; + uVar15 = 0; + uVar13 = 0x5b; + uVar17 = FUN_1020_08a9(0x5b,0,0,uVar4); + uVar18 = 0x10f; + uVar7 = uVar2; + iVar8 = FUN_1020_08a9(0x10f,uVar2,uVar17); + BITBLT(0x1020,0x86,0xee,iVar8 + 0x5a,uVar18,uVar7,uVar17,uVar13,uVar15,uVar16); + } + if ((DAT_1028_0853 < 0) || ((DAT_1028_0853 < 1 && (DAT_1028_0851 < 0x6f)))) { + uVar16 = 0x14; + uVar15 = 0; + uVar13 = 0x2d; + uVar17 = FUN_1020_08a9(0x2d,0,0x14,uVar4); + uVar18 = 0x87; + uVar7 = uVar2; + iVar8 = FUN_1020_08a9(0x87,uVar2,uVar17); + BITBLT(0x1020,0xc6,0x88,iVar8 + 0x5a,uVar18,uVar7,uVar17,uVar13,uVar15,uVar16); + uVar16 = 0x14; + uVar15 = 0; + uVar13 = 0x2d; + uVar17 = FUN_1020_08a9(0x2d,0,0x14,uVar4); + uVar18 = 0x5a; + uVar7 = uVar2; + iVar8 = FUN_1020_08a9(0x5a,uVar2,uVar17); + BITBLT(0x1020,0x86,0xee,iVar8 + 0x5a,uVar18,uVar7,uVar17,uVar13,uVar15,uVar16); + } + } + } + else { + if ((DAT_1028_0853 == 0) && (DAT_1028_0851 == 0x3a)) { + uVar9 = 0x1008; + FUN_1008_0002(0xc); + } + BITBLT(uVar9,0xc6,0x88,0x5a,0x87,uVar2,0x58,0x2d,0,0x14); + BITBLT(0x1228,0x86,0xee,0x5a,0x5a,uVar2,0x58,0x2d,0,0x14); + } + } + else { + if ((DAT_1028_0853 == 0) && (DAT_1028_0851 == 0x2d)) { + uVar9 = 0x1008; + FUN_1008_118f(); + } + BITBLT(uVar9,0xc6,0x88,0x5a,0x2d,uVar2,0x58,0x2d,0,0x14); + BITBLT(0x1228,0x86,0xee,0x5a,0,uVar2,0x58,0x2d,0,0x14); + } + } + else { + if ((DAT_1028_0853 == 0) && (DAT_1028_0851 == 1)) { + FUN_1008_0002(0xd); + uVar13 = uVar4; + SELECTOBJECT(0x1008,DAT_1028_085b); + uVar18 = uVar4; + BITBLT(0x1228,0x20,0xcc,0x5a,0x10f,uVar2,0x5a,0x5b,0,0x4f); + uVar14 = 0x1228; + uVar12 = 0x751d; + uVar7 = uVar5; + uVar17 = uVar4; + SELECTOBJECT(0x1228,uVar5); + } + uVar11 = 0x14; + uVar10 = 0; + uVar9 = 0x2d; + uVar17 = FUN_1020_08a9(0x2d,0,0x14,uVar4,uVar12,uVar14,uVar7,uVar17,uVar18,uVar13,uVar15,uVar16, + uVar19); + uVar18 = 0x2d; + uVar7 = uVar2; + iVar8 = FUN_1020_08a9(0x2d,uVar2,uVar17); + BITBLT(0x1020,0xc6,0x88,iVar8 + 0x59,uVar18,uVar7,uVar17,uVar9,uVar10,uVar11); + uVar16 = 0x14; + uVar15 = 0; + uVar13 = 0x2d; + uVar17 = FUN_1020_08a9(0x2d,0,0x14,uVar4); + uVar18 = 0; + uVar7 = uVar2; + iVar8 = FUN_1020_08a9(0,uVar2,uVar17); + BITBLT(0x1020,0x86,0xee,iVar8 + 0x59,uVar18,uVar7,uVar17,uVar13,uVar15,uVar16); + } + uVar18 = uVar1; + BITBLT(0x1228,0x20,0xcc,0,0,uVar4,0x7b,0x5b,0,0x4f); + uVar17 = uVar4; + SELECTOBJECT(0x1228,uVar6); + uVar7 = uVar2; + SELECTOBJECT(0x1228,uVar3); + DELETEOBJECT(0x1228,uVar5,uVar7,uVar17,uVar18); + DELETEDC(0x1228,uVar4); + DELETEDC(0x1228,uVar2); + RELEASEDC(0x1228,uVar1); + return; +} + + +/* ===== 1000:7e12 FUN_1000_7e12 ===== */ + +void __stdcall16far FUN_1000_7e12(undefined2 param_1,uint param_2) + +{ + if ((param_2 != 0) && (param_2 < 0xb0)) { + if ((*(uint *)(param_2 * 0x53 + 0x99c) & 0x80) == 0x80) { + if (*(char *)(param_2 * 0x53 + 0x98f) == '\0') { + FUN_1000_b30b(param_1,param_2); + } + else { + FUN_1000_b3f3(param_1,param_2); + } + } + else if ((*(uint *)(param_2 * 0x53 + 0x99c) & 0x100) == 0x100) { + if (*(char *)(param_2 * 0x53 + 0x98f) == '\0') { + FUN_1000_b3f3(param_1,param_2); + } + else { + FUN_1000_b30b(param_1,param_2); + } + } + } + return; +} + + +/* ===== 1000:7e92 FUN_1000_7e92 ===== */ + +void __stdcall16far FUN_1000_7e92(int param_1,int param_2) + +{ + undefined2 unaff_SS; + + if (*(char *)((int)*(undefined4 *)(param_1 + 6) + (uint)DAT_1028_07d1 * 0x14 + param_2 + 0x467) == + '\0') { + FUN_1000_b3f3(param_1,param_2 + 1000); + } + else { + FUN_1000_b30b(param_1,param_2 + 1000); + } + return; +} + + +/* ===== 1000:7ed9 FUN_1000_7ed9 ===== */ + +/* WARNING: Removing unreachable block (ram,0x10008133) */ + +void __stdcall16far FUN_1000_7ed9(int param_1,int param_2,uint param_3,int param_4,int param_5) + +{ + uint uVar1; + uint uVar2; + uint uVar3; + uint uVar4; + uint uVar5; + undefined2 uVar6; + undefined2 uVar7; + undefined2 uVar8; + int iVar9; + int iVar10; + int iVar11; + int iVar12; + uint uVar13; + int extraout_DX; + undefined2 uVar14; + int iVar15; + undefined2 unaff_SS; + bool bVar16; + undefined1 uVar17; + undefined1 uVar18; + undefined4 uVar19; + uint local_86; + uint local_84; + uint local_76; + int local_74; + uint local_36; + int local_34; + uint local_32; + int local_30; + uint local_2e; + int local_2c; + uint local_2a; + int local_28; + uint local_1e; + int local_1c; + uint local_1a; + int local_18; + uint local_a; + uint local_8; + uint local_6; + uint local_4; + + FUN_1008_0002(0x15); + if (param_4 == 1) { + FUN_1020_1017(); + local_1a = DAT_1028_1e80 + 0xd8f0; + local_18 = DAT_1028_1e82 - (uint)(DAT_1028_1e80 < 10000); + local_1e = DAT_1028_1e84; + local_1c = DAT_1028_1e86; + local_2a = DAT_1028_1edb + 20000; + local_28 = DAT_1028_1edd + (uint)(0xb1df < DAT_1028_1edb); + local_2e = DAT_1028_1edf; + local_2c = DAT_1028_1ee1; + local_32 = DAT_1028_1f79 + 20000; + local_30 = DAT_1028_1f7b + (uint)(0xb1df < DAT_1028_1f79); + local_36 = DAT_1028_1f7d; + local_34 = DAT_1028_1f7f; + } + else if (param_4 == 2) { + FUN_1020_1017(); + local_1a = DAT_1028_235d + 10000; + local_18 = DAT_1028_235f + (uint)(0xd8ef < DAT_1028_235d); + local_1e = DAT_1028_2361; + local_1c = DAT_1028_2363; + local_2a = DAT_1028_2456 + 0xb1e0; + local_28 = DAT_1028_2458 - (uint)(DAT_1028_2456 < 20000); + local_2e = DAT_1028_245a; + local_2c = DAT_1028_245c; + local_32 = DAT_1028_23b8 + 0xb1e0; + local_30 = DAT_1028_23ba - (uint)(DAT_1028_23b8 < 20000); + local_36 = DAT_1028_23bc; + local_34 = DAT_1028_23be; + } + uVar3 = param_3; + FUN_1020_08a9(); + FUN_1020_100b(); + uVar1 = FUN_1020_1017(); + uVar2 = uVar1 + local_1e; + iVar9 = uVar3 + local_1c + (uint)CARRY2(uVar1,local_1e); + uVar3 = (uint)*(byte *)((int)*(undefined4 *)(param_1 + 6) + 0x61); + if (uVar3 != 0) { + local_76 = 1; + local_74 = 0; + while( true ) { + if (1 < *(byte *)((int)*(undefined4 *)(param_1 + 6) + 0x61)) { + FUN_1000_c36b(param_1,local_76 - 1,local_74 - (uint)(local_76 == 0)); + } + if ((param_3 == 0xffff) && (param_2 == -1)) { + iVar10 = (local_28 - DAT_1028_07d5) - (uint)(local_2a < DAT_1028_07d3); + FUN_1020_08e6(); + FUN_1020_08e6(); + iVar11 = ((local_2c - (uint)(local_2e < 43000)) - DAT_1028_07d9) - + (uint)(local_2e + 0x5808 < DAT_1028_07d7); + FUN_1020_08e6(); + FUN_1020_08e6(); + uVar1 = FUN_1020_08a9(); + iVar12 = iVar10; + uVar4 = FUN_1020_08a9(); + local_6 = uVar4 - uVar1; + local_4 = (iVar12 - iVar11) - (uint)(uVar4 < uVar1); + FUN_1020_08e6(); + iVar12 = ((local_2c + (uint)(0xd11f < local_2e)) - DAT_1028_07d9) - + (uint)(local_2e + 12000 < DAT_1028_07d7); + FUN_1020_08e6(); + uVar1 = FUN_1020_08a9(); + uVar4 = FUN_1020_08a9(); + local_a = uVar4 - uVar1; + local_8 = (iVar10 - iVar12) - (uint)(uVar4 < uVar1); + } + else { + iVar10 = (local_30 - DAT_1028_07d5) - (uint)(local_32 < DAT_1028_07d3); + FUN_1020_08e6(); + FUN_1020_08e6(); + iVar11 = ((local_34 - (uint)(local_36 < 12000)) - DAT_1028_07d9) - + (uint)(local_36 + 0xd120 < DAT_1028_07d7); + FUN_1020_08e6(); + FUN_1020_08e6(); + uVar1 = FUN_1020_08a9(); + iVar12 = iVar10; + uVar4 = FUN_1020_08a9(); + local_6 = uVar4 - uVar1; + local_4 = (iVar12 - iVar11) - (uint)(uVar4 < uVar1); + FUN_1020_08e6(); + iVar12 = ((local_34 + (uint)(0x5807 < local_36)) - DAT_1028_07d9) - + (uint)(local_36 + 43000 < DAT_1028_07d7); + FUN_1020_08e6(); + uVar1 = FUN_1020_08a9(); + uVar4 = FUN_1020_08a9(); + local_a = uVar4 - uVar1; + local_8 = (iVar10 - iVar12) - (uint)(uVar4 < uVar1); + } + uVar1 = DAT_1028_07d3 - local_1a; + uVar4 = (DAT_1028_07d5 - local_18) - (uint)(DAT_1028_07d3 < local_1a); + if ((int)uVar4 < 0) { + bVar16 = uVar1 != 0; + uVar1 = -uVar1; + uVar4 = (~uVar4 + 1) - (uint)bVar16; + } + uVar5 = DAT_1028_07d7 - uVar2; + uVar13 = (DAT_1028_07d9 - iVar9) - (uint)(DAT_1028_07d7 < uVar2); + if ((int)uVar13 < 0) { + bVar16 = uVar5 != 0; + uVar5 = -uVar5; + uVar13 = (~uVar13 + 1) - (uint)bVar16; + } + if ((((int)uVar4 < 0) || (((int)uVar4 < 1 && (uVar1 < 54000)))) && + (((int)uVar13 < 0 || (((int)uVar13 < 1 && (uVar5 < 54000)))))) { + FUN_1020_100b(); + FUN_1020_0ffd(); + uVar19 = FUN_1020_0ff1(0x1020); + FUN_1020_100b((int)uVar19,iVar12,(int)((ulong)uVar19 >> 0x10)); + FUN_1020_0ffd(); + FUN_1020_0ff1(0x1020); + iVar12 = extraout_DX; + FUN_1020_0fe5(); + FUN_1020_10be(); + FUN_1020_0ff7(); + uVar1 = FUN_1020_1017(); + if (((iVar12 < 0) || ((iVar12 < 1 && (uVar1 < 0xd2f1)))) && + (((((param_5 == 0 && + ((param_4 == 1 && ((local_4 < 0x8000 || ((-2 < (int)local_4 && (0xfc18 < local_6))))) + ))) && (((int)local_8 < 0 || (((int)local_8 < 1 && (local_a < 1000)))))) && + ((local_18 < DAT_1028_07d5 || + ((local_18 <= DAT_1028_07d5 && (local_1a < DAT_1028_07d3)))))) || + (((((param_5 == 0 && (param_4 == 2)) && + (((int)local_4 < 0 || (((int)local_4 < 1 && (local_6 < 1000)))))) && + ((local_8 < 0x8000 || ((-2 < (int)local_8 && (0xfc18 < local_a)))))) && + ((DAT_1028_07d5 < local_18 || + ((DAT_1028_07d5 <= local_18 && (DAT_1028_07d3 < local_1a)))))))))) { + FUN_1020_08a9(); + FUN_1020_100b(); + FUN_1020_1017(); + FUN_1020_100b(); + uVar1 = param_3; + FUN_1020_08a9(); + FUN_1020_100b(); + FUN_1020_1017(); + FUN_1020_100b(); + if ((param_3 == 0xffff) && (param_2 == -1)) { + uVar4 = (local_28 - local_18) - (uint)(local_2a < local_1a); + uVar17 = false; + uVar18 = uVar4 == 0; + if ((int)uVar4 < 0) { + uVar5 = ~uVar4 + 1; + uVar17 = ~uVar4 != 0xffff || uVar5 < (local_2a != local_1a); + uVar18 = uVar5 == (local_2a != local_1a); + } + FUN_1020_100b(); + FUN_1020_1007(); + if ((bool)uVar17 || (bool)uVar18) { + local_86 = local_2e + 0x5808; + local_84 = local_2c - (uint)(local_2e < 43000); + } + else { + uVar4 = DAT_1028_07d3 - local_1a; + uVar1 = (DAT_1028_07d5 - local_18) - (uint)(DAT_1028_07d3 < local_1a); + if ((int)uVar1 < 0) { + bVar16 = uVar4 != 0; + uVar4 = -uVar4; + uVar1 = (~uVar1 + 1) - (uint)bVar16; + } + local_86 = (uVar2 - uVar4) + 5000; + local_84 = ((iVar9 - uVar1) - (uint)(uVar2 < uVar4)) + (uint)(0xec77 < uVar2 - uVar4); + } + local_84 = (local_84 - DAT_1028_07d9) - (uint)(local_86 < DAT_1028_07d7); + } + else { + uVar4 = (local_30 - local_18) - (uint)(local_32 < local_1a); + uVar17 = false; + uVar18 = uVar4 == 0; + if ((int)uVar4 < 0) { + uVar5 = ~uVar4 + 1; + uVar17 = ~uVar4 != 0xffff || uVar5 < (local_32 != local_1a); + uVar18 = uVar5 == (local_32 != local_1a); + } + FUN_1020_100b(); + FUN_1020_1007(); + if ((bool)uVar17 || (bool)uVar18) { + local_86 = local_36 + 43000; + local_84 = local_34 + (uint)(0x5807 < local_36); + } + else { + iVar12 = (local_30 - local_18) - (uint)(local_32 < local_1a); + uVar6 = FUN_1020_100b(); + uVar4 = (DAT_1028_07d5 - local_18) - (uint)(DAT_1028_07d3 < local_1a); + FUN_1020_08a9(uVar6,uVar1,iVar12); + FUN_1020_100b(); + FUN_1020_0ffd(); + uVar1 = FUN_1020_1017(); + local_86 = uVar2 - uVar1; + local_84 = (iVar9 - uVar4) - (uint)(uVar2 < uVar1); + uVar1 = uVar4; + } + local_84 = (local_84 - DAT_1028_07d9) - (uint)(local_86 < DAT_1028_07d7); + } + if ((int)local_84 < 0) { + uVar1 = param_3; + FUN_1020_08a9(); + FUN_1020_100b(); + iVar12 = FUN_1020_1017(); + local_86 = -iVar12; + local_84 = (~local_84 + 1) - (uint)(iVar12 != 0); + } + else { + local_86 = 0; + local_84 = 0; + } + uVar14 = 0; + uVar8 = uVar14; + uVar7 = FUN_1020_100b(); + uVar6 = *(undefined2 *)((int)*(undefined4 *)(param_1 + 6) + 0xbb0); + FUN_1020_100b(uVar7,uVar1,uVar8); + uVar8 = FUN_1020_0ff7(); + FUN_1020_100b(uVar8,uVar1,uVar6); + FUN_1020_0ff7(); + FUN_1020_0fe5(); + FUN_1020_0ff7(); + FUN_1020_0ffd(); + FUN_1020_1017(); + uVar8 = uVar14; + uVar7 = FUN_1020_100b(); + uVar6 = *(undefined2 *)((int)*(undefined4 *)(param_1 + 6) + 0xbb0); + FUN_1020_100b(uVar7,uVar1,uVar8); + uVar7 = FUN_1020_0ff7(); + uVar8 = *(undefined2 *)((int)*(undefined4 *)(param_1 + 6) + 0xbac); + FUN_1020_100b(uVar7,uVar1,uVar6); + FUN_1020_0ff7(); + FUN_1020_0feb(); + FUN_1020_0ffd(); + FUN_1020_1017(); + uVar6 = uVar14; + uVar7 = FUN_1020_100b(); + FUN_1020_100b(uVar7,uVar1,uVar6); + FUN_1020_0ffd(); + FUN_1020_10be(); + FUN_1020_0ff7(); + FUN_1020_0fe5(); + uVar6 = FUN_1020_100b(); + uVar7 = 0; + iVar11 = 0; + FUN_1020_0fe5(uVar6,uVar1,uVar8); + FUN_1020_0ff7(); + uVar1 = FUN_1020_1017(); + iVar12 = *(int *)((int)*(undefined4 *)(param_1 + 6) + 0x58); + FUN_1020_100b(); + FUN_1020_0ff7(); + uVar4 = FUN_1020_1017(); + iVar10 = iVar12 + iVar11 + (uint)CARRY2(uVar4,uVar1); + uVar6 = uVar14; + uVar8 = FUN_1020_100b(); + iVar11 = iVar10; + FUN_1020_100b(uVar8,uVar7,uVar6); + uVar6 = FUN_1020_0ff7(); + iVar12 = 0; + FUN_1020_100b(uVar6,uVar7,iVar11); + FUN_1020_0ff7(); + FUN_1020_0feb(); + FUN_1020_0ffd(); + uVar4 = FUN_1020_1017(); + uVar6 = (undefined2)((ulong)*(undefined4 *)(param_1 + 6) >> 0x10); + iVar15 = (int)*(undefined4 *)(param_1 + 6); + uVar1 = *(uint *)(iVar15 + 0xbaa); + iVar11 = *(int *)(iVar15 + 0xbac); + *(int *)(iVar15 + 0xbaa) = uVar4 + *(uint *)(iVar15 + 0xbaa); + *(int *)(iVar15 + 0xbac) = iVar12 + iVar11 + (uint)CARRY2(uVar4,uVar1); + uVar8 = FUN_1020_100b(); + uVar6 = 0; + FUN_1020_100b(uVar8,uVar7,uVar14); + uVar8 = FUN_1020_0ff7(); + FUN_1020_100b(uVar8,uVar7,uVar6); + FUN_1020_0ff7(); + FUN_1020_0fe5(); + FUN_1020_0ffd(); + uVar4 = FUN_1020_1017(); + uVar6 = (undefined2)((ulong)*(undefined4 *)(param_1 + 6) >> 0x10); + iVar11 = (int)*(undefined4 *)(param_1 + 6); + uVar1 = *(uint *)(iVar11 + 0xbae); + iVar12 = *(int *)(iVar11 + 0xbb0); + *(int *)(iVar11 + 0xbae) = uVar4 + *(uint *)(iVar11 + 0xbae); + *(int *)(iVar11 + 0xbb0) = iVar10 + iVar12 + (uint)CARRY2(uVar4,uVar1); + uVar6 = *(undefined2 *)(iVar11 + 0xbb0); + uVar8 = FUN_1020_100b(); + uVar1 = local_84; + FUN_1020_08a9(uVar8,uVar7,uVar6); + FUN_1020_100b(); + FUN_1020_0ffd(); + uVar6 = FUN_1020_1017(); + FUN_1000_beff(param_1,uVar6,uVar1,local_86,local_84); + } + } + if (1 < *(byte *)((int)*(undefined4 *)(param_1 + 6) + 0x61)) { + FUN_1000_c426(param_1,local_76 - 1,local_74 - (uint)(local_76 == 0)); + } + if ((local_74 == 0) && (local_76 == uVar3)) break; + bVar16 = 0xfffe < local_76; + local_76 = local_76 + 1; + local_74 = local_74 + (uint)bVar16; + } + } + return; +} + + +/* ===== 1000:8b0d FUN_1000_8b0d ===== */ + +void __stdcall16far FUN_1000_8b0d(int param_1,int param_2,int param_3,char param_4) + +{ + undefined4 uVar1; + uint uVar2; + undefined2 uVar3; + uint uVar4; + int iVar5; + undefined2 uVar6; + undefined2 unaff_SS; + bool bVar7; + undefined2 uVar8; + + uVar1 = *(undefined4 *)(*(int *)(param_1 + 6) + 6); + uVar8 = *(undefined2 *)((int)uVar1 + 4); + uVar6 = 0x1228; + uVar3 = GETDC(); + if ((param_3 == 0) && (param_2 == 1)) { + *(undefined2 *)(param_1 + -4) = 0; + *(undefined2 *)(param_1 + -2) = 0; + *(undefined2 *)(param_1 + -8) = 43000; + *(undefined2 *)(param_1 + -6) = 0; + } + else { + *(undefined2 *)(param_1 + -4) = 0; + *(undefined2 *)(param_1 + -2) = 0; + *(undefined2 *)(param_1 + -8) = 0x5808; + *(undefined2 *)(param_1 + -6) = 0xffff; + } + if (param_4 == '\x01') { + iVar5 = param_3; + FUN_1020_08a9(uVar8); + FUN_1020_100b(); + uVar4 = FUN_1020_1017(); + bVar7 = CARRY2(DAT_1028_1ed3,uVar4); + DAT_1028_1ed3 = DAT_1028_1ed3 + uVar4; + DAT_1028_1ed5 = DAT_1028_1ed5 + iVar5 + (uint)bVar7; + iVar5 = param_3; + FUN_1020_08a9(); + FUN_1020_100b(); + uVar4 = FUN_1020_1017(); + bVar7 = CARRY2(DAT_1028_1ed7,uVar4); + DAT_1028_1ed7 = DAT_1028_1ed7 + uVar4; + DAT_1028_1ed9 = DAT_1028_1ed9 + iVar5 + (uint)bVar7; + iVar5 = param_3; + FUN_1020_08a9(); + FUN_1020_100b(); + uVar4 = FUN_1020_1017(); + bVar7 = CARRY2(DAT_1028_1edb,uVar4); + DAT_1028_1edb = DAT_1028_1edb + uVar4; + DAT_1028_1edd = DAT_1028_1edd + iVar5 + (uint)bVar7; + iVar5 = param_3; + FUN_1020_08a9(); + FUN_1020_100b(); + uVar4 = FUN_1020_1017(); + bVar7 = CARRY2(DAT_1028_1edf,uVar4); + DAT_1028_1edf = DAT_1028_1edf + uVar4; + DAT_1028_1ee1 = DAT_1028_1ee1 + iVar5 + (uint)bVar7; + if ((DAT_1028_1ed5 < DAT_1028_1edd) || + ((DAT_1028_1ed5 <= DAT_1028_1edd && (DAT_1028_1ed3 < DAT_1028_1edb)))) { + DAT_1028_1ec5 = DAT_1028_1ed5 - (uint)(DAT_1028_1ed3 < 5000); + DAT_1028_1ecd = DAT_1028_1edd + (uint)(0xec77 < DAT_1028_1edb); + uVar4 = DAT_1028_1ed3; + uVar2 = DAT_1028_1edb; + } + else { + DAT_1028_1ec5 = DAT_1028_1edd - (uint)(DAT_1028_1edb < 5000); + DAT_1028_1ecd = DAT_1028_1ed5 + (uint)(0xec77 < DAT_1028_1ed3); + uVar4 = DAT_1028_1edb; + uVar2 = DAT_1028_1ed3; + } + DAT_1028_1ecb = uVar2 + 5000; + DAT_1028_1ec3 = uVar4 + 0xec78; + if ((DAT_1028_1ed9 < DAT_1028_1ee1) || + ((DAT_1028_1ed9 <= DAT_1028_1ee1 && (DAT_1028_1ed7 < DAT_1028_1edf)))) { + DAT_1028_1ec9 = DAT_1028_1ed9 - (uint)(DAT_1028_1ed7 < 5000); + DAT_1028_1ed1 = DAT_1028_1ee1 + (uint)(0xec77 < DAT_1028_1edf); + uVar4 = DAT_1028_1ed7; + uVar2 = DAT_1028_1edf; + } + else { + DAT_1028_1ec9 = DAT_1028_1ee1 - (uint)(DAT_1028_1edf < 5000); + DAT_1028_1ed1 = DAT_1028_1ed9 + (uint)(0xec77 < DAT_1028_1ed7); + uVar4 = DAT_1028_1edf; + uVar2 = DAT_1028_1ed7; + } + DAT_1028_1ecf = uVar2 + 5000; + DAT_1028_1ec7 = uVar4 + 0xec78; + iVar5 = param_3; + FUN_1020_08a9(); + FUN_1020_100b(); + uVar4 = FUN_1020_1017(); + bVar7 = CARRY2(DAT_1028_1f26,uVar4); + DAT_1028_1f26 = DAT_1028_1f26 + uVar4; + DAT_1028_1f28 = DAT_1028_1f28 + iVar5 + (uint)bVar7; + iVar5 = param_3; + FUN_1020_08a9(); + FUN_1020_100b(); + uVar4 = FUN_1020_1017(); + bVar7 = CARRY2(DAT_1028_1f2a,uVar4); + DAT_1028_1f2a = DAT_1028_1f2a + uVar4; + DAT_1028_1f2c = DAT_1028_1f2c + iVar5 + (uint)bVar7; + iVar5 = param_3; + FUN_1020_08a9(); + FUN_1020_100b(); + uVar4 = FUN_1020_1017(); + bVar7 = CARRY2(DAT_1028_1f16,uVar4); + DAT_1028_1f16 = DAT_1028_1f16 + uVar4; + DAT_1028_1f18 = DAT_1028_1f18 + iVar5 + (uint)bVar7; + iVar5 = param_3; + FUN_1020_08a9(); + FUN_1020_100b(); + uVar4 = FUN_1020_1017(); + bVar7 = CARRY2(DAT_1028_1f1a,uVar4); + DAT_1028_1f1a = DAT_1028_1f1a + uVar4; + DAT_1028_1f1c = DAT_1028_1f1c + iVar5 + (uint)bVar7; + iVar5 = param_3; + FUN_1020_08a9(); + FUN_1020_100b(); + uVar4 = FUN_1020_1017(); + bVar7 = DAT_1028_1f1e < uVar4; + DAT_1028_1f1e = DAT_1028_1f1e - uVar4; + DAT_1028_1f20 = (DAT_1028_1f20 - iVar5) - (uint)bVar7; + iVar5 = param_3; + FUN_1020_08a9(); + FUN_1020_100b(); + uVar4 = FUN_1020_1017(); + bVar7 = DAT_1028_1f22 < uVar4; + DAT_1028_1f22 = DAT_1028_1f22 - uVar4; + DAT_1028_1f24 = (DAT_1028_1f24 - iVar5) - (uint)bVar7; + iVar5 = param_3; + FUN_1020_08a9(); + FUN_1020_100b(); + uVar4 = FUN_1020_1017(); + bVar7 = DAT_1028_1f79 < uVar4; + DAT_1028_1f79 = DAT_1028_1f79 - uVar4; + DAT_1028_1f7b = (DAT_1028_1f7b - iVar5) - (uint)bVar7; + iVar5 = param_3; + FUN_1020_08a9(); + FUN_1020_100b(); + uVar4 = FUN_1020_1017(); + bVar7 = CARRY2(DAT_1028_1f7d,uVar4); + DAT_1028_1f7d = DAT_1028_1f7d + uVar4; + DAT_1028_1f7f = DAT_1028_1f7f + iVar5 + (uint)bVar7; + iVar5 = param_3; + FUN_1020_08a9(); + FUN_1020_100b(); + uVar4 = FUN_1020_1017(); + bVar7 = DAT_1028_1f81 < uVar4; + DAT_1028_1f81 = DAT_1028_1f81 - uVar4; + DAT_1028_1f83 = (DAT_1028_1f83 - iVar5) - (uint)bVar7; + FUN_1020_08a9(); + FUN_1020_100b(); + uVar4 = FUN_1020_1017(); + bVar7 = CARRY2(DAT_1028_1f85,uVar4); + DAT_1028_1f85 = DAT_1028_1f85 + uVar4; + DAT_1028_1f87 = DAT_1028_1f87 + param_3 + (uint)bVar7; + if ((DAT_1028_1f7b < DAT_1028_1f83) || + ((DAT_1028_1f7b <= DAT_1028_1f83 && (DAT_1028_1f79 < DAT_1028_1f81)))) { + DAT_1028_1f6b = DAT_1028_1f7b - (uint)(DAT_1028_1f79 < 5000); + DAT_1028_1f73 = DAT_1028_1f83 + (uint)(0xec77 < DAT_1028_1f81); + uVar4 = DAT_1028_1f79; + uVar2 = DAT_1028_1f81; + } + else { + DAT_1028_1f6b = DAT_1028_1f83 - (uint)(DAT_1028_1f81 < 5000); + DAT_1028_1f73 = DAT_1028_1f7b + (uint)(0xec77 < DAT_1028_1f79); + uVar4 = DAT_1028_1f81; + uVar2 = DAT_1028_1f79; + } + DAT_1028_1f71 = uVar2 + 5000; + DAT_1028_1f69 = uVar4 + 0xec78; + if ((DAT_1028_1f7f < DAT_1028_1f87) || + ((DAT_1028_1f7f <= DAT_1028_1f87 && (DAT_1028_1f7d < DAT_1028_1f85)))) { + DAT_1028_1f6f = DAT_1028_1f7f - (uint)(DAT_1028_1f7d < 5000); + DAT_1028_1f77 = DAT_1028_1f87 + (uint)(0xec77 < DAT_1028_1f85); + uVar4 = DAT_1028_1f7d; + uVar2 = DAT_1028_1f85; + } + else { + DAT_1028_1f6f = DAT_1028_1f87 - (uint)(DAT_1028_1f85 < 5000); + DAT_1028_1f77 = DAT_1028_1f7f + (uint)(0xec77 < DAT_1028_1f7d); + uVar4 = DAT_1028_1f85; + uVar2 = DAT_1028_1f7d; + } + DAT_1028_1f75 = uVar2 + 5000; + DAT_1028_1f6d = uVar4 + 0xec78; + uVar1 = *(undefined4 *)(*(int *)(param_1 + 6) + 6); + if (*(int *)((int)uVar1 + 0xbd4) == 0) { + FUN_1008_08bb(0x34,0x2f,0x175,0x5d,uVar3); + } + else { + FUN_1008_0837(0x34,0x2f,0x175,0x5d,uVar3); + } + uVar6 = 0x1008; + FUN_1008_093f(0x34,0x2f,0x175,0x5d,uVar3); + } + else if (param_4 == '\x02') { + iVar5 = param_3; + uVar4 = FUN_1020_08a9(uVar8); + bVar7 = DAT_1028_245e < uVar4; + DAT_1028_245e = DAT_1028_245e - uVar4; + DAT_1028_2460 = (DAT_1028_2460 - iVar5) - (uint)bVar7; + iVar5 = param_3; + uVar4 = FUN_1020_08a9(); + bVar7 = CARRY2(DAT_1028_2462,uVar4); + DAT_1028_2462 = DAT_1028_2462 + uVar4; + DAT_1028_2464 = DAT_1028_2464 + iVar5 + (uint)bVar7; + iVar5 = param_3; + uVar4 = FUN_1020_08a9(); + bVar7 = DAT_1028_2456 < uVar4; + DAT_1028_2456 = DAT_1028_2456 - uVar4; + DAT_1028_2458 = (DAT_1028_2458 - iVar5) - (uint)bVar7; + iVar5 = param_3; + uVar4 = FUN_1020_08a9(); + bVar7 = CARRY2(DAT_1028_245a,uVar4); + DAT_1028_245a = DAT_1028_245a + uVar4; + DAT_1028_245c = DAT_1028_245c + iVar5 + (uint)bVar7; + if ((DAT_1028_2458 < DAT_1028_2460) || + ((DAT_1028_2458 <= DAT_1028_2460 && (DAT_1028_2456 < DAT_1028_245e)))) { + DAT_1028_2448 = DAT_1028_2458 - (uint)(DAT_1028_2456 < 5000); + DAT_1028_2450 = DAT_1028_2460 + (uint)(0xec77 < DAT_1028_245e); + uVar4 = DAT_1028_2456; + uVar2 = DAT_1028_245e; + } + else { + DAT_1028_2448 = DAT_1028_2460 - (uint)(DAT_1028_245e < 5000); + DAT_1028_2450 = DAT_1028_2458 + (uint)(0xec77 < DAT_1028_2456); + uVar4 = DAT_1028_245e; + uVar2 = DAT_1028_2456; + } + DAT_1028_244e = uVar2 + 5000; + DAT_1028_2446 = uVar4 + 0xec78; + if ((DAT_1028_245c < DAT_1028_2464) || + ((DAT_1028_245c <= DAT_1028_2464 && (DAT_1028_245a < DAT_1028_2462)))) { + DAT_1028_244c = DAT_1028_245c - (uint)(DAT_1028_245a < 5000); + DAT_1028_2454 = DAT_1028_2464 + (uint)(0xec77 < DAT_1028_2462); + uVar4 = DAT_1028_245a; + uVar2 = DAT_1028_2462; + } + else { + DAT_1028_244c = DAT_1028_2464 - (uint)(DAT_1028_2462 < 5000); + DAT_1028_2454 = DAT_1028_245c + (uint)(0xec77 < DAT_1028_245a); + uVar4 = DAT_1028_2462; + uVar2 = DAT_1028_245a; + } + DAT_1028_2452 = uVar2 + 5000; + DAT_1028_244a = uVar4 + 0xec78; + iVar5 = param_3; + uVar4 = FUN_1020_08a9(); + bVar7 = DAT_1028_2403 < uVar4; + DAT_1028_2403 = DAT_1028_2403 - uVar4; + DAT_1028_2405 = (DAT_1028_2405 - iVar5) - (uint)bVar7; + iVar5 = param_3; + uVar4 = FUN_1020_08a9(); + bVar7 = CARRY2(DAT_1028_2407,uVar4); + DAT_1028_2407 = DAT_1028_2407 + uVar4; + DAT_1028_2409 = DAT_1028_2409 + iVar5 + (uint)bVar7; + iVar5 = param_3; + uVar4 = FUN_1020_08a9(); + bVar7 = DAT_1028_23f3 < uVar4; + DAT_1028_23f3 = DAT_1028_23f3 - uVar4; + DAT_1028_23f5 = (DAT_1028_23f5 - iVar5) - (uint)bVar7; + iVar5 = param_3; + uVar4 = FUN_1020_08a9(); + bVar7 = CARRY2(DAT_1028_23f7,uVar4); + DAT_1028_23f7 = DAT_1028_23f7 + uVar4; + DAT_1028_23f9 = DAT_1028_23f9 + iVar5 + (uint)bVar7; + iVar5 = param_3; + uVar4 = FUN_1020_08a9(); + bVar7 = CARRY2(DAT_1028_23fb,uVar4); + DAT_1028_23fb = DAT_1028_23fb + uVar4; + DAT_1028_23fd = DAT_1028_23fd + iVar5 + (uint)bVar7; + iVar5 = param_3; + uVar4 = FUN_1020_08a9(); + bVar7 = DAT_1028_23ff < uVar4; + DAT_1028_23ff = DAT_1028_23ff - uVar4; + DAT_1028_2401 = (DAT_1028_2401 - iVar5) - (uint)bVar7; + iVar5 = param_3; + uVar4 = FUN_1020_08a9(); + bVar7 = CARRY2(DAT_1028_23b8,uVar4); + DAT_1028_23b8 = DAT_1028_23b8 + uVar4; + DAT_1028_23ba = DAT_1028_23ba + iVar5 + (uint)bVar7; + iVar5 = param_3; + uVar4 = FUN_1020_08a9(); + bVar7 = CARRY2(DAT_1028_23bc,uVar4); + DAT_1028_23bc = DAT_1028_23bc + uVar4; + DAT_1028_23be = DAT_1028_23be + iVar5 + (uint)bVar7; + iVar5 = param_3; + uVar4 = FUN_1020_08a9(); + bVar7 = CARRY2(DAT_1028_23b0,uVar4); + DAT_1028_23b0 = DAT_1028_23b0 + uVar4; + DAT_1028_23b2 = DAT_1028_23b2 + iVar5 + (uint)bVar7; + uVar4 = FUN_1020_08a9(); + bVar7 = CARRY2(DAT_1028_23b4,uVar4); + DAT_1028_23b4 = DAT_1028_23b4 + uVar4; + DAT_1028_23b6 = DAT_1028_23b6 + param_3 + (uint)bVar7; + if ((DAT_1028_23b2 < DAT_1028_23ba) || + ((DAT_1028_23b2 <= DAT_1028_23ba && (DAT_1028_23b0 < DAT_1028_23b8)))) { + DAT_1028_23a2 = DAT_1028_23b2 - (uint)(DAT_1028_23b0 < 5000); + DAT_1028_23aa = DAT_1028_23ba + (uint)(0xec77 < DAT_1028_23b8); + uVar4 = DAT_1028_23b0; + uVar2 = DAT_1028_23b8; + } + else { + DAT_1028_23a2 = DAT_1028_23ba - (uint)(DAT_1028_23b8 < 5000); + DAT_1028_23aa = DAT_1028_23b2 + (uint)(0xec77 < DAT_1028_23b0); + uVar4 = DAT_1028_23b8; + uVar2 = DAT_1028_23b0; + } + DAT_1028_23a8 = uVar2 + 5000; + DAT_1028_23a0 = uVar4 + 0xec78; + if ((DAT_1028_23b6 < DAT_1028_23be) || + ((DAT_1028_23b6 <= DAT_1028_23be && (DAT_1028_23b4 < DAT_1028_23bc)))) { + DAT_1028_23a6 = DAT_1028_23b6 - (uint)(DAT_1028_23b4 < 5000); + DAT_1028_23ae = DAT_1028_23be + (uint)(0xec77 < DAT_1028_23bc); + uVar4 = DAT_1028_23b4; + uVar2 = DAT_1028_23bc; + } + else { + DAT_1028_23a6 = DAT_1028_23be - (uint)(DAT_1028_23bc < 5000); + DAT_1028_23ae = DAT_1028_23b6 + (uint)(0xec77 < DAT_1028_23b4); + uVar4 = DAT_1028_23bc; + uVar2 = DAT_1028_23b4; + } + DAT_1028_23ac = uVar2 + 5000; + DAT_1028_23a4 = uVar4 + 0xec78; + uVar1 = *(undefined4 *)(*(int *)(param_1 + 6) + 6); + if (*(int *)((int)uVar1 + 0xbd6) == 0) { + FUN_1008_08bb(0x35,0x2d,0x174,0xaf,uVar3); + } + else { + FUN_1008_0837(0x35,0x2d,0x174,0xaf,uVar3); + } + uVar6 = 0x1008; + FUN_1008_093f(0x35,0x2d,0x174,0xaf,uVar3); + } + RELEASEDC(uVar6,uVar3); + return; +} + + +/* ===== 1000:99f0 FUN_1000_99f0 ===== */ + +void __stdcall16far FUN_1000_99f0(int param_1) + +{ + int iVar1; + undefined2 uVar2; + undefined2 unaff_SS; + + uVar2 = (undefined2)((ulong)*(undefined4 *)(param_1 + 6) >> 0x10); + iVar1 = (int)*(undefined4 *)(param_1 + 6); + if ((*(char *)(iVar1 + 0xbda) == '\0') || (*(int *)(iVar1 + 0xbd4) != 0)) { + uVar2 = (undefined2)((ulong)*(undefined4 *)(param_1 + 6) >> 0x10); + iVar1 = (int)*(undefined4 *)(param_1 + 6); + if ((*(char *)(iVar1 + 0xbda) == '\0') && (*(int *)(iVar1 + 0xbd4) != 0)) { + *(int *)(iVar1 + 0xbd4) = *(int *)(iVar1 + 0xbd4) + -1; + FUN_1000_7ed9(param_1,1,0,1,0); + FUN_1000_8b0d(&stack0xfffe,1,0,1); + } + } + else { + *(int *)(iVar1 + 0xbd4) = *(int *)(iVar1 + 0xbd4) + 1; + FUN_1000_7ed9(param_1,0xffff,0xffff,1,0); + FUN_1000_8b0d(&stack0xfffe,0xffff,0xffff,1); + } + uVar2 = (undefined2)((ulong)*(undefined4 *)(param_1 + 6) >> 0x10); + iVar1 = (int)*(undefined4 *)(param_1 + 6); + if ((*(char *)(iVar1 + 0xbdb) == '\0') || (*(int *)(iVar1 + 0xbd6) != 0)) { + uVar2 = (undefined2)((ulong)*(undefined4 *)(param_1 + 6) >> 0x10); + iVar1 = (int)*(undefined4 *)(param_1 + 6); + if ((*(char *)(iVar1 + 0xbdb) == '\0') && (*(int *)(iVar1 + 0xbd6) != 0)) { + *(int *)(iVar1 + 0xbd6) = *(int *)(iVar1 + 0xbd6) + -1; + FUN_1000_7ed9(param_1,1,0,2,0); + FUN_1000_8b0d(&stack0xfffe,1,0,2); + } + } + else { + *(int *)(iVar1 + 0xbd6) = *(int *)(iVar1 + 0xbd6) + 1; + FUN_1000_7ed9(param_1,0xffff,0xffff,2,0); + FUN_1000_8b0d(&stack0xfffe,0xffff,0xffff,2); + } + return; +} + + +/* ===== 1000:9ae0 FUN_1000_9ae0 ===== */ + +undefined2 __stdcall16far +FUN_1000_9ae0(int param_1,uint param_2,int param_3,uint param_4,int param_5,uint param_6,int param_7 + ,uint param_8,int param_9) + +{ + uint uVar1; + int iVar2; + undefined2 uVar3; + undefined2 unaff_SS; + undefined1 local_3; + + uVar3 = (undefined2)((ulong)*(undefined4 *)(param_1 + 6) >> 0x10); + iVar2 = (int)*(undefined4 *)(param_1 + 6); + uVar1 = *(uint *)(iVar2 + 0xbba); + iVar2 = *(int *)(iVar2 + 0xbbc); + if ((param_9 < iVar2) || ((param_9 <= iVar2 && (param_8 <= uVar1)))) { + uVar3 = (undefined2)((ulong)*(undefined4 *)(param_1 + 6) >> 0x10); + iVar2 = (int)*(undefined4 *)(param_1 + 6); + uVar1 = *(uint *)(iVar2 + 0xbbe); + iVar2 = *(int *)(iVar2 + 0xbc0); + if ((param_7 < iVar2) || ((param_7 <= iVar2 && (param_6 <= uVar1)))) { + uVar3 = (undefined2)((ulong)*(undefined4 *)(param_1 + 6) >> 0x10); + iVar2 = (int)*(undefined4 *)(param_1 + 6); + uVar1 = *(uint *)(iVar2 + 0xbba); + iVar2 = *(int *)(iVar2 + 0xbbc); + if ((iVar2 < param_5) || ((iVar2 <= param_5 && (uVar1 <= param_4)))) { + uVar3 = (undefined2)((ulong)*(undefined4 *)(param_1 + 6) >> 0x10); + iVar2 = (int)*(undefined4 *)(param_1 + 6); + uVar1 = *(uint *)(iVar2 + 0xbbe); + iVar2 = *(int *)(iVar2 + 0xbc0); + if ((iVar2 < param_3) || ((iVar2 <= param_3 && (uVar1 <= param_2)))) { + local_3 = 1; + goto LAB_1000_9b62; + } + } + } + } + local_3 = 0; +LAB_1000_9b62: + return CONCAT11((char)(uVar1 >> 8),local_3); +} + + +/* ===== 1000:9b69 FUN_1000_9b69 ===== */ + +undefined2 __stdcall16far +FUN_1000_9b69(undefined2 param_1,uint param_2,int param_3,uint param_4,int param_5,uint param_6, + int param_7,uint param_8,int param_9) + +{ + uint uVar1; + undefined1 local_3; + + uVar1 = DAT_1028_07db; + if ((param_9 < DAT_1028_07dd) || ((param_9 <= DAT_1028_07dd && (param_8 <= DAT_1028_07db)))) { + if ((param_7 < DAT_1028_07e1) || + ((uVar1 = DAT_1028_07df, param_7 <= DAT_1028_07e1 && + (uVar1 = DAT_1028_07df, param_6 <= DAT_1028_07df)))) { + if ((DAT_1028_07dd < param_5) || + ((uVar1 = DAT_1028_07db, DAT_1028_07dd <= param_5 && (DAT_1028_07db <= param_4)))) { + uVar1 = DAT_1028_07df; + if ((DAT_1028_07e1 < param_3) || ((DAT_1028_07e1 <= param_3 && (DAT_1028_07df <= param_2)))) + { + local_3 = 1; + goto LAB_1000_9bc3; + } + } + } + } + local_3 = 0; +LAB_1000_9bc3: + return CONCAT11((char)(uVar1 >> 8),local_3); +} + + +/* ===== 1000:9bca FUN_1000_9bca ===== */ + +void __stdcall16far FUN_1000_9bca(int param_1) + +{ + undefined2 uVar1; + undefined2 uVar2; + uint uVar3; + int iVar4; + int iVar5; + undefined2 unaff_CS; + undefined2 unaff_SS; + undefined2 uVar6; + undefined2 uVar7; + + uVar1 = *(undefined2 *)((int)*(undefined4 *)(param_1 + 6) + 4); + GETCLIENTRECT(unaff_CS,param_1 + -0x1a,unaff_SS); + uVar1 = GETDC(0x1228,*(undefined2 *)((int)*(undefined4 *)(param_1 + 6) + 4),uVar1); + *(undefined2 *)(param_1 + -0xc) = uVar1; + uVar1 = CREATECOMPATIBLEDC(0x1228,*(undefined2 *)(param_1 + -0xc)); + *(undefined2 *)(param_1 + -0xe) = uVar1; + uVar1 = CREATECOMPATIBLEDC(0x1228,*(undefined2 *)(param_1 + -0xc)); + *(undefined2 *)(param_1 + -0x10) = uVar1; + uVar1 = CREATECOMPATIBLEDC(0x1228,*(undefined2 *)(param_1 + -0xc)); + *(undefined2 *)(param_1 + -0x12) = uVar1; + uVar1 = *(undefined2 *)(param_1 + -0xc); + uVar2 = CREATECOMPATIBLEBITMAP(0x1228,100,100); + *(undefined2 *)(param_1 + -8) = uVar2; + iVar4 = DAT_1028_07d5 + (uint)(0xfe0b < DAT_1028_07d3); + uVar3 = FUN_1020_08e6(uVar1); + uVar1 = (undefined2)((ulong)*(undefined4 *)(param_1 + 6) >> 0x10); + iVar5 = (int)*(undefined4 *)(param_1 + 6); + *(int *)(iVar5 + 0xba2) = uVar3 - 8; + *(int *)(iVar5 + 0xba4) = iVar4 - (uint)(uVar3 < 8); + iVar4 = DAT_1028_07d9 + (uint)(0xfe0b < DAT_1028_07d7); + uVar3 = FUN_1020_08e6(); + uVar1 = (undefined2)((ulong)*(undefined4 *)(param_1 + 6) >> 0x10); + iVar5 = (int)*(undefined4 *)(param_1 + 6); + *(int *)(iVar5 + 0xba6) = uVar3 - 8; + *(int *)(iVar5 + 0xba8) = iVar4 - (uint)(uVar3 < 8); + *(int *)(param_1 + -0x20) = *(int *)(iVar5 + 0xba2) + -1; + *(undefined2 *)(param_1 + -0x1c) = 1; + *(int *)(param_1 + -0x22) = *(int *)((int)*(undefined4 *)(param_1 + 6) + 0xba6) + -1; + *(undefined2 *)(param_1 + -0x1e) = 1; + *(undefined2 *)(param_1 + -0x28) = 0x13; + *(undefined2 *)(param_1 + -0x2a) = 0x13; + uVar1 = SELECTOBJECT(0x1020,DAT_1028_085b); + *(undefined2 *)(param_1 + -2) = uVar1; + uVar1 = SELECTOBJECT(0x1228,*(undefined2 *)(param_1 + -8)); + *(undefined2 *)(param_1 + -4) = uVar1; + BITBLT(0x1228,0x20,0xcc,*(undefined2 *)(param_1 + -0x22),*(undefined2 *)(param_1 + -0x20), + *(undefined2 *)(param_1 + -0xe),*(undefined2 *)(param_1 + -0x2a), + *(undefined2 *)(param_1 + -0x28),0,0); + SELECTOBJECT(0x1228,*(undefined2 *)((int)*(undefined4 *)(param_1 + 6) + 0x54)); + BITBLT(0x1228,0xc6,0x88,0,0,*(undefined2 *)(param_1 + -0xe),0x13,0x13, + *(undefined2 *)(param_1 + -0x1e),*(undefined2 *)(param_1 + -0x1c)); + SELECTOBJECT(0x1228,*(undefined2 *)((int)*(undefined4 *)(param_1 + 6) + 0x52)); + BITBLT(0x1228,0x86,0xee,0,0,*(undefined2 *)(param_1 + -0xe),0x13,0x13, + *(undefined2 *)(param_1 + -0x1e),*(undefined2 *)(param_1 + -0x1c)); + if (0x1ba < *(int *)(param_1 + -0x22) + *(int *)(param_1 + -0x2a)) { + if (*(int *)(param_1 + -0x22) < 0x1bb) { + *(int *)(param_1 + -0x2a) = 0x1bb - *(int *)(param_1 + -0x22); + } + else { + *(undefined2 *)(param_1 + -0x2a) = 0; + } + } + uVar1 = *(undefined2 *)(param_1 + -0xc); + BITBLT(0x1228,0x20,0xcc,0,0,*(undefined2 *)(param_1 + -0x10),*(undefined2 *)(param_1 + -0x2a), + *(undefined2 *)(param_1 + -0x28),*(undefined2 *)(param_1 + -0x22), + *(undefined2 *)(param_1 + -0x20)); + uVar2 = *(undefined2 *)(param_1 + -0xe); + SELECTOBJECT(0x1228,*(undefined2 *)(param_1 + -2)); + uVar7 = *(undefined2 *)(param_1 + -0x10); + SELECTOBJECT(0x1228,*(undefined2 *)(param_1 + -4)); + uVar6 = *(undefined2 *)(param_1 + -0x12); + SELECTOBJECT(0x1228,*(undefined2 *)(param_1 + -6)); + DELETEOBJECT(0x1228,*(undefined2 *)(param_1 + -8),uVar6,uVar7,uVar2,uVar1); + DELETEDC(0x1228,*(undefined2 *)(param_1 + -0xe)); + DELETEDC(0x1228,*(undefined2 *)(param_1 + -0x10)); + DELETEDC(0x1228,*(undefined2 *)(param_1 + -0x12)); + RELEASEDC(0x1228,*(undefined2 *)(param_1 + -0xc)); + return; +} + + +/* ===== 1000:9e85 FUN_1000_9e85 ===== */ + +void __stdcall16far FUN_1000_9e85(int param_1) + +{ + int iVar1; + undefined2 uVar2; + undefined2 unaff_SS; + + if ((((DAT_1028_3371 != 0) && (DAT_1028_33c4 != 0)) && (DAT_1028_3417 != 0)) && + ((DAT_1028_346a != 0 && (DAT_1028_34bd != 0)))) { + DAT_1028_0851 = 0; + DAT_1028_0853 = 0; + DAT_1028_07c8 = 1; + *(undefined1 *)((int)*(undefined4 *)(param_1 + 6) + 0xbdd) = 0; + } + DAT_1028_07c6 = 0; + uVar2 = (undefined2)((ulong)*(undefined4 *)(param_1 + 6) >> 0x10); + iVar1 = (int)*(undefined4 *)(param_1 + 6); + *(undefined2 *)(iVar1 + 0x5e) = 0; + DAT_1028_07d3 = 0xf588; + DAT_1028_07d5 = 4; + DAT_1028_07d7 = 0x4d48; + DAT_1028_07d9 = 6; + *(undefined2 *)(iVar1 + 0xbba) = 0xf588; + *(undefined2 *)(iVar1 + 0xbbc) = 4; + *(undefined2 *)(iVar1 + 0xbbe) = 0x4d48; + *(undefined2 *)(iVar1 + 0xbc0) = 6; + *(undefined2 *)(iVar1 + 0xbc2) = 0xf588; + *(undefined2 *)(iVar1 + 0xbc4) = 4; + *(undefined2 *)(iVar1 + 0xbc6) = 0x4d48; + *(undefined2 *)(iVar1 + 0xbc8) = 6; + *(undefined2 *)(iVar1 + 0xbae) = 0; + *(undefined2 *)(iVar1 + 0xbb0) = 0; + *(undefined2 *)(iVar1 + 0xbaa) = 0; + *(undefined2 *)(iVar1 + 0xbac) = 0; + *(undefined2 *)(iVar1 + 0xbce) = 0; + *(undefined2 *)(iVar1 + 0xbd0) = 0; + *(undefined2 *)(iVar1 + 0xbd2) = 0; + *(undefined2 *)(iVar1 + 0xbca) = 0; + *(undefined2 *)(iVar1 + 0xbcc) = 0; + *(undefined1 *)(iVar1 + 0xbdd) = 0; + FUN_1000_9bca(param_1); + return; +} + + +/* ===== 1000:9f73 FUN_1000_9f73 ===== */ + +void __stdcall16far FUN_1000_9f73(int param_1) + +{ + undefined2 uVar1; + undefined2 uVar2; + uint uVar3; + int iVar4; + int iVar5; + undefined2 unaff_CS; + undefined2 unaff_SS; + undefined2 uVar6; + undefined2 uVar7; + + uVar1 = *(undefined2 *)((int)*(undefined4 *)(param_1 + 6) + 4); + GETCLIENTRECT(unaff_CS,param_1 + -0x1a,unaff_SS); + uVar1 = GETDC(0x1228,*(undefined2 *)((int)*(undefined4 *)(param_1 + 6) + 4),uVar1); + *(undefined2 *)(param_1 + -0xc) = uVar1; + uVar1 = CREATECOMPATIBLEDC(0x1228,*(undefined2 *)(param_1 + -0xc)); + *(undefined2 *)(param_1 + -0xe) = uVar1; + uVar1 = CREATECOMPATIBLEDC(0x1228,*(undefined2 *)(param_1 + -0xc)); + *(undefined2 *)(param_1 + -0x10) = uVar1; + uVar1 = CREATECOMPATIBLEDC(0x1228,*(undefined2 *)(param_1 + -0xc)); + *(undefined2 *)(param_1 + -0x12) = uVar1; + uVar1 = *(undefined2 *)(param_1 + -0xc); + uVar2 = CREATECOMPATIBLEBITMAP(0x1228,100,100); + *(undefined2 *)(param_1 + -8) = uVar2; + iVar4 = DAT_1028_07d5 + (uint)(0xfe0b < DAT_1028_07d3); + uVar3 = FUN_1020_08e6(uVar1); + uVar1 = (undefined2)((ulong)*(undefined4 *)(param_1 + 6) >> 0x10); + iVar5 = (int)*(undefined4 *)(param_1 + 6); + *(int *)(iVar5 + 0xba2) = uVar3 - 8; + *(int *)(iVar5 + 0xba4) = iVar4 - (uint)(uVar3 < 8); + iVar4 = DAT_1028_07d9 + (uint)(0xfe0b < DAT_1028_07d7); + uVar3 = FUN_1020_08e6(); + uVar1 = (undefined2)((ulong)*(undefined4 *)(param_1 + 6) >> 0x10); + iVar5 = (int)*(undefined4 *)(param_1 + 6); + *(int *)(iVar5 + 0xba6) = uVar3 - 8; + *(int *)(iVar5 + 0xba8) = iVar4 - (uint)(uVar3 < 8); + iVar4 = (DAT_1028_07d5 - *(int *)(iVar5 + 0xbc4)) - + (uint)(DAT_1028_07d3 < *(uint *)(iVar5 + 0xbc2)); + uVar1 = FUN_1020_08e6(); + uVar2 = (undefined2)((ulong)*(undefined4 *)(param_1 + 6) >> 0x10); + iVar5 = (int)*(undefined4 *)(param_1 + 6); + *(undefined2 *)(iVar5 + 0xbb2) = uVar1; + *(int *)(iVar5 + 0xbb4) = iVar4; + iVar4 = (DAT_1028_07d9 - *(int *)(iVar5 + 0xbc8)) - + (uint)(DAT_1028_07d7 < *(uint *)(iVar5 + 0xbc6)); + uVar1 = FUN_1020_08e6(); + uVar2 = (undefined2)((ulong)*(undefined4 *)(param_1 + 6) >> 0x10); + iVar5 = (int)*(undefined4 *)(param_1 + 6); + *(undefined2 *)(iVar5 + 0xbb6) = uVar1; + *(int *)(iVar5 + 3000) = iVar4; + if ((*(int *)(iVar5 + 0xbb4) < 1) && + ((*(int *)(iVar5 + 0xbb4) < 0 || (*(int *)(iVar5 + 0xbb2) == 0)))) { + *(int *)(param_1 + -0x20) = *(int *)((int)*(undefined4 *)(param_1 + 6) + 0xba2) + -1; + *(undefined2 *)(param_1 + -0x1c) = 1; + } + else { + uVar1 = (undefined2)((ulong)*(undefined4 *)(param_1 + 6) >> 0x10); + iVar4 = (int)*(undefined4 *)(param_1 + 6); + *(int *)(param_1 + -0x20) = (*(int *)(iVar4 + 0xba2) - *(int *)(iVar4 + 0xbb2)) + -1; + *(int *)(param_1 + -0x1c) = *(int *)((int)*(undefined4 *)(param_1 + 6) + 0xbb2) + 1; + } + uVar1 = (undefined2)((ulong)*(undefined4 *)(param_1 + 6) >> 0x10); + iVar5 = (int)*(undefined4 *)(param_1 + 6); + iVar4 = *(int *)(iVar5 + 3000); + if ((iVar4 < 1) && ((iVar4 < 0 || (*(int *)(iVar5 + 0xbb6) == 0)))) { + *(int *)(param_1 + -0x22) = *(int *)((int)*(undefined4 *)(param_1 + 6) + 0xba6) + -1; + *(undefined2 *)(param_1 + -0x1e) = 1; + } + else { + uVar1 = (undefined2)((ulong)*(undefined4 *)(param_1 + 6) >> 0x10); + iVar4 = (int)*(undefined4 *)(param_1 + 6); + *(int *)(param_1 + -0x22) = (*(int *)(iVar4 + 0xba6) - *(int *)(iVar4 + 0xbb6)) + -1; + *(int *)(param_1 + -0x1e) = *(int *)((int)*(undefined4 *)(param_1 + 6) + 0xbb6) + 1; + } + uVar1 = (undefined2)((ulong)*(undefined4 *)(param_1 + 6) >> 0x10); + iVar5 = (int)*(undefined4 *)(param_1 + 6); + iVar4 = *(int *)(iVar5 + 0xbb2); + if (*(int *)(iVar5 + 0xbb4) < 0) { + iVar4 = -iVar4; + } + *(int *)(param_1 + -0x28) = iVar4 + 0x13; + uVar1 = (undefined2)((ulong)*(undefined4 *)(param_1 + 6) >> 0x10); + iVar5 = (int)*(undefined4 *)(param_1 + 6); + iVar4 = *(int *)(iVar5 + 0xbb6); + if (*(int *)(iVar5 + 3000) < 0) { + iVar4 = -iVar4; + } + *(int *)(param_1 + -0x2a) = iVar4 + 0x13; + uVar1 = SELECTOBJECT(0x1020,DAT_1028_085b); + *(undefined2 *)(param_1 + -2) = uVar1; + uVar1 = SELECTOBJECT(0x1228,*(undefined2 *)(param_1 + -8)); + *(undefined2 *)(param_1 + -4) = uVar1; + BITBLT(0x1228,0x20,0xcc,*(undefined2 *)(param_1 + -0x22),*(undefined2 *)(param_1 + -0x20), + *(undefined2 *)(param_1 + -0xe),*(undefined2 *)(param_1 + -0x2a), + *(undefined2 *)(param_1 + -0x28),0,0); + SELECTOBJECT(0x1228,*(undefined2 *)((int)*(undefined4 *)(param_1 + 6) + 0x54)); + BITBLT(0x1228,0xc6,0x88,0,0,*(undefined2 *)(param_1 + -0xe),0x13,0x13, + *(undefined2 *)(param_1 + -0x1e),*(undefined2 *)(param_1 + -0x1c)); + SELECTOBJECT(0x1228,*(undefined2 *)((int)*(undefined4 *)(param_1 + 6) + 0x52)); + BITBLT(0x1228,0x86,0xee,0,0,*(undefined2 *)(param_1 + -0xe),0x13,0x13, + *(undefined2 *)(param_1 + -0x1e),*(undefined2 *)(param_1 + -0x1c)); + if (0x1ba < *(int *)(param_1 + -0x22) + *(int *)(param_1 + -0x2a)) { + if (*(int *)(param_1 + -0x22) < 0x1bb) { + *(int *)(param_1 + -0x2a) = 0x1bb - *(int *)(param_1 + -0x22); + } + else { + *(undefined2 *)(param_1 + -0x2a) = 0; + } + } + uVar1 = *(undefined2 *)(param_1 + -0xc); + BITBLT(0x1228,0x20,0xcc,0,0,*(undefined2 *)(param_1 + -0x10),*(undefined2 *)(param_1 + -0x2a), + *(undefined2 *)(param_1 + -0x28),*(undefined2 *)(param_1 + -0x22), + *(undefined2 *)(param_1 + -0x20)); + uVar2 = *(undefined2 *)(param_1 + -0xe); + SELECTOBJECT(0x1228,*(undefined2 *)(param_1 + -2)); + uVar7 = *(undefined2 *)(param_1 + -0x10); + SELECTOBJECT(0x1228,*(undefined2 *)(param_1 + -4)); + uVar6 = *(undefined2 *)(param_1 + -0x12); + SELECTOBJECT(0x1228,*(undefined2 *)(param_1 + -6)); + DELETEOBJECT(0x1228,*(undefined2 *)(param_1 + -8),uVar6,uVar7,uVar2,uVar1); + DELETEDC(0x1228,*(undefined2 *)(param_1 + -0xe)); + DELETEDC(0x1228,*(undefined2 *)(param_1 + -0x10)); + DELETEDC(0x1228,*(undefined2 *)(param_1 + -0x12)); + RELEASEDC(0x1228,*(undefined2 *)(param_1 + -0xc)); + return; +} + + +/* ===== 1000:a38e FUN_1000_a38e ===== */ + +void __stdcall16far FUN_1000_a38e(int param_1,char param_2) + +{ + undefined2 uVar1; + undefined2 uVar2; + uint uVar3; + int iVar4; + int iVar5; + undefined2 unaff_CS; + undefined2 unaff_SS; + undefined2 uVar6; + + uVar1 = *(undefined2 *)((int)*(undefined4 *)(param_1 + 6) + 4); + GETCLIENTRECT(unaff_CS,param_1 + -0x1a,unaff_SS); + uVar1 = GETDC(0x1228,*(undefined2 *)((int)*(undefined4 *)(param_1 + 6) + 4),uVar1); + *(undefined2 *)(param_1 + -0xc) = uVar1; + uVar1 = CREATECOMPATIBLEDC(0x1228,*(undefined2 *)(param_1 + -0xc)); + *(undefined2 *)(param_1 + -0xe) = uVar1; + uVar1 = CREATECOMPATIBLEDC(0x1228,*(undefined2 *)(param_1 + -0xc)); + *(undefined2 *)(param_1 + -0x10) = uVar1; + uVar1 = CREATECOMPATIBLEDC(0x1228,*(undefined2 *)(param_1 + -0xc)); + *(undefined2 *)(param_1 + -0x12) = uVar1; + uVar1 = *(undefined2 *)(param_1 + -0xc); + uVar2 = CREATECOMPATIBLEBITMAP(0x1228,100,100); + *(undefined2 *)(param_1 + -8) = uVar2; + uVar2 = (undefined2)((ulong)*(undefined4 *)(param_1 + 6) >> 0x10); + iVar4 = (int)*(undefined4 *)(param_1 + 6); + iVar4 = *(int *)(iVar4 + 0xbc4) + (uint)(0xfe0b < *(uint *)(iVar4 + 0xbc2)); + uVar3 = FUN_1020_08e6(uVar1); + uVar1 = (undefined2)((ulong)*(undefined4 *)(param_1 + 6) >> 0x10); + iVar5 = (int)*(undefined4 *)(param_1 + 6); + *(int *)(iVar5 + 0xba2) = uVar3 - 8; + *(int *)(iVar5 + 0xba4) = iVar4 - (uint)(uVar3 < 8); + iVar4 = *(int *)(iVar5 + 0xbc8) + (uint)(0xfe0b < *(uint *)(iVar5 + 0xbc6)); + uVar3 = FUN_1020_08e6(); + uVar1 = (undefined2)((ulong)*(undefined4 *)(param_1 + 6) >> 0x10); + iVar5 = (int)*(undefined4 *)(param_1 + 6); + *(int *)(iVar5 + 0xba6) = uVar3 - 8; + *(int *)(iVar5 + 0xba8) = iVar4 - (uint)(uVar3 < 8); + *(int *)(param_1 + -0x20) = *(int *)(iVar5 + 0xba2) + -1; + *(undefined2 *)(param_1 + -0x1c) = 1; + *(int *)(param_1 + -0x22) = *(int *)((int)*(undefined4 *)(param_1 + 6) + 0xba6) + -1; + *(undefined2 *)(param_1 + -0x1e) = 1; + *(undefined2 *)(param_1 + -0x28) = 0x13; + *(undefined2 *)(param_1 + -0x2a) = 0x13; + uVar1 = (undefined2)((ulong)*(undefined4 *)(param_1 + 6) >> 0x10); + iVar4 = (int)*(undefined4 *)(param_1 + 6); + *(undefined2 *)(iVar4 + 0xbaa) = 0; + *(undefined2 *)(iVar4 + 0xbac) = 0; + *(undefined2 *)(iVar4 + 0xbae) = 0; + *(undefined2 *)(iVar4 + 0xbb0) = 0; + uVar1 = SELECTOBJECT(0x1020,DAT_1028_085b); + *(undefined2 *)(param_1 + -2) = uVar1; + uVar1 = SELECTOBJECT(0x1228,*(undefined2 *)(param_1 + -8)); + *(undefined2 *)(param_1 + -4) = uVar1; + BITBLT(0x1228,0x20,0xcc,*(undefined2 *)(param_1 + -0x22),*(undefined2 *)(param_1 + -0x20), + *(undefined2 *)(param_1 + -0xe),*(undefined2 *)(param_1 + -0x2a), + *(undefined2 *)(param_1 + -0x28),0,0); + if (0x1ba < *(int *)(param_1 + -0x22) + *(int *)(param_1 + -0x2a)) { + if (*(int *)(param_1 + -0x22) < 0x1bb) { + *(int *)(param_1 + -0x2a) = 0x1bb - *(int *)(param_1 + -0x22); + } + else { + *(undefined2 *)(param_1 + -0x2a) = 0; + } + } + if (param_2 == '\0') { + BITBLT(0x1228,0x20,0xcc,0,0,*(undefined2 *)(param_1 + -0x10),*(undefined2 *)(param_1 + -0x2a), + *(undefined2 *)(param_1 + -0x28),*(undefined2 *)(param_1 + -0x22), + *(undefined2 *)(param_1 + -0x20)); + } + uVar1 = *(undefined2 *)(param_1 + -0xe); + SELECTOBJECT(0x1228,*(undefined2 *)(param_1 + -2)); + uVar2 = *(undefined2 *)(param_1 + -0x10); + SELECTOBJECT(0x1228,*(undefined2 *)(param_1 + -4)); + uVar6 = *(undefined2 *)(param_1 + -0x12); + SELECTOBJECT(0x1228,*(undefined2 *)(param_1 + -6)); + DELETEOBJECT(0x1228,*(undefined2 *)(param_1 + -8),uVar6,uVar2,uVar1); + DELETEDC(0x1228,*(undefined2 *)(param_1 + -0xe)); + DELETEDC(0x1228,*(undefined2 *)(param_1 + -0x10)); + DELETEDC(0x1228,*(undefined2 *)(param_1 + -0x12)); + RELEASEDC(0x1228,*(undefined2 *)(param_1 + -0xc)); + return; +} + + +/* ===== 1000:a604 FUN_1000_a604 ===== */ + +void __stdcall16far FUN_1000_a604(int param_1) + +{ + uint uVar1; + undefined2 uVar2; + int iVar3; + int iVar4; + int iVar5; + int iVar6; + int iVar7; + undefined2 unaff_SS; + bool bVar8; + undefined2 uVar9; + uint local_16; + int local_14; + + uVar9 = *(undefined2 *)((int)*(undefined4 *)(param_1 + 6) + 4); + uVar2 = GETDC(); + local_16 = 1; + local_14 = 0; + while( true ) { + iVar3 = FUN_1020_08a9(uVar9,uVar2); + iVar4 = iVar3 + 0x187; + iVar3 = iVar3 + 0x18b; + iVar5 = (DAT_1028_07d1 - 1) * 0x2c; + iVar6 = iVar5 + 0x12a; + iVar5 = iVar5 + 0x12e; + uVar1 = *(uint *)((uint)DAT_1028_07d1 * 2 + 0x81f); + iVar7 = (int)uVar1 >> 0xf; + if ((local_14 < iVar7) || ((local_14 <= iVar7 && (local_16 <= uVar1)))) { + FUN_1008_0837((iVar5 - iVar6) + 1,(iVar3 - iVar4) + 1,iVar6,iVar4,uVar2); + } + else { + FUN_1008_08bb((iVar5 - iVar6) + 1,(iVar3 - iVar4) + 1,iVar6,iVar4,uVar2); + } + FUN_1008_093f((iVar5 - iVar6) + 1,(iVar3 - iVar4) + 1,iVar6,iVar4,uVar2); + if ((local_14 == 0) && (local_16 == 6)) break; + bVar8 = 0xfffe < local_16; + local_16 = local_16 + 1; + local_14 = local_14 + (uint)bVar8; + } + RELEASEDC(0x1008,uVar2); + return; +} + + +/* ===== 1000:a70e FUN_1000_a70e ===== */ + +void __stdcall16far FUN_1000_a70e(int param_1) + +{ + undefined2 unaff_SS; + + DAT_1028_07d0 = 0; + *(undefined1 *)((int)*(undefined4 *)(param_1 + 6) + 0xbde) = 1; + DAT_1028_07c9 = 1; + return; +} + + +/* ===== 1000:a72c FUN_1000_a72c ===== */ + +void __stdcall16far FUN_1000_a72c(int param_1) + +{ + undefined2 unaff_SS; + byte local_4; + byte local_3; + + local_3 = 1; + while( true ) { + FUN_1000_7e12(param_1,local_3); + for (local_4 = 1; + *(undefined2 *) + ((int)*(undefined4 *)(param_1 + 6) + (uint)local_4 * 0x15e + (uint)local_3 * 2 + 0x36c) = + *(undefined2 *)((uint)local_3 * 0x53 + 0x99e), local_4 != 4; local_4 = local_4 + 1) { + } + if (local_3 == 0xaf) break; + local_3 = local_3 + 1; + } + for (local_3 = 1; FUN_1000_b3f3(param_1,local_3 + 1000), local_3 != 5; local_3 = local_3 + 1) { + } + FUN_1000_bda2(param_1,0,0); + DAT_1028_0874 = 0; + local_3 = 1; + while( true ) { + if (local_3 <= DAT_1028_07d0) { + DAT_1028_07d1 = local_3; + *(undefined2 *)((uint)local_3 * 4 + 0x97e) = 0; + *(undefined2 *)((uint)local_3 * 4 + 0x980) = 0; + *(undefined2 *)((uint)local_3 * 4 + 0x98e) = 0; + *(undefined2 *)((uint)local_3 * 4 + 0x990) = 0; + *(undefined1 *)(local_3 + 0x9a1) = 1; + *(undefined2 *)((uint)local_3 * 2 + 0x9a4) = 0; + FUN_1000_bc36(param_1,0,0); + *(undefined1 *)(local_3 + 0x816) = 1; + if (local_3 < 2) { + *(undefined2 *)((uint)local_3 * 2 + 0x81f) = 2; + } + else { + *(undefined2 *)((uint)local_3 * 2 + 0x81f) = 3; + } + FUN_1000_a604(param_1); + *(undefined2 *)((uint)local_3 * 4 + 0x835) = 1; + *(undefined2 *)((uint)local_3 * 4 + 0x837) = 0; + *(undefined1 *)(local_3 + 0x81a) = 1; + for (local_4 = 1; + *(undefined1 *) + ((int)*(undefined4 *)(param_1 + 6) + (uint)local_3 * 0x14 + (uint)local_4 + 0x467) = 0, + local_4 != 0x14; local_4 = local_4 + 1) { + } + } + if (local_3 == 4) break; + local_3 = local_3 + 1; + } + DAT_1028_07d1 = 1; + DAT_1028_07d2 = 0; + for (local_4 = '\x01'; FUN_1000_7e92(param_1,local_4), local_4 != '\x14'; + local_4 = local_4 + '\x01') { + } + return; +} + + +/* ===== 1000:a8ea FUN_1000_a8ea ===== */ + +void __stdcall16far FUN_1000_a8ea(void) + +{ + uint uVar1; + int iVar2; + undefined2 unaff_SS; + uint auStack_32 [22]; + int local_6; + int local_4; + + local_6 = _LCREAT(); + if (local_6 != -1) { + FUN_1020_16c9(); + local_4 = 1; + while( true ) { + iVar2 = local_4; + uVar1 = *(uint *)(local_4 * 4 + 0x87c); + auStack_32[local_4 * 2] = + *(uint *)(local_4 * 4 + 0x87a) ^ s_IWIKTDK_Highscores_1028_0010._0_2_; + auStack_32[iVar2 * 2 + 1] = uVar1 ^ s_IWIKTDK_Highscores_1028_0010._2_2_; + FUN_1008_2ee5(); + if (local_4 == 10) break; + local_4 = local_4 + 1; + } + _LWRITE(); + _LWRITE(); + _LWRITE(); + _LCLOSE(); + } + return; +} + + +/* ===== 1000:a99c FUN_1000_a99c ===== */ + +void __stdcall16far FUN_1000_a99c(void) + +{ + undefined2 uVar1; + uint uVar2; + undefined2 uVar3; + undefined2 unaff_CS; + undefined2 uVar4; + undefined2 unaff_SS; + undefined1 uVar5; + undefined1 *puVar6; + undefined1 *puVar7; + int iVar8; + undefined2 uVar9; + undefined1 local_23f [256]; + undefined1 local_13f [252]; + uint auStack_43 [22]; + undefined1 local_17 [16]; + char local_7; + int local_6; + int local_4; + + local_7 = '\0'; + uVar9 = 0x1028; + iVar8 = 800; + local_6 = _LOPEN(unaff_CS,0,800); + if (local_6 == -1) { + iVar8 = 0x1028; + local_6 = _LOPEN(0x1228,0x40,800); + } + uVar5 = local_6 == -1; + if (!(bool)uVar5) { + _LREAD(0x1228,0x10,local_17,unaff_SS); + puVar7 = local_13f; + uVar3 = unaff_SS; + FUN_1020_0b00(0x10,local_17,unaff_SS); + puVar6 = local_23f; + uVar1 = unaff_SS; + FUN_1020_0b00(0x10,0x14,0x1028); + uVar4 = 0x1020; + FUN_1020_0ac3(puVar6,uVar1,puVar7,uVar3); + if ((bool)uVar5) { + local_7 = '\x01'; + _LREAD(0x1020,0x28,auStack_43 + 2,unaff_SS); + uVar4 = 0x1228; + _LREAD(0x1228,0xdc,0x8a6,0x1028); + local_4 = 1; + while( true ) { + uVar2 = auStack_43[local_4 * 2 + 1] ^ s_IWIKTDK_Highscores_1028_0010._2_2_; + *(uint *)(local_4 * 4 + 0x87a) = + auStack_43[local_4 * 2] ^ s_IWIKTDK_Highscores_1028_0010._0_2_; + *(uint *)(local_4 * 4 + 0x87c) = uVar2; + if (local_4 == 10) break; + local_4 = local_4 + 1; + } + } + iVar8 = local_6; + _LCLOSE(uVar4,local_6); + } + if (local_7 == '\0') { + local_4 = 1; + while( true ) { + uVar3 = 0; + uVar1 = FUN_1020_08a9(iVar8,uVar9); + *(undefined2 *)(local_4 * 4 + 0x87a) = uVar1; + *(undefined2 *)(local_4 * 4 + 0x87c) = uVar3; + if (local_4 == 10) break; + local_4 = local_4 + 1; + } + FUN_1008_2ee5(0x32d,0x1028,0x8a6,0x1028); + FUN_1008_2ee5(0x32d,0x1028,0x8bc,0x1028); + FUN_1008_2ee5(0x32d,0x1028,0x8d2,0x1028); + FUN_1008_2ee5(0x32d,0x1028,0x8e8,0x1028); + FUN_1008_2ee5(0x32d,0x1028,0x8fe,0x1028); + FUN_1008_2ee5(0x32d,0x1028,0x914,0x1028); + FUN_1008_2ee5(0x32d,0x1028,0x92a,0x1028); + FUN_1008_2ee5(0x32d,0x1028,0x940,0x1028); + FUN_1008_2ee5(0x32d,0x1028,0x956,0x1028); + FUN_1008_2ee5(0x32d,0x1028,0x96c,0x1028); + } + return; +} + + +/* ===== 1000:ab3c FUN_1000_ab3c ===== */ + +void __stdcall16far FUN_1000_ab3c(int param_1) + +{ + int iVar1; + undefined2 uVar2; + undefined2 unaff_SS; + undefined4 uVar3; + + if (DAT_1028_07d2 != 0) { + FUN_1008_2ee5(0x336,0x1028,(uint)DAT_1028_07d2 * 0x16 + 0x890,0x1028); + uVar3 = FUN_1008_1607(0,0,0x1ce,0x16,(uint)DAT_1028_07d2 * 0x16 + 0x890,0x1028,0x373,0x1028, + 0x349,0x1028,(int)*(undefined4 *)(param_1 + 6), + (int)((ulong)*(undefined4 *)(param_1 + 6) >> 0x10)); + (*(code *)*(undefined2 *)(*DAT_1028_064e + 0x38)) + (0x1008,(int *)DAT_1028_064e,(int)((ulong)DAT_1028_064e >> 0x10),uVar3); + } + uVar3 = FUN_1000_5aea(0,0,0x10e,0x38b,0x1028,(int)*(undefined4 *)(param_1 + 6), + (int)((ulong)*(undefined4 *)(param_1 + 6) >> 0x10)); + uVar3 = (*(code *)*(undefined2 *)(*DAT_1028_064e + 0x34)) + (0x1000,(int *)DAT_1028_064e,(int)((ulong)DAT_1028_064e >> 0x10),uVar3); + uVar2 = (undefined2)((ulong)*(undefined4 *)(param_1 + 6) >> 0x10); + iVar1 = (int)*(undefined4 *)(param_1 + 6); + *(undefined2 *)(iVar1 + 0x41) = (int)uVar3; + *(undefined2 *)(iVar1 + 0x43) = (int)((ulong)uVar3 >> 0x10); + FUN_1018_0e9e((int)*(undefined4 *)(iVar1 + 0x41), + (int)((ulong)*(undefined4 *)(iVar1 + 0x41) >> 0x10),1); + return; +} + + +/* ===== 1000:abe5 FUN_1000_abe5 ===== */ + +void __stdcall16far FUN_1000_abe5(undefined2 param_1) + +{ + int iVar1; + undefined2 uVar2; + int iVar3; + uint local_8; + int local_6; + + local_6 = 1; + while( true ) { + iVar3 = *(int *)((uint)DAT_1028_07d1 * 4 + 0x980); + iVar1 = *(int *)(local_6 * 4 + 0x87c); + if ((iVar1 < iVar3) || + ((iVar1 <= iVar3 && + (*(uint *)(local_6 * 4 + 0x87a) < *(uint *)((uint)DAT_1028_07d1 * 4 + 0x97e))))) break; + if (local_6 == 10) { + return; + } + local_6 = local_6 + 1; + } + if (local_6 + 1U < 0xb) { + local_8 = 10; + while( true ) { + iVar3 = (local_8 - 1) * 4; + uVar2 = *(undefined2 *)(iVar3 + 0x87c); + *(undefined2 *)(local_8 * 4 + 0x87a) = *(undefined2 *)(iVar3 + 0x87a); + *(undefined2 *)(local_8 * 4 + 0x87c) = uVar2; + FUN_1020_0891(0x16,local_8 * 0x16 + 0x890,0x1028,(local_8 - 1) * 0x16 + 0x890,0x1028); + if (local_8 == local_6 + 1U) break; + local_8 = local_8 - 1; + } + } + uVar2 = *(undefined2 *)((uint)DAT_1028_07d1 * 4 + 0x980); + *(undefined2 *)(local_6 * 4 + 0x87a) = *(undefined2 *)((uint)DAT_1028_07d1 * 4 + 0x97e); + *(undefined2 *)(local_6 * 4 + 0x87c) = uVar2; + DAT_1028_07d2 = (undefined1)local_6; + FUN_1000_ab3c(param_1); + FUN_1000_a8ea(param_1); + return; +} + + +/* ===== 1000:acc2 FUN_1000_acc2 ===== */ + +void __stdcall16far FUN_1000_acc2(undefined2 param_1) + +{ + byte bVar1; + byte bVar2; + undefined2 uVar3; + undefined2 uVar4; + undefined2 uVar5; + undefined1 local_14c; + + uVar5 = 0x1228; + uVar3 = GETDC(); + bVar2 = DAT_1028_07d1; + bVar1 = DAT_1028_07d0; + if (DAT_1028_07d0 != 0) { + local_14c = 1; + while( true ) { + FUN_1008_0837(0x1f,0x8b,(local_14c - 1) * 0x2c + 0x114,0x1d8,uVar3); + FUN_1008_093f(0x1f,0x8b,(local_14c - 1) * 0x2c + 0x114,0x1d8,uVar3); + DAT_1028_07d1 = local_14c; + if (local_14c == bVar2) { + FUN_1000_bc36(param_1,0,0); + uVar5 = *(undefined2 *)((uint)local_14c * 4 + 0x990); + uVar4 = FUN_1020_08a9(); + FUN_1000_bda2(param_1,uVar4,uVar5); + FUN_1000_0002(*(undefined2 *)((uint)local_14c * 2 + 0x9a4),uVar3); + FUN_1008_093f(0x7b,0x2a,0x4f,0x37,uVar3); + FUN_1008_0837(0xb,0xb,(local_14c - 1) * 0x2c + 0x118,0x174,uVar3); + FUN_1008_093f(0xb,0xb,(local_14c - 1) * 0x2c + 0x118,0x174,uVar3); + } + else { + FUN_1000_bc36(param_1,0xffff,0xffff); + FUN_1008_08bb(0xb,0xb,(local_14c - 1) * 0x2c + 0x118,0x174,uVar3); + FUN_1008_093f(0xb,0xb,(local_14c - 1) * 0x2c + 0x118,0x174,uVar3); + } + uVar5 = 0x1008; + if (local_14c == bVar1) break; + local_14c = local_14c + 1; + } + } + DAT_1028_07d1 = bVar2; + RELEASEDC(uVar5,uVar3); + return; +} + + +/* ===== 1000:ae6e FUN_1000_ae6e ===== */ + +void __stdcall16far FUN_1000_ae6e(int param_1) + +{ + byte bVar1; + uint uVar2; + undefined1 extraout_AH; + int iVar3; + int iVar4; + undefined2 uVar5; + undefined2 uVar6; + undefined2 uVar7; + undefined2 unaff_SS; + int local_9; + byte local_4; + + if ((DAT_1028_0874 == '\0') && (DAT_1028_399a != 0)) { + DAT_1028_0874 = '\0'; + FUN_1000_a38e(param_1,0); + uVar7 = DAT_1028_396b; + DAT_1028_07d3 = DAT_1028_3969; + DAT_1028_07d5 = DAT_1028_396b; + DAT_1028_07d7 = DAT_1028_396d; + DAT_1028_07d9 = DAT_1028_396f; + uVar5 = (undefined2)((ulong)*(undefined4 *)(param_1 + 6) >> 0x10); + iVar3 = (int)*(undefined4 *)(param_1 + 6); + *(undefined2 *)(iVar3 + 0xbc2) = DAT_1028_3969; + *(undefined2 *)(iVar3 + 0xbc4) = uVar7; + uVar7 = DAT_1028_07d9; + *(undefined2 *)(iVar3 + 0xbc6) = DAT_1028_07d7; + *(undefined2 *)(iVar3 + 0xbc8) = uVar7; + *(undefined1 *)(iVar3 + (uint)DAT_1028_07d1 * 0x14 + 0x47b) = 0; + FUN_1000_b3f3(param_1,0x3fc); + FUN_1000_bdde(param_1,1,0); + uVar7 = (undefined2)((ulong)*(undefined4 *)(param_1 + 6) >> 0x10); + iVar3 = (int)*(undefined4 *)(param_1 + 6); + *(undefined2 *)(iVar3 + 0xbaa) = 0; + *(undefined2 *)(iVar3 + 0xbac) = 0; + uVar7 = *(undefined2 *)(iVar3 + 0x58); + FUN_1020_100b(); + FUN_1020_0ff7(); + uVar5 = FUN_1020_1017(); + uVar6 = (undefined2)((ulong)*(undefined4 *)(param_1 + 6) >> 0x10); + iVar3 = (int)*(undefined4 *)(param_1 + 6); + *(undefined2 *)(iVar3 + 0xbae) = uVar5; + *(undefined2 *)(iVar3 + 0xbb0) = uVar7; + *(undefined2 *)(iVar3 + 0xbca) = 0; + *(undefined2 *)(iVar3 + 0xbcc) = 0; + *(undefined2 *)(iVar3 + 0xbce) = 0; + *(undefined2 *)(iVar3 + 0xbd0) = 0; + *(undefined2 *)(iVar3 + 0xbd2) = 0; + DAT_1028_399a = 0; + DAT_1028_0875 = 1; + DAT_1028_41f9 = 1; + *(undefined1 *)(iVar3 + 0x61) = 1; + } + else { + DAT_1028_0875 = 0; + FUN_1008_0002(8); + iVar3 = param_1; + FUN_1000_a38e(param_1,0); + if (DAT_1028_0874 == '\0') { + *(undefined1 *)((int)*(undefined4 *)(param_1 + 6) + 0xbdd) = 0; + } + *(undefined1 *)((int)*(undefined4 *)(param_1 + 6) + 0xbdc) = 0; + if (*(int *)((uint)DAT_1028_07d1 * 2 + 0x81f) == 0) { + uVar7 = (undefined2)((ulong)*(undefined4 *)(param_1 + 6) >> 0x10); + iVar3 = (int)*(undefined4 *)(param_1 + 6); + *(undefined1 *)(iVar3 + 0xbda) = 0; + *(undefined1 *)(iVar3 + 0xbdb) = 0; + FUN_1000_a99c(param_1); + iVar3 = 0x1000; + FUN_1000_abe5(param_1); + } + uVar7 = (undefined2)((ulong)*(undefined4 *)(param_1 + 6) >> 0x10); + iVar4 = (int)*(undefined4 *)(param_1 + 6); + *(undefined2 *)(iVar4 + 0xbce) = 0; + *(undefined2 *)(iVar4 + 0xbd0) = 0; + *(undefined2 *)(iVar4 + 0xbd2) = 0; + local_4 = 1; + while( true ) { + *(undefined1 *) + ((int)*(undefined4 *)(param_1 + 6) + (uint)DAT_1028_07d1 * 0xaf + (uint)local_4 + 0x61) = + *(undefined1 *)((uint)local_4 * 0x53 + 0x98f); + *(undefined2 *) + ((int)*(undefined4 *)(param_1 + 6) + (uint)DAT_1028_07d1 * 0x15e + (uint)local_4 * 2 + 0x36c) + = *(undefined2 *)((uint)local_4 * 0x53 + 0x99e); + bVar1 = DAT_1028_07d1; + if (local_4 == 0xaf) break; + local_4 = local_4 + 1; + } + do { + uVar2 = (uint)DAT_1028_07d1 % (uint)DAT_1028_07d0 + 1; + DAT_1028_07d1 = (byte)uVar2; + if (0 < *(int *)((uVar2 & 0xff) * 2 + 0x81f)) break; + } while (DAT_1028_07d1 != bVar1); + if (*(int *)((uVar2 & 0xff) * 2 + 0x81f) < 1) { + DAT_1028_07d1 = 0; + FUN_1000_a70e(param_1); + if (DAT_1028_07d2 == '\0') { + uVar7 = (undefined2)((ulong)*(undefined4 *)(param_1 + 6) >> 0x10); + iVar3 = (int)*(undefined4 *)(param_1 + 6); + *(undefined1 *)(iVar3 + 0xbda) = 0; + *(undefined1 *)(iVar3 + 0xbdb) = 0; + FUN_1000_ab3c(param_1); + } + } + else { + local_4 = 1; + while( true ) { + *(undefined1 *)((uint)local_4 * 0x53 + 0x98f) = + *(undefined1 *) + ((int)*(undefined4 *)(param_1 + 6) + (uint)DAT_1028_07d1 * 0xaf + (uint)local_4 + 0x61 + ); + *(undefined2 *)((uint)local_4 * 0x53 + 0x99e) = + *(undefined2 *) + ((int)*(undefined4 *)(param_1 + 6) + (uint)DAT_1028_07d1 * 0x15e + (uint)local_4 * 2 + + 0x36c); + if (DAT_1028_07d1 != bVar1) { + iVar3 = param_1; + FUN_1000_7e12(param_1,local_4); + } + if (local_4 == 0xaf) break; + local_4 = local_4 + 1; + } + local_4 = '\x01'; + while( true ) { + if (DAT_1028_07d1 != bVar1) { + iVar3 = param_1; + FUN_1000_7e92(param_1,local_4); + } + if (local_4 == '\x14') break; + local_4 = local_4 + '\x01'; + } + local_4 = 2; + while( true ) { + if (local_4 <= *(byte *)(DAT_1028_07d1 + 0x816)) { + iVar3 = param_1; + FUN_1000_b30b(param_1,local_4 + 999); + } + if (local_4 == 6) break; + local_4 = local_4 + 1; + } + if (DAT_1028_07d1 != bVar1) { + local_9 = 0; + local_4 = 1; + while( true ) { + if (*(char *)((int)*(undefined4 *)(param_1 + 6) + (uint)DAT_1028_07d1 * 0x14 + + (uint)local_4 + 0x46c) != '\0') { + local_9 = local_9 + 1; + } + if (local_4 == 9) break; + local_4 = local_4 + 1; + } + uVar7 = GETDC(0x1000,*(undefined2 *)((int)*(undefined4 *)(param_1 + 6) + 4)); + FUN_1008_0dbd(local_9,uVar7); + FUN_1008_0b9e(CONCAT11(extraout_AH,DAT_1028_07d1),uVar7); + iVar3 = *(int *)((int)*(undefined4 *)(param_1 + 6) + 4); + RELEASEDC(0x1008,uVar7); + } + FUN_1000_acc2(param_1); + *(int *)((uint)DAT_1028_07d1 * 2 + 0x81f) = *(int *)((uint)DAT_1028_07d1 * 2 + 0x81f) + -1; + FUN_1000_9e85(param_1); + uVar7 = GETDC(0x1000,*(undefined2 *)((int)*(undefined4 *)(param_1 + 6) + 4),iVar3); + FUN_1008_08bb(0x14,0x94,0xf3,0x54,uVar7); + FUN_1008_093f(0x14,0x94,0xf3,0x54,uVar7); + RELEASEDC(0x1008,uVar7); + FUN_1000_a604(param_1); + } + } + return; +} + + +/* ===== 1000:b2c8 FUN_1000_b2c8 ===== */ + +void __stdcall16far +FUN_1000_b2c8(undefined2 param_1,int param_2,int param_3,int param_4,int param_5,undefined2 param_6) + +{ + FUN_1008_0837((param_2 - param_4) + 1,(param_3 - param_5) + 1,param_4,param_5,param_6); + FUN_1008_093f((param_2 - param_4) + 1,(param_3 - param_5) + 1,param_4,param_5,param_6); + return; +} + + +/* ===== 1000:b30b FUN_1000_b30b ===== */ + +void __stdcall16far FUN_1000_b30b(undefined2 param_1,uint param_2) + +{ + undefined2 uVar1; + int iVar2; + undefined2 uVar3; + + uVar1 = GETDC(); + if (param_2 < 0xb0) { + iVar2 = param_2 * 0x53; + uVar3 = 0x1000; + FUN_1000_b2c8(&stack0xfffe,*(undefined2 *)(iVar2 + 0x9ac),*(undefined2 *)(iVar2 + 0x9aa), + *(undefined2 *)(iVar2 + 0x9a8),*(undefined2 *)(iVar2 + 0x9a6),uVar1); + } + else if ((param_2 < 0x3ee) || (0x3f6 < param_2)) { + iVar2 = (param_2 - 1000) * 8; + uVar3 = 0x1000; + FUN_1000_b2c8(&stack0xfffe,*(undefined2 *)(iVar2 + 0x4269),*(undefined2 *)(iVar2 + 16999), + *(undefined2 *)(iVar2 + 0x4265),*(undefined2 *)(iVar2 + 0x4263),uVar1); + } + else { + uVar3 = 0x1008; + FUN_1008_0dbd(param_2 - 0x3ed,uVar1); + } + RELEASEDC(uVar3,uVar1); + return; +} + + +/* ===== 1000:b3b0 FUN_1000_b3b0 ===== */ + +void __stdcall16far +FUN_1000_b3b0(undefined2 param_1,int param_2,int param_3,int param_4,int param_5,undefined2 param_6) + +{ + FUN_1008_08bb((param_2 - param_4) + 1,(param_3 - param_5) + 1,param_4,param_5,param_6); + FUN_1008_093f((param_2 - param_4) + 1,(param_3 - param_5) + 1,param_4,param_5,param_6); + return; +} + + +/* ===== 1000:b3f3 FUN_1000_b3f3 ===== */ + +void __stdcall16far FUN_1000_b3f3(undefined2 param_1,uint param_2) + +{ + undefined2 uVar1; + int iVar2; + + uVar1 = GETDC(); + if (param_2 < 0xb0) { + iVar2 = param_2 * 0x53; + FUN_1000_b3b0(&stack0xfffe,*(undefined2 *)(iVar2 + 0x9ac),*(undefined2 *)(iVar2 + 0x9aa), + *(undefined2 *)(iVar2 + 0x9a8),*(undefined2 *)(iVar2 + 0x9a6),uVar1); + } + else { + iVar2 = (param_2 - 1000) * 8; + FUN_1000_b3b0(&stack0xfffe,*(undefined2 *)(iVar2 + 0x4269),*(undefined2 *)(iVar2 + 16999), + *(undefined2 *)(iVar2 + 0x4265),*(undefined2 *)(iVar2 + 0x4263),uVar1); + } + RELEASEDC(0x1000,uVar1); + return; +} + + +/* ===== 1000:b476 FUN_1000_b476 ===== */ + +void __stdcall16far FUN_1000_b476(int param_1,uint param_2,uint param_3) + +{ + uint uVar1; + bool bVar2; + int iVar3; + uint uVar4; + undefined2 uVar5; + int iVar6; + undefined2 uVar7; + undefined2 unaff_SS; + uint local_7; + byte local_3; + + if (DAT_1028_07c6 == '\0') { + if ((((param_2 & 1) == 1) && (0x80 < param_3)) && (param_3 < 0x86)) { + *(undefined1 *) + ((int)*(undefined4 *)(param_1 + 6) + (uint)DAT_1028_07d1 * 0x14 + param_3 + 0x3f5) = 1; + FUN_1000_b30b(param_1,param_3 + 0x376); + } + if ((param_2 & 2) == 2) { + iVar6 = *(int *)(param_3 * 0x53 + 0x99e); + *(undefined1 *)(iVar6 * 0x53 + 0x98f) = 0; + FUN_1000_7e12(param_1,iVar6); + if ((param_2 & 0x2000) == 0x2000) { + *(undefined1 *)((iVar6 + 1) * 0x53 + 0x98f) = 0; + *(undefined1 *)((iVar6 + 2) * 0x53 + 0x98f) = 0; + } + } + if ((((param_2 & 0x400) == 0x400) && (DAT_1028_07c7 == '\0')) && (DAT_1028_07c8 == '\0')) { + DAT_1028_0855 = 0; + DAT_1028_0857 = 0; + DAT_1028_07c7 = '\x01'; + } + if ((param_2 & 4) == 4) { + FUN_1008_0002(0xc); + DAT_1028_39de = 1; + *(undefined1 *)((int)*(undefined4 *)(param_1 + 6) + (uint)DAT_1028_07d1 * 0xaf + 0xf6) = 1; + uVar7 = 0x1000; + FUN_1000_b30b(param_1,0x95); + if (DAT_1028_399a == 0) { + iVar6 = *(int *)((uint)DAT_1028_07d1 * 2 + 0x9a4); + do { + uVar7 = 0x1020; + iVar3 = FUN_1020_14a4(6); + *(int *)((uint)DAT_1028_07d1 * 2 + 0x9a4) = iVar3 + 1; + } while (*(int *)((uint)DAT_1028_07d1 * 2 + 0x9a4) == iVar6); + } + else { + *(undefined2 *)((uint)DAT_1028_07d1 * 2 + 0x9a4) = 7; + } + uVar7 = GETDC(uVar7,*(undefined2 *)((int)*(undefined4 *)(param_1 + 6) + 4)); + FUN_1000_0002(*(undefined2 *)((uint)DAT_1028_07d1 * 2 + 0x9a4),uVar7); + FUN_1008_093f(0x7b,0x2a,0x4f,0x37,uVar7); + RELEASEDC(0x1008,uVar7); + } + if ((param_2 & 8) == 8) { + FUN_1008_0002(0xc); + bVar2 = true; + local_3 = 0; + while (*(char *)(((uint)local_3 * 3 + 0x5a) * 0x53 + 0x98f) == '\0') { + if (local_3 == 4) goto LAB_1000_b66c; + local_3 = local_3 + 1; + } + bVar2 = false; +LAB_1000_b66c: + if (bVar2) { + FUN_1008_0002(0x11); + if (*(char *)(DAT_1028_07d1 + 0x816) == '\x06') { + FUN_1000_bc36(param_1,50000,0); + } + else { + if (*(char *)(DAT_1028_07d1 + 0x816) == '\x01') { + *(undefined1 *)(DAT_1028_07d1 + 0x816) = 2; + } + else { + *(char *)(DAT_1028_07d1 + 0x816) = *(char *)(DAT_1028_07d1 + 0x816) + '\x01'; + } + FUN_1000_b30b(param_1,*(byte *)(DAT_1028_07d1 + 0x816) + 999); + } + local_3 = 0; + while( true ) { + *(undefined1 *)(((uint)local_3 * 3 + 0x5a) * 0x53 + 0x98f) = 1; + *(undefined1 *)(((uint)local_3 * 3 + 0x5b) * 0x53 + 0x98f) = 1; + *(undefined1 *)(((uint)local_3 * 3 + 0x5c) * 0x53 + 0x98f) = 1; + FUN_1000_7e12(param_1,(uint)local_3 * 3 + 0x5a); + if (local_3 == 4) break; + local_3 = local_3 + 1; + } + } + } + if ((param_2 & 0x10) == 0x10) { + FUN_1008_0002(0xc); + bVar2 = true; + local_3 = 0; + while (*(char *)(((uint)local_3 * 3 + 0x6d) * 0x53 + 0x98f) == '\0') { + if (local_3 == 3) goto LAB_1000_b79e; + local_3 = local_3 + 1; + } + bVar2 = false; +LAB_1000_b79e: + if (bVar2) { + local_7 = 1; + local_3 = 1; + while( true ) { + if (*(char *)((int)*(undefined4 *)(param_1 + 6) + (uint)DAT_1028_07d1 * 0x14 + + (uint)local_3 + 0x46c) != '\0') { + local_7 = local_7 + 1; + } + if (local_3 == 9) break; + local_3 = local_3 + 1; + } + if (local_7 < 9) { + FUN_1008_0002(0x11); + *(undefined1 *) + ((int)*(undefined4 *)(param_1 + 6) + (uint)DAT_1028_07d1 * 0x14 + local_7 + 0x46c) = 1; + FUN_1000_b30b(param_1,local_7 + 0x3ed); + FUN_1000_bc36(param_1,local_7 * 10000,0); + } + else if (local_7 == 9) { + FUN_1008_0002(0x11); + *(undefined1 *)((int)*(undefined4 *)(param_1 + 6) + (uint)DAT_1028_07d1 * 0x14 + 0x475) = + 1; + FUN_1000_b30b(param_1,0x3f6); + FUN_1000_bc36(param_1,0x5f90,0); + uVar7 = (undefined2)((ulong)*(undefined4 *)(param_1 + 6) >> 0x10); + iVar6 = (int)*(undefined4 *)(param_1 + 6); + *(undefined1 *)(iVar6 + 0xbdc) = 1; + DAT_1028_3b2a = 1; + DAT_1028_0b81 = 1; + DAT_1028_3b7d = 1; + uVar7 = GETDC(0x1000,*(undefined2 *)(iVar6 + 4)); + FUN_1008_0837((DAT_1028_3b47 - DAT_1028_3b43) + 1,(DAT_1028_3b45 - DAT_1028_3b41) + 1, + DAT_1028_3b43,DAT_1028_3b41,uVar7); + FUN_1008_093f((DAT_1028_3b47 - DAT_1028_3b43) + 1,(DAT_1028_3b45 - DAT_1028_3b41) + 1, + DAT_1028_3b43,DAT_1028_3b41,uVar7); + FUN_1008_0837((DAT_1028_3b9a - DAT_1028_3b96) + 1,(DAT_1028_3b98 - DAT_1028_3b94) + 1, + DAT_1028_3b96,DAT_1028_3b94,uVar7); + FUN_1008_093f((DAT_1028_3b9a - DAT_1028_3b96) + 1,(DAT_1028_3b98 - DAT_1028_3b94) + 1, + DAT_1028_3b96,DAT_1028_3b94,uVar7); + FUN_1008_0837((DAT_1028_0b9e - DAT_1028_0b9a) + 1,(DAT_1028_0b9c - DAT_1028_0b98) + 1, + DAT_1028_0b9a,DAT_1028_0b98,uVar7); + FUN_1008_093f((DAT_1028_0b9e - DAT_1028_0b9a) + 1,(DAT_1028_0b9c - DAT_1028_0b98) + 1, + DAT_1028_0b9a,DAT_1028_0b98,uVar7); + RELEASEDC(0x1008,uVar7); + } + else { + FUN_1008_0002(7); + if (*(char *)((int)*(undefined4 *)(param_1 + 6) + 0xbdc) == '\0') { + *(undefined1 *)((int)*(undefined4 *)(param_1 + 6) + 0xbdc) = 1; + } + else { + uVar1 = *(uint *)((uint)DAT_1028_07d1 * 4 + 0x98e); + iVar6 = *(int *)((uint)DAT_1028_07d1 * 4 + 0x990); + uVar4 = (uint)DAT_1028_07d1; + *(int *)(uVar4 * 4 + 0x98e) = uVar1 + 0x86a0; + *(int *)(uVar4 * 4 + 0x990) = iVar6 + 1 + (uint)(0x795f < uVar1); + uVar7 = *(undefined2 *)((uint)DAT_1028_07d1 * 4 + 0x990); + uVar5 = FUN_1020_08a9(); + FUN_1000_bda2(param_1,uVar5,uVar7); + } + } + local_3 = 0; + while( true ) { + *(undefined1 *)(((uint)local_3 * 3 + 0x6d) * 0x53 + 0x98f) = 1; + *(undefined1 *)(((uint)local_3 * 3 + 0x6e) * 0x53 + 0x98f) = 1; + *(undefined1 *)(((uint)local_3 * 3 + 0x6f) * 0x53 + 0x98f) = 1; + FUN_1000_7e12(param_1,(uint)local_3 * 3 + 0x6d); + if (local_3 == 3) break; + local_3 = local_3 + 1; + } + } + } + if ((param_2 & 0x1000) == 0x1000) { + if (param_3 == 0x96) { + *(undefined1 *)((int)*(undefined4 *)(param_1 + 6) + 0xf7) = 10; + FUN_1000_b30b(param_1,0x96); + DAT_1028_3b2a = 1; + FUN_1000_b30b(param_1,0x99); + } + else if (param_3 == 0x97) { + *(undefined1 *)((int)*(undefined4 *)(param_1 + 6) + 0xf8) = 10; + FUN_1000_b30b(param_1,0x97); + DAT_1028_0b81 = 1; + FUN_1000_b30b(param_1,6); + } + else if (param_3 == 0x98) { + *(undefined1 *)((int)*(undefined4 *)(param_1 + 6) + 0xf9) = 10; + FUN_1000_b30b(param_1,0x98); + DAT_1028_3b7d = 1; + FUN_1000_b30b(param_1,0x9a); + } + } + if ((param_2 & 0x40) == 0x40) { + if (param_3 == 0x33) { + FUN_1008_0002(6); + *(undefined1 *)((int)*(undefined4 *)(param_1 + 6) + 0x94) = 5; + FUN_1000_b30b(param_1,0x33); + iVar6 = (*(byte *)(DAT_1028_07d1 + 0x816) - 1) * 1000; + FUN_1000_bc36(param_1,iVar6,iVar6 >> 0xf); + } + else if (param_3 == 0x34) { + FUN_1008_0002(6); + *(undefined1 *)((int)*(undefined4 *)(param_1 + 6) + 0x95) = 5; + FUN_1000_b30b(param_1,0x34); + iVar6 = (*(byte *)(DAT_1028_07d1 + 0x816) - 1) * 1000; + FUN_1000_bc36(param_1,iVar6,iVar6 >> 0xf); + } + else if (param_3 == 0x35) { + FUN_1008_0002(6); + *(undefined1 *)((int)*(undefined4 *)(param_1 + 6) + 0x96) = 5; + FUN_1000_b30b(param_1,0x35); + iVar6 = (*(byte *)(DAT_1028_07d1 + 0x816) - 1) * 1000; + FUN_1000_bc36(param_1,iVar6,iVar6 >> 0xf); + } + else if ((0x8b < param_3) && (param_3 < 0x94)) { + *(undefined1 *)((int)*(undefined4 *)(param_1 + 6) + param_3 + 0x61) = 0x14; + FUN_1000_b30b(param_1,param_3); + } + } + } + return; +} + + +/* ===== 1000:bc36 FUN_1000_bc36 ===== */ + +void __stdcall16far FUN_1000_bc36(int param_1,uint param_2,int param_3) + +{ + uint *puVar1; + int *piVar2; + uint uVar3; + int iVar4; + int iVar5; + undefined2 uVar6; + uint uVar7; + int iVar8; + undefined2 unaff_SS; + undefined2 uVar9; + + uVar9 = *(undefined2 *)((int)*(undefined4 *)(param_1 + 6) + 4); + uVar6 = GETDC(); + if (((param_3 != -1) || (param_2 != 0xffff)) && (DAT_1028_07c6 == '\0')) { + if (DAT_1028_0874 != '\0') { + param_2 = FUN_1020_08a9(uVar9); + } + if (*(char *)((int)*(undefined4 *)(param_1 + 6) + 0xbdc) != '\0') { + param_2 = FUN_1020_08a9(uVar9); + } + uVar3 = *(uint *)((uint)DAT_1028_07d1 * 4 + 0x97e); + iVar4 = *(int *)((uint)DAT_1028_07d1 * 4 + 0x980); + uVar7 = (uint)DAT_1028_07d1; + *(int *)(uVar7 * 4 + 0x97e) = uVar3 + param_2; + *(int *)(uVar7 * 4 + 0x980) = iVar4 + param_3 + (uint)CARRY2(uVar3,param_2); + iVar4 = *(int *)((uint)DAT_1028_07d1 * 4 + 0x837); + if ((iVar4 < 0) || ((iVar4 < 1 && (*(uint *)((uint)DAT_1028_07d1 * 4 + 0x835) < 5)))) { + iVar8 = *(int *)((uint)DAT_1028_07d1 * 4 + 0x835) * 4; + iVar4 = *(int *)(iVar8 + 0x827); + iVar5 = *(int *)((uint)DAT_1028_07d1 * 4 + 0x980); + if ((iVar4 < iVar5) || + ((iVar4 <= iVar5 && + (*(uint *)(iVar8 + 0x825) <= *(uint *)((uint)DAT_1028_07d1 * 4 + 0x97e))))) { + FUN_1008_0002(7); + uVar7 = (uint)DAT_1028_07d1; + puVar1 = (uint *)(uVar7 * 4 + 0x835); + uVar3 = *puVar1; + *puVar1 = *puVar1 + 1; + piVar2 = (int *)(uVar7 * 4 + 0x837); + *piVar2 = *piVar2 + (uint)(0xfffe < uVar3); + piVar2 = (int *)((uint)DAT_1028_07d1 * 2 + 0x81f); + *piVar2 = *piVar2 + 1; + FUN_1000_a604(param_1); + } + } + FUN_1008_0b9e(DAT_1028_07d1,uVar6); + } + FUN_1008_0996(uVar6,DAT_1028_07d1,0); + RELEASEDC(0x1008,uVar6); + return; +} + + +/* ===== 1000:bda2 FUN_1000_bda2 ===== */ + +void __stdcall16far FUN_1000_bda2(undefined2 param_1,undefined2 param_2,undefined2 param_3) + +{ + undefined2 uVar1; + + uVar1 = GETDC(); + FUN_1008_0996(uVar1,param_2,param_3); + RELEASEDC(0x1008,uVar1); + return; +} + + +/* ===== 1000:bdde FUN_1000_bdde ===== */ + +void __stdcall16far FUN_1000_bdde(undefined2 param_1,int param_2) + +{ + uint uVar1; + int iVar2; + int iVar3; + + iVar2 = DAT_1028_07d5; + iVar3 = (param_2 + 0xad) * 0x53; + *(uint *)(iVar3 + 0x96d) = DAT_1028_07d3; + *(int *)(iVar3 + 0x96f) = iVar2; + iVar2 = DAT_1028_07d9; + iVar3 = (param_2 + 0xad) * 0x53; + *(uint *)(iVar3 + 0x971) = DAT_1028_07d7; + *(int *)(iVar3 + 0x973) = iVar2; + uVar1 = DAT_1028_07d3 + 0xc180; + iVar2 = DAT_1028_07d5 - (uint)(DAT_1028_07d3 < 16000); + iVar3 = (param_2 + 0xad) * 0x53; + *(int *)(iVar3 + 0x95d) = DAT_1028_07d3 + 0xadf8; + *(int *)(iVar3 + 0x95f) = iVar2 - (uint)(uVar1 < 5000); + uVar1 = DAT_1028_07d7 + 0xc180; + iVar2 = DAT_1028_07d9 - (uint)(DAT_1028_07d7 < 16000); + iVar3 = (param_2 + 0xad) * 0x53; + *(int *)(iVar3 + 0x961) = DAT_1028_07d7 + 0xadf8; + *(int *)(iVar3 + 0x963) = iVar2 - (uint)(uVar1 < 5000); + uVar1 = DAT_1028_07d3 + 16000; + iVar2 = DAT_1028_07d5 + (uint)(0xc17f < DAT_1028_07d3); + iVar3 = (param_2 + 0xad) * 0x53; + *(int *)(iVar3 + 0x965) = DAT_1028_07d3 + 21000; + *(int *)(iVar3 + 0x967) = iVar2 + (uint)(0xec77 < uVar1); + uVar1 = DAT_1028_07d7 + 16000; + iVar2 = DAT_1028_07d9 + (uint)(0xc17f < DAT_1028_07d7); + iVar3 = (param_2 + 0xad) * 0x53; + *(int *)(iVar3 + 0x969) = DAT_1028_07d7 + 21000; + *(int *)(iVar3 + 0x96b) = iVar2 + (uint)(0xec77 < uVar1); + return; +} + + +/* ===== 1000:beff FUN_1000_beff ===== */ + +void __stdcall16far FUN_1000_beff(int param_1,uint param_2,int param_3,uint param_4,int param_5) + +{ + undefined2 uVar1; + undefined2 uVar2; + uint uVar3; + int iVar4; + int iVar5; + undefined2 unaff_CS; + undefined2 unaff_SS; + bool bVar6; + undefined2 uVar7; + undefined2 uVar8; + + uVar1 = *(undefined2 *)((int)*(undefined4 *)(param_1 + 6) + 4); + GETCLIENTRECT(unaff_CS,param_1 + -0x1a,unaff_SS); + uVar1 = GETDC(0x1228,*(undefined2 *)((int)*(undefined4 *)(param_1 + 6) + 4),uVar1); + *(undefined2 *)(param_1 + -0xc) = uVar1; + uVar1 = CREATECOMPATIBLEDC(0x1228,*(undefined2 *)(param_1 + -0xc)); + *(undefined2 *)(param_1 + -0xe) = uVar1; + uVar1 = CREATECOMPATIBLEDC(0x1228,*(undefined2 *)(param_1 + -0xc)); + *(undefined2 *)(param_1 + -0x10) = uVar1; + uVar1 = CREATECOMPATIBLEDC(0x1228,*(undefined2 *)(param_1 + -0xc)); + *(undefined2 *)(param_1 + -0x12) = uVar1; + uVar1 = *(undefined2 *)(param_1 + -0xc); + uVar2 = CREATECOMPATIBLEBITMAP(0x1228,100,100); + *(undefined2 *)(param_1 + -8) = uVar2; + iVar4 = DAT_1028_07d5; + uVar2 = (undefined2)((ulong)*(undefined4 *)(param_1 + 6) >> 0x10); + iVar5 = (int)*(undefined4 *)(param_1 + 6); + *(uint *)(iVar5 + 0xbc2) = DAT_1028_07d3; + *(int *)(iVar5 + 0xbc4) = iVar4; + iVar4 = DAT_1028_07d9; + *(uint *)(iVar5 + 0xbc6) = DAT_1028_07d7; + *(int *)(iVar5 + 0xbc8) = iVar4; + bVar6 = CARRY2(DAT_1028_07d7,param_4); + DAT_1028_07d7 = DAT_1028_07d7 + param_4; + DAT_1028_07d9 = DAT_1028_07d9 + param_5 + (uint)bVar6; + bVar6 = CARRY2(DAT_1028_07d3,param_2); + DAT_1028_07d3 = DAT_1028_07d3 + param_2; + DAT_1028_07d5 = DAT_1028_07d5 + param_3 + (uint)bVar6; + iVar4 = DAT_1028_07d5 + (uint)(0xfe0b < DAT_1028_07d3); + uVar3 = FUN_1020_08e6(uVar1); + uVar1 = (undefined2)((ulong)*(undefined4 *)(param_1 + 6) >> 0x10); + iVar5 = (int)*(undefined4 *)(param_1 + 6); + *(int *)(iVar5 + 0xba2) = uVar3 - 8; + *(int *)(iVar5 + 0xba4) = iVar4 - (uint)(uVar3 < 8); + iVar4 = DAT_1028_07d9 + (uint)(0xfe0b < DAT_1028_07d7); + uVar3 = FUN_1020_08e6(); + uVar1 = (undefined2)((ulong)*(undefined4 *)(param_1 + 6) >> 0x10); + iVar5 = (int)*(undefined4 *)(param_1 + 6); + *(int *)(iVar5 + 0xba6) = uVar3 - 8; + *(int *)(iVar5 + 0xba8) = iVar4 - (uint)(uVar3 < 8); + iVar4 = (DAT_1028_07d5 - *(int *)(iVar5 + 0xbc4)) - + (uint)(DAT_1028_07d3 < *(uint *)(iVar5 + 0xbc2)); + uVar1 = FUN_1020_08e6(); + uVar2 = (undefined2)((ulong)*(undefined4 *)(param_1 + 6) >> 0x10); + iVar5 = (int)*(undefined4 *)(param_1 + 6); + *(undefined2 *)(iVar5 + 0xbb2) = uVar1; + *(int *)(iVar5 + 0xbb4) = iVar4; + iVar4 = (DAT_1028_07d9 - *(int *)(iVar5 + 0xbc8)) - + (uint)(DAT_1028_07d7 < *(uint *)(iVar5 + 0xbc6)); + uVar1 = FUN_1020_08e6(); + uVar2 = (undefined2)((ulong)*(undefined4 *)(param_1 + 6) >> 0x10); + iVar5 = (int)*(undefined4 *)(param_1 + 6); + *(undefined2 *)(iVar5 + 0xbb6) = uVar1; + *(int *)(iVar5 + 3000) = iVar4; + if ((*(int *)(iVar5 + 0xbb4) < 1) && + ((*(int *)(iVar5 + 0xbb4) < 0 || (*(int *)(iVar5 + 0xbb2) == 0)))) { + *(int *)(param_1 + -0x20) = *(int *)((int)*(undefined4 *)(param_1 + 6) + 0xba2) + -1; + *(undefined2 *)(param_1 + -0x1c) = 1; + } + else { + uVar1 = (undefined2)((ulong)*(undefined4 *)(param_1 + 6) >> 0x10); + iVar4 = (int)*(undefined4 *)(param_1 + 6); + *(int *)(param_1 + -0x20) = (*(int *)(iVar4 + 0xba2) - *(int *)(iVar4 + 0xbb2)) + -1; + *(int *)(param_1 + -0x1c) = *(int *)((int)*(undefined4 *)(param_1 + 6) + 0xbb2) + 1; + } + uVar1 = (undefined2)((ulong)*(undefined4 *)(param_1 + 6) >> 0x10); + iVar5 = (int)*(undefined4 *)(param_1 + 6); + iVar4 = *(int *)(iVar5 + 3000); + if ((iVar4 < 1) && ((iVar4 < 0 || (*(int *)(iVar5 + 0xbb6) == 0)))) { + *(int *)(param_1 + -0x22) = *(int *)((int)*(undefined4 *)(param_1 + 6) + 0xba6) + -1; + *(undefined2 *)(param_1 + -0x1e) = 1; + } + else { + uVar1 = (undefined2)((ulong)*(undefined4 *)(param_1 + 6) >> 0x10); + iVar4 = (int)*(undefined4 *)(param_1 + 6); + *(int *)(param_1 + -0x22) = (*(int *)(iVar4 + 0xba6) - *(int *)(iVar4 + 0xbb6)) + -1; + *(int *)(param_1 + -0x1e) = *(int *)((int)*(undefined4 *)(param_1 + 6) + 0xbb6) + 1; + } + uVar1 = (undefined2)((ulong)*(undefined4 *)(param_1 + 6) >> 0x10); + iVar5 = (int)*(undefined4 *)(param_1 + 6); + iVar4 = *(int *)(iVar5 + 0xbb2); + if (*(int *)(iVar5 + 0xbb4) < 0) { + iVar4 = -iVar4; + } + *(int *)(param_1 + -0x28) = iVar4 + 0x13; + uVar1 = (undefined2)((ulong)*(undefined4 *)(param_1 + 6) >> 0x10); + iVar5 = (int)*(undefined4 *)(param_1 + 6); + iVar4 = *(int *)(iVar5 + 0xbb6); + if (*(int *)(iVar5 + 3000) < 0) { + iVar4 = -iVar4; + } + *(int *)(param_1 + -0x2a) = iVar4 + 0x13; + uVar1 = SELECTOBJECT(0x1020,DAT_1028_085b); + *(undefined2 *)(param_1 + -2) = uVar1; + uVar1 = SELECTOBJECT(0x1228,*(undefined2 *)(param_1 + -8)); + *(undefined2 *)(param_1 + -4) = uVar1; + BITBLT(0x1228,0x20,0xcc,*(undefined2 *)(param_1 + -0x22),*(undefined2 *)(param_1 + -0x20), + *(undefined2 *)(param_1 + -0xe),*(undefined2 *)(param_1 + -0x2a), + *(undefined2 *)(param_1 + -0x28),0,0); + SELECTOBJECT(0x1228,*(undefined2 *)((int)*(undefined4 *)(param_1 + 6) + 0x54)); + BITBLT(0x1228,0xc6,0x88,0,0,*(undefined2 *)(param_1 + -0xe),0x13,0x13, + *(undefined2 *)(param_1 + -0x1e),*(undefined2 *)(param_1 + -0x1c)); + SELECTOBJECT(0x1228,*(undefined2 *)((int)*(undefined4 *)(param_1 + 6) + 0x52)); + BITBLT(0x1228,0x86,0xee,0,0,*(undefined2 *)(param_1 + -0xe),0x13,0x13, + *(undefined2 *)(param_1 + -0x1e),*(undefined2 *)(param_1 + -0x1c)); + if (0x1ba < *(int *)(param_1 + -0x22) + *(int *)(param_1 + -0x2a)) { + if (*(int *)(param_1 + -0x22) < 0x1bb) { + *(int *)(param_1 + -0x2a) = 0x1bb - *(int *)(param_1 + -0x22); + } + else { + *(undefined2 *)(param_1 + -0x2a) = 0; + } + } + uVar1 = *(undefined2 *)(param_1 + -0xc); + BITBLT(0x1228,0x20,0xcc,0,0,*(undefined2 *)(param_1 + -0x10),*(undefined2 *)(param_1 + -0x2a), + *(undefined2 *)(param_1 + -0x28),*(undefined2 *)(param_1 + -0x22), + *(undefined2 *)(param_1 + -0x20)); + uVar2 = *(undefined2 *)(param_1 + -0xe); + SELECTOBJECT(0x1228,*(undefined2 *)(param_1 + -2)); + uVar8 = *(undefined2 *)(param_1 + -0x10); + SELECTOBJECT(0x1228,*(undefined2 *)(param_1 + -4)); + uVar7 = *(undefined2 *)(param_1 + -0x12); + SELECTOBJECT(0x1228,*(undefined2 *)(param_1 + -6)); + DELETEOBJECT(0x1228,*(undefined2 *)(param_1 + -8),uVar7,uVar8,uVar2,uVar1); + DELETEDC(0x1228,*(undefined2 *)(param_1 + -0xe)); + DELETEDC(0x1228,*(undefined2 *)(param_1 + -0x10)); + DELETEDC(0x1228,*(undefined2 *)(param_1 + -0x12)); + RELEASEDC(0x1228,*(undefined2 *)(param_1 + -0xc)); + return; +} + + +/* ===== 1000:c36b FUN_1000_c36b ===== */ + +void __stdcall16far FUN_1000_c36b(int param_1,int param_2) + +{ + undefined2 uVar1; + int iVar2; + int iVar3; + undefined2 uVar4; + undefined2 uVar5; + undefined2 unaff_SS; + + DAT_1028_07d3 = *(undefined2 *)(param_2 * 4 + 0x7e3); + DAT_1028_07d5 = *(undefined2 *)(param_2 * 4 + 0x7e5); + DAT_1028_07d7 = *(undefined2 *)(param_2 * 4 + 0x7eb); + DAT_1028_07d9 = *(undefined2 *)(param_2 * 4 + 0x7ed); + uVar1 = *(undefined2 *)(param_2 * 4 + 0x7f5); + uVar4 = (undefined2)((ulong)*(undefined4 *)(param_1 + 6) >> 0x10); + iVar2 = (int)*(undefined4 *)(param_1 + 6); + *(undefined2 *)(iVar2 + 0xbaa) = *(undefined2 *)(param_2 * 4 + 0x7f3); + *(undefined2 *)(iVar2 + 0xbac) = uVar1; + uVar1 = *(undefined2 *)(param_2 * 4 + 0x7fd); + uVar4 = (undefined2)((ulong)*(undefined4 *)(param_1 + 6) >> 0x10); + iVar2 = (int)*(undefined4 *)(param_1 + 6); + *(undefined2 *)(iVar2 + 0xbae) = *(undefined2 *)(param_2 * 4 + 0x7fb); + *(undefined2 *)(iVar2 + 0xbb0) = uVar1; + iVar2 = param_2 * 6; + uVar1 = *(undefined2 *)(iVar2 + 0x80d); + uVar4 = *(undefined2 *)(iVar2 + 0x80f); + uVar5 = (undefined2)((ulong)*(undefined4 *)(param_1 + 6) >> 0x10); + iVar3 = (int)*(undefined4 *)(param_1 + 6); + *(undefined2 *)(iVar3 + 0xbce) = *(undefined2 *)(iVar2 + 0x80b); + *(undefined2 *)(iVar3 + 0xbd0) = uVar1; + *(undefined2 *)(iVar3 + 0xbd2) = uVar4; + uVar1 = *(undefined2 *)(param_2 * 4 + 0x805); + uVar4 = (undefined2)((ulong)*(undefined4 *)(param_1 + 6) >> 0x10); + iVar2 = (int)*(undefined4 *)(param_1 + 6); + *(undefined2 *)(iVar2 + 0xbca) = *(undefined2 *)(param_2 * 4 + 0x803); + *(undefined2 *)(iVar2 + 0xbcc) = uVar1; + return; +} + + +/* ===== 1000:c426 FUN_1000_c426 ===== */ + +void __stdcall16far FUN_1000_c426(int param_1,int param_2) + +{ + undefined2 uVar1; + int iVar2; + int iVar3; + undefined2 uVar4; + undefined2 uVar5; + undefined2 unaff_SS; + + uVar1 = DAT_1028_07d5; + *(undefined2 *)(param_2 * 4 + 0x7e3) = DAT_1028_07d3; + *(undefined2 *)(param_2 * 4 + 0x7e5) = uVar1; + uVar1 = DAT_1028_07d9; + *(undefined2 *)(param_2 * 4 + 0x7eb) = DAT_1028_07d7; + *(undefined2 *)(param_2 * 4 + 0x7ed) = uVar1; + uVar4 = (undefined2)((ulong)*(undefined4 *)(param_1 + 6) >> 0x10); + iVar2 = (int)*(undefined4 *)(param_1 + 6); + uVar1 = *(undefined2 *)(iVar2 + 0xbac); + *(undefined2 *)(param_2 * 4 + 0x7f3) = *(undefined2 *)(iVar2 + 0xbaa); + *(undefined2 *)(param_2 * 4 + 0x7f5) = uVar1; + uVar4 = (undefined2)((ulong)*(undefined4 *)(param_1 + 6) >> 0x10); + iVar2 = (int)*(undefined4 *)(param_1 + 6); + uVar1 = *(undefined2 *)(iVar2 + 0xbb0); + *(undefined2 *)(param_2 * 4 + 0x7fb) = *(undefined2 *)(iVar2 + 0xbae); + *(undefined2 *)(param_2 * 4 + 0x7fd) = uVar1; + uVar5 = (undefined2)((ulong)*(undefined4 *)(param_1 + 6) >> 0x10); + iVar3 = (int)*(undefined4 *)(param_1 + 6); + uVar1 = *(undefined2 *)(iVar3 + 0xbd0); + uVar4 = *(undefined2 *)(iVar3 + 0xbd2); + iVar2 = param_2 * 6; + *(undefined2 *)(iVar2 + 0x80b) = *(undefined2 *)(iVar3 + 0xbce); + *(undefined2 *)(iVar2 + 0x80d) = uVar1; + *(undefined2 *)(iVar2 + 0x80f) = uVar4; + uVar4 = (undefined2)((ulong)*(undefined4 *)(param_1 + 6) >> 0x10); + iVar2 = (int)*(undefined4 *)(param_1 + 6); + uVar1 = *(undefined2 *)(iVar2 + 0xbcc); + *(undefined2 *)(param_2 * 4 + 0x803) = *(undefined2 *)(iVar2 + 0xbca); + *(undefined2 *)(param_2 * 4 + 0x805) = uVar1; + return; +} + + +/* ===== 1000:c4e1 FUN_1000_c4e1 ===== */ + +void __stdcall16far FUN_1000_c4e1(int param_1,int param_2) + +{ + int iVar1; + uint uVar2; + undefined2 uVar3; + uint uVar4; + undefined2 uVar5; + undefined2 unaff_SS; + + iVar1 = *(int *)((uint)DAT_1028_07d1 * 2 + 0x9a4); + if (iVar1 == 1) { + uVar4 = *(uint *)((uint)DAT_1028_07d1 * 4 + 0x98e); + iVar1 = *(int *)((uint)DAT_1028_07d1 * 4 + 0x990); + uVar2 = (uint)DAT_1028_07d1; + *(int *)(uVar2 * 4 + 0x98e) = uVar4 + 10000; + *(int *)(uVar2 * 4 + 0x990) = iVar1 + (uint)(0xd8ef < uVar4); + uVar5 = *(undefined2 *)((uint)DAT_1028_07d1 * 4 + 0x990); + uVar3 = FUN_1020_08a9(); + FUN_1000_bda2(param_1,uVar3,uVar5); + } + else if (iVar1 == 2) { + uVar4 = *(uint *)((uint)DAT_1028_07d1 * 4 + 0x98e); + iVar1 = *(int *)((uint)DAT_1028_07d1 * 4 + 0x990); + uVar2 = (uint)DAT_1028_07d1; + *(int *)(uVar2 * 4 + 0x98e) = uVar4 + 20000; + *(int *)(uVar2 * 4 + 0x990) = iVar1 + (uint)(0xb1df < uVar4); + uVar5 = *(undefined2 *)((uint)DAT_1028_07d1 * 4 + 0x990); + uVar3 = FUN_1020_08a9(); + FUN_1000_bda2(param_1,uVar3,uVar5); + } + else if (iVar1 == 3) { + uVar4 = *(uint *)((uint)DAT_1028_07d1 * 4 + 0x98e); + iVar1 = *(int *)((uint)DAT_1028_07d1 * 4 + 0x990); + uVar2 = (uint)DAT_1028_07d1; + *(int *)(uVar2 * 4 + 0x98e) = uVar4 + 50000; + *(int *)(uVar2 * 4 + 0x990) = iVar1 + (uint)(0x3caf < uVar4); + uVar5 = *(undefined2 *)((uint)DAT_1028_07d1 * 4 + 0x990); + uVar3 = FUN_1020_08a9(); + FUN_1000_bda2(param_1,uVar3,uVar5); + } + else if (iVar1 == 4) { + uVar4 = *(uint *)((uint)DAT_1028_07d1 * 4 + 0x98e); + iVar1 = *(int *)((uint)DAT_1028_07d1 * 4 + 0x990); + uVar2 = (uint)DAT_1028_07d1; + *(int *)(uVar2 * 4 + 0x98e) = uVar4 + 0x86a0; + *(int *)(uVar2 * 4 + 0x990) = iVar1 + 1 + (uint)(0x795f < uVar4); + uVar5 = *(undefined2 *)((uint)DAT_1028_07d1 * 4 + 0x990); + uVar3 = FUN_1020_08a9(); + FUN_1000_bda2(param_1,uVar3,uVar5); + } + else if (iVar1 == 5) { + uVar4 = *(uint *)((uint)DAT_1028_07d1 * 4 + 0x98e); + iVar1 = *(int *)((uint)DAT_1028_07d1 * 4 + 0x990); + uVar2 = (uint)DAT_1028_07d1; + *(int *)(uVar2 * 4 + 0x98e) = uVar4 + 0xd40; + *(int *)(uVar2 * 4 + 0x990) = iVar1 + 3 + (uint)(0xf2bf < uVar4); + uVar5 = *(undefined2 *)((uint)DAT_1028_07d1 * 4 + 0x990); + uVar3 = FUN_1020_08a9(); + FUN_1000_bda2(param_1,uVar3,uVar5); + } + else if (iVar1 == 6) { + uVar5 = *(undefined2 *)((uint)DAT_1028_07d1 * 4 + 0x990); + uVar3 = FUN_1020_08a9(); + FUN_1000_bc36(param_1,uVar3,uVar5); + uVar4 = (uint)DAT_1028_07d1; + *(undefined2 *)(uVar4 * 4 + 0x98e) = 0; + *(undefined2 *)(uVar4 * 4 + 0x990) = 0; + FUN_1000_bda2(param_1,0,0); + } + else if ((iVar1 == 7) && (DAT_1028_399a != 0)) { + if ((param_2 < 0) || (DAT_1028_399a != param_2)) { + *(undefined1 *)((int)*(undefined4 *)(param_1 + 6) + 0xbe0) = 1; + DAT_1028_0874 = 1; + } + } + return; +} + + +/* ===== 1000:c79c FUN_1000_c79c ===== */ + +void __stdcall16far FUN_1000_c79c(int param_1) + +{ + uint *puVar1; + int *piVar2; + byte bVar3; + undefined2 uVar4; + int iVar5; + char cVar6; + uint uVar7; + uint uVar8; + uint uVar9; + uint uVar10; + uint uVar11; + uint extraout_DX; + uint extraout_DX_00; + int extraout_DX_01; + uint extraout_DX_02; + uint extraout_DX_03; + uint extraout_DX_04; + uint uVar12; + int extraout_DX_05; + int extraout_DX_06; + uint in_BX; + int iVar13; + int iVar14; + int iVar15; + int iVar16; + int iVar17; + int iVar18; + undefined2 uVar19; + undefined2 unaff_SS; + bool bVar20; + bool bVar21; + uint uVar22; + int in_stack_0000d8a2; + uint in_stack_0000d8b0; + int in_stack_0000d8b2; + uint in_stack_0000d8c2; + int in_stack_0000d8cc; + int in_stack_0000d8ce; + int in_stack_0000d8d0; + undefined2 local_7c; + uint local_7a; + uint local_78; + undefined2 local_76; + uint local_74; + uint local_72; + uint local_70; + uint local_6e; + uint local_68; + uint local_66; + uint local_64; + uint local_62; + undefined2 local_40; + uint local_3e; + undefined2 local_3c; + uint local_16; + uint local_14; + uint local_12; + uint local_10; + uint local_e; + uint local_c; + uint local_8; + int local_4; + + uVar19 = (undefined2)((ulong)*(undefined4 *)(param_1 + 6) >> 0x10); + iVar13 = (int)*(undefined4 *)(param_1 + 6); + puVar1 = (uint *)(iVar13 + 0x4d); + uVar10 = *puVar1; + *puVar1 = *puVar1 + 1; + *(int *)(iVar13 + 0x4f) = *(int *)(iVar13 + 0x4f) + (uint)(0xfffe < uVar10); + iVar5 = DAT_1028_0871; + bVar3 = *(byte *)(iVar13 + 0x61); + if (bVar3 == 0) { + return; + } + local_8 = 1; + while( true ) { + if (1 < *(byte *)((int)*(undefined4 *)(param_1 + 6) + 0x61)) { + FUN_1000_c36b(); + } + iVar13 = DAT_1028_07d5; + uVar19 = (undefined2)((ulong)*(undefined4 *)(param_1 + 6) >> 0x10); + iVar14 = (int)*(undefined4 *)(param_1 + 6); + *(uint *)(iVar14 + 0xbc2) = DAT_1028_07d3; + *(int *)(iVar14 + 0xbc4) = iVar13; + iVar13 = DAT_1028_07d9; + *(uint *)(iVar14 + 0xbc6) = DAT_1028_07d7; + *(int *)(iVar14 + 0xbc8) = iVar13; + if (iVar5 != 0) break; +LAB_1000_ea63: + uVar19 = (undefined2)((ulong)*(undefined4 *)(param_1 + 6) >> 0x10); + iVar13 = (int)*(undefined4 *)(param_1 + 6); + if ((*(char *)(iVar13 + 0xbdd) != '\0') && (*(char *)(iVar13 + 0xbe2) == '\0')) { + FUN_1000_9f73(); + } + if (1 < *(byte *)((int)*(undefined4 *)(param_1 + 6) + 0x61)) { + FUN_1000_c426(); + } + if (local_8 == bVar3) { + return; + } + local_8 = local_8 + 1; + } + iVar13 = 1; +LAB_1000_c839: + uVar19 = (undefined2)((ulong)*(undefined4 *)(param_1 + 6) >> 0x10); + iVar15 = (int)*(undefined4 *)(param_1 + 6); + uVar10 = *(uint *)(iVar15 + 0xbae); + iVar14 = *(int *)(iVar15 + 0xbb0); + uVar11 = *(uint *)(iVar15 + 0x5a); + iVar16 = *(int *)(iVar15 + 0x5c); + *(int *)(iVar15 + 0xbae) = uVar10 + *(uint *)(iVar15 + 0x5a); + *(int *)(iVar15 + 0xbb0) = iVar14 + iVar16 + (uint)CARRY2(uVar10,uVar11); + FUN_1020_100b(); + FUN_1020_0ffd(); + FUN_1020_0ff1(); + FUN_1020_100b(); + FUN_1020_0ffd(); + FUN_1020_0ff1(); + local_14 = extraout_DX; + FUN_1020_0fe5(); + FUN_1020_10be(); + FUN_1020_0ff7(); + local_16 = FUN_1020_1017(); + uVar19 = (undefined2)((ulong)*(undefined4 *)(param_1 + 6) >> 0x10); + iVar16 = (int)*(undefined4 *)(param_1 + 6); + iVar14 = *(int *)(iVar16 + 0x58); + if ((iVar14 < (int)local_14) || + ((uVar10 = in_BX, iVar14 <= (int)local_14 && (*(uint *)(iVar16 + 0x56) < local_16)))) { + FUN_1020_100b(); + FUN_1020_100b(); + FUN_1020_0ffd(); + iVar14 = *(int *)((int)*(undefined4 *)(param_1 + 6) + 0xbac); + FUN_1020_100b(); + FUN_1020_0ff7(); + uVar11 = FUN_1020_1017(); + uVar19 = (undefined2)((ulong)*(undefined4 *)(param_1 + 6) >> 0x10); + iVar15 = (int)*(undefined4 *)(param_1 + 6); + uVar10 = *(uint *)(iVar15 + 0xbaa); + iVar16 = *(int *)(iVar15 + 0xbac); + *(int *)(iVar15 + 0xbaa) = uVar10 - uVar11; + *(int *)(iVar15 + 0xbac) = (iVar16 - iVar14) - (uint)(uVar10 < uVar11); + FUN_1020_100b(); + FUN_1020_100b(); + FUN_1020_0ffd(); + uVar10 = *(uint *)((int)*(undefined4 *)(param_1 + 6) + 0xbb0); + FUN_1020_100b(); + FUN_1020_0ff7(); + uVar22 = FUN_1020_1017(); + uVar19 = (undefined2)((ulong)*(undefined4 *)(param_1 + 6) >> 0x10); + iVar16 = (int)*(undefined4 *)(param_1 + 6); + uVar11 = *(uint *)(iVar16 + 0xbae); + iVar14 = *(int *)(iVar16 + 0xbb0); + *(int *)(iVar16 + 0xbae) = uVar11 - uVar22; + *(int *)(iVar16 + 0xbb0) = (iVar14 - uVar10) - (uint)(uVar11 < uVar22); + local_16 = *(uint *)(iVar16 + 0x56); + local_14 = *(uint *)(iVar16 + 0x58); + } + iVar14 = DAT_1028_07d5; + uVar19 = (undefined2)((ulong)*(undefined4 *)(param_1 + 6) >> 0x10); + iVar16 = (int)*(undefined4 *)(param_1 + 6); + *(uint *)(iVar16 + 0xbba) = DAT_1028_07d3; + *(int *)(iVar16 + 0xbbc) = iVar14; + iVar14 = DAT_1028_07d9; + *(uint *)(iVar16 + 0xbbe) = DAT_1028_07d7; + *(int *)(iVar16 + 0xbc0) = iVar14; + DAT_1028_07db = DAT_1028_07d3 + *(uint *)(iVar16 + 0xbaa); + DAT_1028_07dd = + DAT_1028_07d5 + *(int *)(iVar16 + 0xbac) + + (uint)CARRY2(DAT_1028_07d3,*(uint *)(iVar16 + 0xbaa)); + DAT_1028_07df = DAT_1028_07d7 + *(uint *)(iVar16 + 0xbae); + DAT_1028_07e1 = + DAT_1028_07d9 + *(int *)(iVar16 + 0xbb0) + + (uint)CARRY2(DAT_1028_07d7,*(uint *)(iVar16 + 0xbae)); + local_e = *(uint *)(iVar16 + 0xbaa); + local_c = *(uint *)(iVar16 + 0xbac); + local_12 = *(uint *)(iVar16 + 0xbae); + local_10 = *(uint *)(iVar16 + 0xbb0); + uVar11 = *(uint *)(iVar16 + 0xbac); + FUN_1020_100b(); + FUN_1020_100b(); + uVar19 = (undefined2)((ulong)*(undefined4 *)(param_1 + 6) >> 0x10); + iVar14 = (int)*(undefined4 *)(param_1 + 6); + local_40 = *(undefined2 *)(iVar14 + 0xbce); + local_3e = *(uint *)(iVar14 + 0xbd0); + local_3c = *(undefined2 *)(iVar14 + 0xbd2); + iVar14 = 0; + local_70 = 0x423f; + local_6e = 0xf; + in_BX = local_3e; + if (((((DAT_1028_07dd < 0) || + (((DAT_1028_07dd < 1 && (DAT_1028_07db == 0)) || (5 < DAT_1028_07dd)))) || + (((4 < DAT_1028_07dd && (0x3020 < DAT_1028_07db)) || (DAT_1028_07e1 < 0)))) || + ((DAT_1028_07e1 < 1 && (DAT_1028_07df == 0)))) || + ((7 < DAT_1028_07e1 || ((6 < DAT_1028_07e1 && (0x4e0 < DAT_1028_07df)))))) { + if (*(byte *)((int)*(undefined4 *)(param_1 + 6) + 0x61) < 2) { + FUN_1000_ae6e(); + } + else { + *(undefined1 *)((local_8 + 0xad) * 0x53 + 0x98f) = 0; + DAT_1028_0874 = '\0'; + } + } + if ((DAT_1028_07d9 < 3) || ((DAT_1028_07d9 < 4 && (DAT_1028_07d7 < 0xd860)))) { + uVar22 = 1; + } + else { + uVar22 = 2; + } + local_4 = 1; + do { + iVar16 = local_4 * 0x53; + bVar21 = false; + if ((((*(uint *)(iVar16 + 0x9a4) & uVar22) != 0) && (*(char *)(iVar16 + 0x98f) == '\x01')) && + (cVar6 = FUN_1000_9b69(), cVar6 != '\0')) { + cVar6 = *(char *)CONCAT22(0x1028,(char *)(iVar16 + 0x95b)); + uVar12 = in_BX; + if (cVar6 == '\x01') { + if (0xaf - local_8 != local_4) { + FUN_1020_100b(); + FUN_1020_0ffd(); + FUN_1020_0ff1(); + FUN_1020_100b(); + FUN_1020_0ffd(); + FUN_1020_0ff1(); + uVar7 = extraout_DX_00; + FUN_1020_0fe5(); + FUN_1020_10be(); + FUN_1020_0ff7(); + uVar9 = FUN_1020_1017(); + if ((int)uVar7 < 0) { + bVar20 = uVar9 != 0; + uVar9 = -uVar9; + uVar7 = (~uVar7 + 1) - (uint)bVar20; + } + uVar12 = *(uint *)(iVar16 + 0x981); + uVar8 = FUN_1020_1017(); + local_68 = uVar9 - uVar8; + local_66 = (uVar7 - uVar12) - (uint)(uVar9 < uVar8); + if ((*(char *)(iVar16 + 0x95c) == '\x01') && + (((int)local_66 < (int)local_14 || + (((int)local_66 <= (int)local_14 && (local_68 <= local_16)))))) { +LAB_1000_cd0a: + if (*(char *)(iVar16 + 0x95c) == '\x01') { + uVar19 = (undefined2)((ulong)*(undefined4 *)(param_1 + 6) >> 0x10); + iVar15 = (int)*(undefined4 *)(param_1 + 6); + local_74 = *(int *)(iVar15 + 0xbc0) + DAT_1028_07e1 + + (uint)CARRY2(*(uint *)(iVar15 + 0xbbe),DAT_1028_07df); + uVar12 = FUN_1020_08e6(); + local_72 = (*(int *)(iVar16 + 0x973) - local_74) - + (uint)(*(uint *)(iVar16 + 0x971) < uVar12); + FUN_1020_100b(); + FUN_1020_1017(); + local_76 = FUN_1020_100b(); + uVar19 = (undefined2)((ulong)*(undefined4 *)(param_1 + 6) >> 0x10); + iVar15 = (int)*(undefined4 *)(param_1 + 6); + iVar15 = *(int *)(iVar15 + 0xbbc) + DAT_1028_07dd + + (uint)CARRY2(*(uint *)(iVar15 + 0xbba),DAT_1028_07db); + local_7a = 0; + uVar12 = FUN_1020_08e6(); + local_78 = (iVar15 - *(int *)(iVar16 + 0x96f)) - + (uint)(uVar12 < *(uint *)(iVar16 + 0x96d)); + FUN_1020_100b(); + FUN_1020_1017(); + local_7c = FUN_1020_100b(); + } + else { + uVar19 = (undefined2)((ulong)*(undefined4 *)(param_1 + 6) >> 0x10); + iVar15 = (int)*(undefined4 *)(param_1 + 6); + local_74 = *(int *)(iVar15 + 0xbc0) + DAT_1028_07e1 + + (uint)CARRY2(*(uint *)(iVar15 + 0xbbe),DAT_1028_07df); + uVar12 = FUN_1020_08e6(); + local_72 = (*(int *)(iVar16 + 0x973) - local_74) - + (uint)(*(uint *)(iVar16 + 0x971) < uVar12); + FUN_1020_100b(); + FUN_1020_1017(); + local_76 = FUN_1020_100b(); + uVar19 = (undefined2)((ulong)*(undefined4 *)(param_1 + 6) >> 0x10); + iVar15 = (int)*(undefined4 *)(param_1 + 6); + iVar15 = *(int *)(iVar15 + 0xbbc) + DAT_1028_07dd + + (uint)CARRY2(*(uint *)(iVar15 + 0xbba),DAT_1028_07db); + local_7a = 0; + uVar12 = FUN_1020_08e6(); + local_78 = (iVar15 - *(int *)(iVar16 + 0x96f)) - + (uint)(uVar12 < *(uint *)(iVar16 + 0x96d)); + FUN_1020_100b(); + FUN_1020_1017(); + local_7c = FUN_1020_100b(); + } + if (*(char *)(iVar16 + 0x95c) == '\x02') { + if ((char)local_76 != '\0') { + local_72 = local_72 ^ 0x8000; + } + if ((char)local_7c != '\0') { + local_78 = local_78 ^ 0x8000; + } + } + FUN_1020_0ffd(); + FUN_1020_0ff1(); + uVar12 = local_74; + FUN_1020_0ffd(); + FUN_1020_0ff1(); + iVar15 = extraout_DX_01; + FUN_1020_0fe5(); + FUN_1020_10be(); + FUN_1020_0ff7(); + iVar17 = FUN_1020_1017(); + if ((iVar15 < 1) && ((iVar15 < 0 || (iVar17 == 0)))) { + local_64 = 0; + local_62 = 0; + } + else { + FUN_1020_100b(); + FUN_1020_0ff7(); + local_62 = uVar11; + uVar12 = uVar10; + FUN_1020_0ff7(); + FUN_1020_0feb(); + FUN_1020_0ffd(); + local_64 = FUN_1020_1017(); + } + if ((int)local_62 < 0) { + uVar7 = local_68; + uVar12 = local_66; + if ((int)local_66 < 0) { + uVar7 = -local_68; + uVar12 = (~local_66 + 1) - (uint)(local_68 != 0); + } + uVar9 = local_64; + uVar8 = local_62; + if ((int)local_62 < 0) { + uVar9 = -local_64; + uVar8 = (~local_62 + 1) - (uint)(local_64 != 0); + } + if (((int)uVar12 < (int)uVar8) || (((int)uVar12 <= (int)uVar8 && (uVar7 <= uVar9)))) { + bVar21 = 0xf447 < local_68; + local_68 = local_68 + 3000; + local_66 = local_66 + bVar21; + bVar21 = true; + } + } + } + else if (*(char *)(iVar16 + 0x95c) == '\x02') { + iVar15 = (~local_66 + 1) - (uint)(local_68 != 0); + if ((iVar15 < (int)local_14) || + ((uVar12 = local_14, iVar15 <= (int)local_14 && + (-local_68 < local_16 || -local_16 == local_68)))) goto LAB_1000_cd0a; + } + } + } + else if (cVar6 == '\x04') { + if (DAT_1028_07c6 == '\0') { + DAT_1028_0875 = '\0'; + uVar12 = *(uint *)(iVar16 + 0x97f); + iVar15 = *(int *)(iVar16 + 0x981); + iVar17 = FUN_1020_1017(); + if ((iVar15 < 1) && ((iVar15 < 0 || (iVar17 == 0)))) { + cVar6 = FUN_1000_9ae0(); + if ((cVar6 != '\0') && (((local_4 == 0x99 || (local_4 == 0x9a)) || (local_4 == 6)))) { + FUN_1020_100b(); + FUN_1020_0ff7(); + local_e = FUN_1020_1017(); + FUN_1020_100b(); + FUN_1020_14c1(); + FUN_1020_0ff7(); + uVar12 = 0; + uVar7 = 0; + FUN_1020_0feb(); + FUN_1020_0ff7(); + iVar15 = FUN_1020_1017(); + local_12 = -iVar15; + local_10 = (~uVar7 + 1) - (uint)(iVar15 != 0); + DAT_1028_07db = DAT_1028_07d3 + local_e; + DAT_1028_07dd = DAT_1028_07d5 + local_c + (uint)CARRY2(DAT_1028_07d3,local_e); + DAT_1028_07df = DAT_1028_07d7 + local_12; + DAT_1028_07e1 = DAT_1028_07d9 + local_10 + (uint)CARRY2(DAT_1028_07d7,local_12); + cVar6 = FUN_1000_9b69(); + if (cVar6 == '\0') { + *(undefined1 *)(local_4 * 0x53 + 0x98f) = 0; + } + FUN_1000_b3f3(); + } + } + else { + FUN_1020_100b(); + FUN_1020_0ffd(); + FUN_1020_0ff1(); + FUN_1020_100b(); + FUN_1020_0ffd(); + FUN_1020_0ff1(); + local_66 = extraout_DX_02; + FUN_1020_0fe5(); + FUN_1020_10be(); + FUN_1020_0ff7(); + local_68 = FUN_1020_1017(); + if ((int)local_66 < 0) { + bVar20 = local_68 != 0; + local_68 = -local_68; + local_66 = (~local_66 + 1) - (uint)bVar20; + } + FUN_1020_100b(); + FUN_1020_0ffd(); + FUN_1020_0ff1(); + FUN_1020_100b(); + FUN_1020_0ffd(); + FUN_1020_0ff1(); + uVar7 = extraout_DX_03; + FUN_1020_0fe5(); + FUN_1020_10be(); + FUN_1020_0ff7(); + uVar9 = FUN_1020_1017(); + if ((int)uVar7 < 0) { + bVar20 = uVar9 != 0; + uVar9 = -uVar9; + uVar7 = (~uVar7 + 1) - (uint)bVar20; + } + uVar12 = *(uint *)(iVar16 + 0x97f); + iVar15 = *(int *)(iVar16 + 0x981); + uVar8 = FUN_1020_1017(); + if (((int)uVar7 < iVar15) || (((int)uVar7 <= iVar15 && (uVar9 <= uVar8)))) { + if ((*(uint *)(iVar16 + 0x99c) & 0x4000) != 0x4000) { + *(uint *)(iVar16 + 0x99c) = *(uint *)(iVar16 + 0x99c) | 0x4000; + FUN_1008_0002(); + FUN_1020_08a9(); + FUN_1000_bc36(); + if (local_4 == 0x95) { + DAT_1028_39de = 0; + *(undefined1 *) + ((int)*(undefined4 *)(param_1 + 6) + (uint)DAT_1028_07d1 * 0xaf + 0xf6) = 0; + FUN_1000_b3f3(); + FUN_1000_c4e1(); + GETDC(); + *(undefined2 *)((uint)DAT_1028_07d1 * 2 + 0x9a4) = 0; + FUN_1000_0002(); + FUN_1008_093f(); + RELEASEDC(); + } + FUN_1000_b476(); + FUN_1020_14c1(); + FUN_1020_0ff7(); + FUN_1020_0feb(); + FUN_1020_100b(); + FUN_1020_0ff7(); + local_e = FUN_1020_1017(); + FUN_1020_14c1(); + FUN_1020_0ff7(); + uVar12 = 0xa3d; + FUN_1020_0feb(); + FUN_1020_100b(); + FUN_1020_0ff7(); + local_12 = FUN_1020_1017(); + } + } + else { + *(uint *)(iVar16 + 0x99c) = *(uint *)(iVar16 + 0x99c) & 0xbfff; + } + } + } + } + else if (cVar6 == '\x02') { + local_72 = (*(int *)(iVar16 + 0x977) - *(int *)(iVar16 + 0x96f)) - + (uint)(*(uint *)(iVar16 + 0x975) < *(uint *)(iVar16 + 0x96d)); + local_76 = FUN_1020_100b(); + local_78 = (*(int *)(iVar16 + 0x97b) - *(int *)(iVar16 + 0x973)) - + (uint)(*(uint *)(iVar16 + 0x979) < *(uint *)(iVar16 + 0x971)); + local_7a = in_BX; + local_7c = FUN_1020_100b(); + FUN_1020_0ffd(); + FUN_1020_0ff1(); + FUN_1020_0ffd(); + FUN_1020_0ff1(); + FUN_1020_0fe5(); + FUN_1020_10be(); + FUN_1020_0ff7(); + FUN_1020_1017(); + FUN_1020_100b(); + FUN_1020_0ffd(); + FUN_1020_0ffd(); + FUN_1020_100b(); + FUN_1020_0ff7(); + FUN_1020_0ffd(); + uVar19 = (undefined2)((ulong)*(undefined4 *)(param_1 + 6) >> 0x10); + iVar15 = (int)*(undefined4 *)(param_1 + 6); + uVar12 = (*(int *)(iVar15 + 0xbbc) - *(int *)(iVar16 + 0x96f)) - + (uint)(*(uint *)(iVar15 + 0xbba) < *(uint *)(iVar16 + 0x96d)); + FUN_1020_100b(); + FUN_1020_0ff7(); + FUN_1020_0feb(); + FUN_1020_0ffd(); + local_66 = uVar12 & 0x7fff; + local_68 = FUN_1020_1017(); + FUN_1020_100b(); + FUN_1020_0ffd(); + FUN_1020_0ffd(); + FUN_1020_0ff7(); + local_62 = local_78; + uVar12 = local_7a; + FUN_1020_0ffd(); + FUN_1020_0ff7(); + FUN_1020_0feb(); + FUN_1020_0ffd(); + local_64 = FUN_1020_1017(); + if ((((int)local_66 < (int)local_14) || + ((local_74 = in_BX, (int)local_66 <= (int)local_14 && + (local_74 = in_BX, local_68 <= local_16)))) && + (((int)local_62 < 0 || + ((local_74 = in_BX, (int)local_62 < 1 && (local_74 = in_BX, local_64 < 0xb)))))) { + uVar12 = local_66 - (local_68 < 10); + uVar7 = local_64; + uVar9 = local_62; + if ((int)local_62 < 0) { + uVar7 = -local_64; + uVar9 = (~local_62 + 1) - (uint)(local_64 != 0); + } + if (((int)uVar12 < (int)uVar9) || + ((local_74 = in_BX, (int)uVar12 <= (int)uVar9 && + (local_74 = in_BX, local_68 - 10 <= uVar7)))) { + uVar12 = (*(int *)(iVar16 + 0x96f) - DAT_1028_07d5) - + (uint)(*(uint *)(iVar16 + 0x96d) < DAT_1028_07d3); + uVar7 = FUN_1020_08a9(); + iVar15 = (*(int *)(iVar16 + 0x973) - DAT_1028_07d9) - + (uint)(*(uint *)(iVar16 + 0x971) < DAT_1028_07d7); + uVar9 = FUN_1020_08a9(); + uVar8 = (iVar15 - uVar12) - (uint)(uVar9 < uVar7); + if ((uVar8 < 0x8000) || + ((local_74 = in_BX, -2 < (int)uVar8 && (local_74 = in_BX, 0xfff5 < uVar9 - uVar7)))) + { + uVar12 = (*(int *)(iVar16 + 0x977) - DAT_1028_07d5) - + (uint)(*(uint *)(iVar16 + 0x975) < DAT_1028_07d3); + uVar7 = FUN_1020_08a9(); + iVar15 = (*(int *)(iVar16 + 0x97b) - DAT_1028_07d9) - + (uint)(*(uint *)(iVar16 + 0x979) < DAT_1028_07d7); + uVar9 = FUN_1020_08a9(); + iVar15 = (iVar15 - uVar12) - (uint)(uVar9 < uVar7); + if ((iVar15 < 0) || + ((local_74 = in_BX, iVar15 < 1 && (local_74 = in_BX, uVar9 - uVar7 < 0xb)))) { + bVar21 = true; + local_74 = in_BX; + } + } + } + } + } + else if (cVar6 == '\x03') { + FUN_1020_100b(); + FUN_1020_0ffd(); + FUN_1020_0ff1(); + FUN_1020_100b(); + FUN_1020_0ffd(); + FUN_1020_0ff1(); + uVar12 = extraout_DX_04; + FUN_1020_0fe5(); + FUN_1020_10be(); + FUN_1020_0ff7(); + uVar7 = FUN_1020_1017(); + if ((int)uVar12 < 0) { + bVar20 = uVar7 != 0; + uVar7 = -uVar7; + uVar12 = (~uVar12 + 1) - (uint)bVar20; + } + uVar9 = *(uint *)(iVar16 + 0x981); + uVar8 = FUN_1020_1017(); + local_68 = uVar7 - uVar8; + local_66 = (uVar12 - uVar9) - (uint)(uVar7 < uVar8); + uVar12 = (int)local_8 >> 0xf; + if (((((int)local_66 < -1) || (((int)local_66 < 0 && (local_68 < 0xd509)))) && + ((*(int *)(iVar16 + 0x99e) == 0 || + (((*(int *)(iVar16 + 0x99e) != 99 && + (*(char *)((int)*(undefined4 *)(param_1 + 6) + 0x61) == '\x01')) || + ((uVar9 = uVar12, -1 < (int)local_8 && (*(uint *)(iVar16 + 0x99e) == local_8)))))))) + && ((local_4 != 0x94 || (DAT_1028_0875 == '\0')))) { + uVar19 = (undefined2)((ulong)*(undefined4 *)(param_1 + 6) >> 0x10); + iVar17 = (int)*(undefined4 *)(param_1 + 6); + iVar15 = *(int *)(iVar17 + 0xbcc); + if ((iVar15 < 0) || ((iVar15 < 1 && (*(uint *)(iVar17 + 0xbca) < 300)))) { + uVar19 = (undefined2)((ulong)*(undefined4 *)(param_1 + 6) >> 0x10); + iVar15 = (int)*(undefined4 *)(param_1 + 6); + puVar1 = (uint *)(iVar15 + 0xbba); + uVar12 = *(uint *)(iVar16 + 0x96d) - *puVar1; + uVar7 = (*(int *)(iVar16 + 0x96f) - *(int *)(iVar15 + 0xbbc)) - + (uint)(*(uint *)(iVar16 + 0x96d) < *puVar1); + if ((int)uVar7 < 0) { + bVar20 = uVar12 != 0; + uVar12 = -uVar12; + uVar7 = (~uVar7 + 1) - (uint)bVar20; + } + if (((int)uVar7 < 0) || (((int)uVar7 < 1 && (uVar12 < 500)))) { + uVar19 = (undefined2)((ulong)*(undefined4 *)(param_1 + 6) >> 0x10); + iVar15 = (int)*(undefined4 *)(param_1 + 6); + puVar1 = (uint *)(iVar15 + 0xbbe); + uVar12 = *(uint *)(iVar16 + 0x971) - *puVar1; + uVar7 = (*(int *)(iVar16 + 0x973) - *(int *)(iVar15 + 0xbc0)) - + (uint)(*(uint *)(iVar16 + 0x971) < *puVar1); + if ((int)uVar7 < 0) { + bVar20 = uVar12 != 0; + uVar12 = -uVar12; + uVar7 = (~uVar7 + 1) - (uint)bVar20; + } + if (((int)uVar7 < 0) || (((int)uVar7 < 1 && (uVar12 < 500)))) { + uVar12 = local_c; + if ((int)local_c < 0) { + bVar20 = local_e != 0; + local_e = -local_e; + uVar12 = (~local_c + 1) - (uint)bVar20; + } + if (((int)uVar12 < 0) || (((int)uVar12 < 1 && (local_e < 500)))) { + uVar12 = local_10; + if ((int)local_10 < 0) { + bVar20 = local_12 != 0; + local_12 = -local_12; + uVar12 = (~local_10 + 1) - (uint)bVar20; + } + if (((int)uVar12 < 0) || (((int)uVar12 < 1 && (local_12 < 500)))) { + local_e = 0; + local_c = 0; + local_12 = 0; + local_10 = 0; + uVar19 = (undefined2)((ulong)*(undefined4 *)(param_1 + 6) >> 0x10); + iVar15 = (int)*(undefined4 *)(param_1 + 6); + if (*(int *)(iVar15 + 0xbca) == 0 && *(int *)(iVar15 + 0xbcc) == 0) { + *(uint *)(iVar16 + 0x99e) = local_8; + FUN_1008_0002(); + } + uVar12 = uVar9; + if (local_4 == 0x59) { + uVar19 = (undefined2)((ulong)*(undefined4 *)(param_1 + 6) >> 0x10); + iVar15 = (int)*(undefined4 *)(param_1 + 6); + *(undefined2 *)(iVar15 + 0xbca) = 300; + *(undefined2 *)(iVar15 + 0xbcc) = 0; + } + else { + uVar19 = (undefined2)((ulong)*(undefined4 *)(param_1 + 6) >> 0x10); + iVar17 = (int)*(undefined4 *)(param_1 + 6); + uVar7 = *(uint *)(iVar17 + 0xbca); + iVar15 = *(int *)(iVar17 + 0xbcc); + *(int *)(iVar17 + 0xbca) = uVar7 + 5; + *(int *)(iVar17 + 0xbcc) = iVar15 + (uint)(0xfffa < uVar7); + } + goto LAB_1000_e060; + } + } + } + } + if ((DAT_1028_07d5 < *(int *)(iVar16 + 0x96f)) || + ((DAT_1028_07d5 <= *(int *)(iVar16 + 0x96f) && + (DAT_1028_07d3 < *(uint *)(iVar16 + 0x96d))))) { + iVar15 = *(int *)((int)*(undefined4 *)(param_1 + 6) + 0x5c); + uVar12 = FUN_1020_08a9(); + FUN_1020_100b(); + FUN_1020_0ff7(); + uVar7 = FUN_1020_1017(); + local_e = uVar7 + uVar12; + local_c = local_c + iVar15 + (uint)CARRY2(uVar7,uVar12); + } + else { + iVar15 = *(int *)((int)*(undefined4 *)(param_1 + 6) + 0x5c); + uVar12 = FUN_1020_08a9(); + FUN_1020_100b(); + FUN_1020_0ff7(); + uVar7 = FUN_1020_1017(); + local_e = uVar7 - uVar12; + local_c = (local_c - iVar15) - (uint)(uVar7 < uVar12); + } + if ((DAT_1028_07d9 < *(int *)(iVar16 + 0x973)) || + ((DAT_1028_07d9 <= *(int *)(iVar16 + 0x973) && + (DAT_1028_07d7 < *(uint *)(iVar16 + 0x971))))) { + uVar12 = *(uint *)((int)*(undefined4 *)(param_1 + 6) + 0x5c); + uVar7 = FUN_1020_08a9(); + FUN_1020_100b(); + FUN_1020_0ff7(); + uVar9 = FUN_1020_1017(); + local_12 = uVar9 + uVar7; + local_10 = local_10 + uVar12 + (uint)CARRY2(uVar9,uVar7); + } + else { + uVar12 = *(uint *)((int)*(undefined4 *)(param_1 + 6) + 0x5c); + uVar7 = FUN_1020_08a9(); + FUN_1020_100b(); + FUN_1020_0ff7(); + uVar9 = FUN_1020_1017(); + local_12 = uVar9 - uVar7; + local_10 = (local_10 - uVar12) - (uint)(uVar9 < uVar7); + } + } + else if (local_4 == 0x59) { + uVar12 = uVar9; + if (DAT_1028_0874 == '\0') { + DAT_1028_07ca = 1; + iVar15 = FUN_1020_14a4(); + if (iVar15 == 0) { + DAT_1028_086f = 1; + } + else if (iVar15 == 1) { + DAT_1028_086f = 6; + } + else if (iVar15 == 2) { + DAT_1028_086f = 7; + } + else if (iVar15 == 3) { + DAT_1028_086f = 0x12; + } + DAT_1028_0873 = 1; + *(undefined1 *)((int)*(undefined4 *)(param_1 + 6) + 0xbdf) = 1; + local_40 = 0; + local_3e = 0; + local_3c = 0; + for (iVar15 = 0xc; *(undefined1 *)(iVar15 * 0x53 + 0x98f) = 0, uVar12 = uVar9, + iVar15 != 0x14; iVar15 = iVar15 + 1) { + } + } + } + else { + if ((local_4 < 0x81) || (0x85 < local_4)) { + if (local_4 == 0x94) { + *(undefined1 *) + ((int)*(undefined4 *)(param_1 + 6) + (uint)DAT_1028_07d1 * 0x14 + 0x47b) = 1; + FUN_1000_b30b(); + } + } + else { + uVar12 = 5000; + iVar17 = 0; + iVar15 = 1; + while( true ) { + if (*(int *)((iVar15 + 0x80) * 0x53 + 0x99e) != 0) { + uVar12 = FUN_1020_08a9(); + } + if (iVar15 == 5) break; + iVar15 = iVar15 + 1; + } + uVar7 = *(uint *)((uint)DAT_1028_07d1 * 4 + 0x98e); + iVar15 = *(int *)((uint)DAT_1028_07d1 * 4 + 0x990); + uVar9 = (uint)DAT_1028_07d1; + *(int *)(uVar9 * 4 + 0x98e) = uVar7 + uVar12; + *(int *)(uVar9 * 4 + 0x990) = iVar15 + iVar17 + (uint)CARRY2(uVar7,uVar12); + if ((iVar17 == 2) && (uVar12 == 0x7100)) { + FUN_1020_08a9(); + FUN_1000_bc36(); + uVar12 = (uint)DAT_1028_07d1; + *(undefined2 *)(uVar12 * 4 + 0x98e) = 0; + *(undefined2 *)(uVar12 * 4 + 0x990) = 0; + *(char *)(DAT_1028_07d1 + 0x9a1) = *(char *)(DAT_1028_07d1 + 0x9a1) + '\x01'; + piVar2 = (int *)((uint)DAT_1028_07d1 * 2 + 0x81f); + *piVar2 = *piVar2 + 1; + FUN_1000_a604(); + GETDC(); + RELEASEDC(); + if (((DAT_1028_07c7 == '\0') && (DAT_1028_07c8 == '\0')) && (DAT_1028_0874 == '\0')) + { + DAT_1028_0851 = 0; + DAT_1028_0853 = 0; + DAT_1028_07c8 = '\x01'; + *(undefined1 *)((int)*(undefined4 *)(param_1 + 6) + 0xbdd) = 0; + } + DAT_1028_0874 = '\0'; + } + else { + *(undefined1 *) + ((int)*(undefined4 *)(param_1 + 6) + (uint)DAT_1028_07d1 * 0x14 + local_4 + 0x3f5) + = 1; + FUN_1000_b30b(); + } + uVar9 = 0; + FUN_1020_08a9(); + FUN_1000_bda2(); + } + uVar19 = (undefined2)((ulong)*(undefined4 *)(param_1 + 6) >> 0x10); + iVar15 = (int)*(undefined4 *)(param_1 + 6); + *(undefined2 *)(iVar15 + 0xbca) = 0; + *(undefined2 *)(iVar15 + 0xbcc) = 0; + uVar12 = uVar9; + if (*(char *)(iVar15 + 0x61) == '\x01') { + if (local_4 == 0x94) { + DAT_1028_399a = 2; + } + else { + *(undefined2 *)(iVar16 + 0x99e) = 99; + } + if (DAT_1028_07c6 == '\0') { + *(undefined1 *)((int)*(undefined4 *)(param_1 + 6) + 0xbe2) = 1; + } + else { + FUN_1000_ae6e(); + uVar12 = uVar9; + } + } + else { + *(undefined1 *)((int)*(undefined4 *)(param_1 + 6) + 0xbe1) = 1; + *(undefined1 *)((local_8 + 0xad) * 0x53 + 0x98f) = 0; + *(undefined2 *)(iVar16 + 0x99e) = 2; + } + } + } + else if (((local_66 < 0x8000) || ((-2 < (int)local_66 && (0xd508 < local_68)))) && + ((uVar9 = uVar12, -1 < (int)local_8 && (*(uint *)(iVar16 + 0x99e) == local_8)))) { + *(undefined2 *)(iVar16 + 0x99e) = 0; + uVar19 = (undefined2)((ulong)*(undefined4 *)(param_1 + 6) >> 0x10); + iVar15 = (int)*(undefined4 *)(param_1 + 6); + *(undefined2 *)(iVar15 + 0xbca) = 0; + *(undefined2 *)(iVar15 + 0xbcc) = 0; + } + else { + uVar12 = uVar9; + if ((((int)local_66 < (int)local_14) || + (((int)local_66 <= (int)local_14 && (local_68 <= local_16)))) && + (((local_66 < 0x8000 || ((-2 < (int)local_66 && (0xd507 < local_68)))) && + (*(int *)(iVar16 + 0x99e) != 0)))) { + uVar19 = (undefined2)((ulong)*(undefined4 *)(param_1 + 6) >> 0x10); + iVar15 = (int)*(undefined4 *)(param_1 + 6); + local_72 = (*(int *)(iVar16 + 0x973) - *(int *)(iVar15 + 0xbc0)) - + (uint)(*(uint *)(iVar16 + 0x971) < *(uint *)(iVar15 + 0xbbe)); + FUN_1020_100b(); + FUN_1020_1017(); + local_76 = FUN_1020_100b(); + uVar19 = (undefined2)((ulong)*(undefined4 *)(param_1 + 6) >> 0x10); + iVar15 = (int)*(undefined4 *)(param_1 + 6); + local_78 = (*(int *)(iVar15 + 0xbbc) - *(int *)(iVar16 + 0x96f)) - + (uint)(*(uint *)(iVar15 + 0xbba) < *(uint *)(iVar16 + 0x96d)); + local_7a = uVar9; + FUN_1020_100b(); + FUN_1020_1017(); + local_7c = FUN_1020_100b(); + FUN_1020_0ffd(); + FUN_1020_0ff1(); + uVar12 = uVar9; + FUN_1020_0ffd(); + FUN_1020_0ff1(); + iVar15 = extraout_DX_05; + FUN_1020_0fe5(); + FUN_1020_10be(); + FUN_1020_0ff7(); + iVar17 = FUN_1020_1017(); + if ((iVar15 < 1) && ((iVar15 < 0 || (iVar17 == 0)))) { + local_64 = 0; + local_62 = 0; + } + else { + FUN_1020_100b(); + FUN_1020_0ff7(); + local_62 = uVar11; + uVar12 = uVar10; + FUN_1020_0ff7(); + FUN_1020_0feb(); + FUN_1020_0ffd(); + local_64 = FUN_1020_1017(); + } + local_74 = uVar9; + if ((int)local_62 < 0) { + uVar7 = local_68; + uVar12 = local_66; + if ((int)local_66 < 0) { + uVar7 = -local_68; + uVar12 = (~local_66 + 1) - (uint)(local_68 != 0); + } + uVar9 = local_64; + uVar8 = local_62; + if ((int)local_62 < 0) { + uVar9 = -local_64; + uVar8 = (~local_62 + 1) - (uint)(local_64 != 0); + } + if (((int)uVar12 < (int)uVar8) || (((int)uVar12 <= (int)uVar8 && (uVar7 <= uVar9)))) { + bVar21 = true; + } + } + } + } + } +LAB_1000_e060: + in_BX = uVar12; + if (bVar21) { + uVar19 = (undefined2)((ulong)*(undefined4 *)(param_1 + 6) >> 0x10); + iVar15 = (int)*(undefined4 *)(param_1 + 6); + *(undefined2 *)(iVar15 + 0xbca) = 0; + *(undefined2 *)(iVar15 + 0xbcc) = 0; + if (((int)local_66 < (int)local_6e) || + (((int)local_66 <= (int)local_6e && (local_68 <= local_70)))) { + local_70 = local_68; + local_6e = local_66; + iVar14 = iVar14 + 1; + iVar15 = iVar14 * 0x34; + *(uint *)(&stack0xd89e + iVar15) = local_68; + *(uint *)(&stack0xd8a0 + iVar15) = local_66; + *(int *)(&stack0xd86e + iVar15) = local_4; + *(undefined2 *)(&stack0xd870 + iVar15) = local_76; + *(uint *)(&stack0xd872 + iVar15) = local_74; + *(uint *)(&stack0xd874 + iVar15) = local_72; + *(undefined2 *)(&stack0xd876 + iVar15) = local_7c; + *(uint *)(&stack0xd878 + iVar15) = local_7a; + *(uint *)(&stack0xd87a + iVar15) = local_78; + uVar19 = *(undefined2 *)(iVar16 + 0x98b); + uVar4 = *(undefined2 *)(iVar16 + 0x98d); + *(undefined2 *)(&stack0xd886 + iVar15) = *(undefined2 *)(iVar16 + 0x989); + *(undefined2 *)(&stack0xd888 + iVar15) = uVar19; + *(undefined2 *)(&stack0xd88a + iVar15) = uVar4; + uVar19 = *(undefined2 *)(iVar16 + 0x985); + uVar4 = *(undefined2 *)(iVar16 + 0x987); + *(undefined2 *)(&stack0xd880 + iVar15) = *(undefined2 *)(iVar16 + 0x983); + *(undefined2 *)(&stack0xd882 + iVar15) = uVar19; + *(undefined2 *)(&stack0xd884 + iVar15) = uVar4; + *(uint *)(&stack0xd87c + iVar15) = local_64; + *(uint *)(&stack0xd87e + iVar15) = local_62; + uVar19 = *(undefined2 *)(iVar16 + 0x992); + uVar4 = *(undefined2 *)(iVar16 + 0x994); + *(undefined2 *)(&stack0xd88c + iVar15) = *(undefined2 *)(iVar16 + 0x990); + *(undefined2 *)(&stack0xd88e + iVar15) = uVar19; + *(undefined2 *)(&stack0xd890 + iVar15) = uVar4; + in_BX = *(uint *)(iVar16 + 0x998); + uVar19 = *(undefined2 *)(iVar16 + 0x99a); + *(undefined2 *)(&stack0xd892 + iVar15) = *(undefined2 *)(iVar16 + 0x996); + *(uint *)(&stack0xd894 + iVar15) = in_BX; + *(undefined2 *)(&stack0xd896 + iVar15) = uVar19; + *(undefined2 *)(&stack0xd898 + iVar15) = *(undefined2 *)(iVar16 + 0x99c); + uVar19 = *(undefined2 *)(iVar16 + 0x9a2); + *(undefined2 *)(&stack0xd89a + iVar15) = *(undefined2 *)(iVar16 + 0x9a0); + *(undefined2 *)(&stack0xd89c + iVar15) = uVar19; + } + } + } + if (local_4 == 0xaf) break; + local_4 = local_4 + 1; + } while( true ); + if (iVar14 != 0) { + if (in_stack_0000d8cc != 0) { + FUN_1000_b476(); + } + if (in_stack_0000d8ce != 0 || in_stack_0000d8d0 != 0) { + bVar21 = true; + FUN_1020_1007(); + if (bVar21) { + FUN_1000_bc36(); + } + } + FUN_1020_0ffd(); + FUN_1020_0ff1(); + FUN_1020_0ffd(); + FUN_1020_0ff1(); + FUN_1020_0fe5(); + FUN_1020_10be(); + FUN_1020_0ff7(); + FUN_1020_1017(); + FUN_1020_100b(); + FUN_1020_0ff7(); + FUN_1020_0ff7(); + FUN_1020_0fe5(); + FUN_1020_0ffd(); + FUN_1020_1017(); + FUN_1020_100b(); + FUN_1020_0ff7(); + FUN_1020_0ff7(); + FUN_1020_100b(); + FUN_1020_0ff7(); + FUN_1020_100b(); + FUN_1020_0ff7(); + FUN_1020_10be(); + FUN_1020_0ffd(); + FUN_1020_100b(); + FUN_1020_100b(); + FUN_1020_0ff7(); + FUN_1020_0ffd(); + iVar16 = 0x4ccc; + FUN_1020_0ff7(); + FUN_1020_0feb(); + FUN_1020_0feb(); + FUN_1020_1017(); + local_3e = 0x9999; + local_3c = 0x1999; + FUN_1020_0ff7(); + local_40 = FUN_1020_0fe5(); + if ((in_stack_0000d8a2 == 0xae) || (in_stack_0000d8a2 == 0xaf)) { + iVar17 = (in_stack_0000d8a2 + -0xae) * 4; + iVar15 = *(int *)(iVar17 + 0x805); + if ((iVar15 < 0) || ((iVar15 < 1 && (*(int *)(iVar17 + 0x803) == 0)))) { + FUN_1020_100b(); + iVar17 = in_stack_0000d8b2; + FUN_1020_100b(); + FUN_1020_0ff7(); + FUN_1020_0ffd(); + uVar11 = FUN_1020_1017(); + iVar15 = (in_stack_0000d8a2 + -0xae) * 4; + uVar10 = *(uint *)(iVar15 + 0x7f3); + iVar15 = *(int *)(iVar15 + 0x7f5); + iVar18 = (in_stack_0000d8a2 + -0xae) * 4; + *(int *)(iVar18 + 0x7f3) = uVar10 + uVar11; + *(int *)(iVar18 + 0x7f5) = iVar15 + iVar17 + (uint)CARRY2(uVar10,uVar11); + FUN_1020_100b(); + iVar17 = in_stack_0000d8b2; + FUN_1020_100b(); + FUN_1020_0ff7(); + FUN_1020_0ffd(); + uVar11 = FUN_1020_1017(); + iVar15 = (in_stack_0000d8a2 + -0xae) * 4; + uVar10 = *(uint *)(iVar15 + 0x7fb); + iVar15 = *(int *)(iVar15 + 0x7fd); + iVar18 = (in_stack_0000d8a2 + -0xae) * 4; + *(int *)(iVar18 + 0x7fb) = uVar10 - uVar11; + *(int *)(iVar18 + 0x7fd) = (iVar15 - iVar17) - (uint)(uVar10 < uVar11); + } + } + FUN_1020_100b(); + FUN_1020_100b(); + FUN_1020_100b(); + FUN_1020_0ff7(); + FUN_1020_0ffd(); + in_BX = 0; + local_62 = 0; + FUN_1020_0fe5(); + FUN_1020_0feb(); + FUN_1020_0ff7(); + local_64 = FUN_1020_1017(); + if (DAT_1028_07c6 == '\0') { + bVar21 = false; + in_BX = in_stack_0000d8c2; + FUN_1020_1007(); + if (bVar21) { + iVar15 = *(int *)((int)*(undefined4 *)(param_1 + 6) + 0x58); + FUN_1020_100b(); + FUN_1020_0ff7(); + uVar10 = FUN_1020_1017(); + if ((in_stack_0000d8b2 < iVar15) || + ((in_stack_0000d8b2 <= iVar15 && (in_stack_0000d8b0 < uVar10)))) { + if (in_stack_0000d8ce == 0 && in_stack_0000d8d0 == 0) { + FUN_1008_0002(); + } + else { + FUN_1000_bc36(); + } + in_BX = *(uint *)((int)*(undefined4 *)(param_1 + 6) + 0x58); + FUN_1020_100b(); + FUN_1020_0ff7(); + uVar10 = FUN_1020_1017(); + bVar21 = local_64 < uVar10; + local_64 = local_64 - uVar10; + local_62 = (local_62 - in_BX) - (uint)bVar21; + } + } + } + FUN_1020_100b(); + FUN_1020_100b(); + FUN_1020_0ff7(); + FUN_1020_100b(); + FUN_1020_0ff7(); + FUN_1020_0feb(); + FUN_1020_0ffd(); + uVar11 = FUN_1020_1017(); + FUN_1020_100b(); + FUN_1020_100b(); + FUN_1020_0ff7(); + uVar10 = local_62; + FUN_1020_100b(); + FUN_1020_0ff7(); + FUN_1020_0fe5(); + FUN_1020_0ffd(); + uVar22 = FUN_1020_1017(); + bVar21 = CARRY2(local_e,uVar11); + local_e = local_e + uVar11; + local_c = local_c + iVar16 + (uint)bVar21; + bVar21 = CARRY2(local_12,uVar22); + local_12 = local_12 + uVar22; + local_10 = local_10 + uVar10 + (uint)bVar21; + if (in_stack_0000d8a2 == 0x19) { + if (((int)local_14 < 0) || (((int)local_14 < 1 && (local_16 < 1000)))) { + *(undefined1 *)((int)*(undefined4 *)(param_1 + 6) + 0xbdd) = 0; + local_12 = 0; + local_10 = 0; + } + local_c = 0; + local_e = 0; + } + else if (in_stack_0000d8a2 == 2) { + if (*(byte *)((int)*(undefined4 *)(param_1 + 6) + 0x61) < 2) { + FUN_1000_ae6e(); + } + else { + *(undefined1 *)((local_8 + 0xad) * 0x53 + 0x98f) = 0; + DAT_1028_0874 = '\0'; + } + } + } + if (*(char *)((int)*(undefined4 *)(param_1 + 6) + 0xbdd) != '\0') { + uVar19 = (undefined2)((ulong)*(undefined4 *)(param_1 + 6) >> 0x10); + iVar16 = (int)*(undefined4 *)(param_1 + 6); + *(undefined2 *)(iVar16 + 0xbce) = local_40; + *(uint *)(iVar16 + 0xbd0) = local_3e; + *(undefined2 *)(iVar16 + 0xbd2) = local_3c; + *(uint *)(iVar16 + 0xbaa) = local_e; + *(uint *)(iVar16 + 0xbac) = local_c; + *(uint *)(iVar16 + 0xbae) = local_12; + *(uint *)(iVar16 + 0xbb0) = local_10; + FUN_1020_100b(); + FUN_1020_0ffd(); + FUN_1020_0ff1(); + FUN_1020_100b(); + FUN_1020_0ffd(); + FUN_1020_0ff1(); + iVar15 = extraout_DX_06; + FUN_1020_0fe5(); + FUN_1020_10be(); + FUN_1020_0ff7(); + uVar10 = FUN_1020_1017(); + uVar19 = (undefined2)((ulong)*(undefined4 *)(param_1 + 6) >> 0x10); + iVar17 = (int)*(undefined4 *)(param_1 + 6); + iVar16 = *(int *)(iVar17 + 0x58); + if ((iVar16 < iVar15) || + ((in_BX = local_3e, iVar16 <= iVar15 && (*(uint *)(iVar17 + 0x56) < uVar10)))) { + FUN_1020_100b(); + uVar19 = (undefined2)((ulong)*(undefined4 *)(param_1 + 6) >> 0x10); + iVar16 = (int)*(undefined4 *)(param_1 + 6); + iVar17 = (iVar15 - *(int *)(iVar16 + 0x58)) - (uint)(uVar10 < *(uint *)(iVar16 + 0x56)); + FUN_1020_08a9(); + FUN_1020_100b(); + FUN_1020_0ffd(); + uVar22 = FUN_1020_1017(); + uVar19 = (undefined2)((ulong)*(undefined4 *)(param_1 + 6) >> 0x10); + iVar18 = (int)*(undefined4 *)(param_1 + 6); + uVar11 = *(uint *)(iVar18 + 0xbaa); + iVar16 = *(int *)(iVar18 + 0xbac); + *(int *)(iVar18 + 0xbaa) = uVar11 - uVar22; + *(int *)(iVar18 + 0xbac) = (iVar16 - iVar17) - (uint)(uVar11 < uVar22); + FUN_1020_100b(); + uVar19 = (undefined2)((ulong)*(undefined4 *)(param_1 + 6) >> 0x10); + iVar16 = (int)*(undefined4 *)(param_1 + 6); + in_BX = (iVar15 - *(int *)(iVar16 + 0x58)) - (uint)(uVar10 < *(uint *)(iVar16 + 0x56)); + FUN_1020_08a9(); + FUN_1020_100b(); + FUN_1020_0ffd(); + uVar11 = FUN_1020_1017(); + uVar19 = (undefined2)((ulong)*(undefined4 *)(param_1 + 6) >> 0x10); + iVar15 = (int)*(undefined4 *)(param_1 + 6); + uVar10 = *(uint *)(iVar15 + 0xbae); + iVar16 = *(int *)(iVar15 + 0xbb0); + *(int *)(iVar15 + 0xbae) = uVar10 - uVar11; + *(int *)(iVar15 + 0xbb0) = (iVar16 - in_BX) - (uint)(uVar10 < uVar11); + } + uVar19 = (undefined2)((ulong)*(undefined4 *)(param_1 + 6) >> 0x10); + iVar16 = (int)*(undefined4 *)(param_1 + 6); + bVar21 = CARRY2(DAT_1028_07d3,*(uint *)(iVar16 + 0xbaa)); + DAT_1028_07d3 = DAT_1028_07d3 + *(uint *)(iVar16 + 0xbaa); + DAT_1028_07d5 = DAT_1028_07d5 + *(int *)(iVar16 + 0xbac) + (uint)bVar21; + bVar21 = CARRY2(DAT_1028_07d7,*(uint *)(iVar16 + 0xbae)); + DAT_1028_07d7 = DAT_1028_07d7 + *(uint *)(iVar16 + 0xbae); + DAT_1028_07d9 = DAT_1028_07d9 + *(int *)(iVar16 + 0xbb0) + (uint)bVar21; + FUN_1000_bdde(); + } + if (iVar14 != 0) goto LAB_1000_ea63; + uVar19 = (undefined2)((ulong)*(undefined4 *)(param_1 + 6) >> 0x10); + iVar14 = (int)*(undefined4 *)(param_1 + 6); + if (((*(char *)(iVar14 + 0xbe2) == '\x01') || (*(char *)(iVar14 + 0xbe1) == '\x01')) || + (iVar13 == iVar5)) goto LAB_1000_ea63; + iVar13 = iVar13 + 1; + goto LAB_1000_c839; +} + + +/* ===== 1000:eab1 exported_ordinal_10 ===== */ + +void __stdcall16far exported_ordinal_10(undefined4 param_1) + +{ + char *pcVar1; + undefined1 uVar2; + undefined1 uVar3; + undefined2 uVar4; + undefined2 uVar5; + undefined2 uVar6; + undefined2 uVar7; + undefined2 uVar8; + int iVar9; + uint uVar10; + int iVar11; + int iVar12; + undefined2 uVar13; + undefined2 unaff_CS; + bool bVar14; + undefined2 uVar15; + undefined2 uVar16; + undefined2 uVar17; + undefined2 uVar18; + undefined1 local_4d; + int local_30; + int local_2e; + + uVar13 = (undefined2)((ulong)param_1 >> 0x10); + iVar12 = (int)param_1; + if (*(int *)(iVar12 + 0x41) != 0 || *(int *)(iVar12 + 0x43) != 0) { + return; + } + if (*(int *)(iVar12 + 0x45) != 0 || *(int *)(iVar12 + 0x47) != 0) { + return; + } + if (*(char *)(iVar12 + 0xbd8) != '\0') { + return; + } + if (*(char *)(iVar12 + 0xbd9) != '\0') { + return; + } + if (DAT_1028_07cc != '\0') { + return; + } + if (*(char *)(iVar12 + 0x51) != '\0') { + return; + } + if (DAT_1028_07c4 == '\0') { + return; + } + *(undefined1 *)(iVar12 + 0x51) = 1; + if (DAT_1028_07c5 != '\0') { + local_30 = 1; + while( true ) { + unaff_CS = 0x1000; + FUN_1000_7e12(&stack0xfffe,local_30); + if (local_30 == 0xaf) break; + local_30 = local_30 + 1; + } + DAT_1028_07c5 = '\0'; + } + bVar14 = 0xfffe < DAT_1028_0876; + DAT_1028_0876 = DAT_1028_0876 + 1; + DAT_1028_0878 = DAT_1028_0878 + (uint)bVar14; + if (*(char *)(iVar12 + 0xbdd) != '\0') { + if ((DAT_1028_07ca != '\0') && (DAT_1028_0874 == '\0')) { + if (DAT_1028_086d == DAT_1028_086f) { + if (DAT_1028_086d == 10) { + uVar8 = GETDC(unaff_CS,*(undefined2 *)(iVar12 + 4)); + FUN_1008_0e08(0,0,uVar8); + RELEASEDC(0x1008,uVar8); + if (DAT_1028_0873 == '\0') { + DAT_1028_07ca = '\0'; + for (local_2e = 0xc; *(undefined1 *)(local_2e * 0x53 + 0x98f) = 1, local_2e != 0x14; + local_2e = local_2e + 1) { + } + } + } + else { + uVar18 = GETDC(unaff_CS,*(undefined2 *)(iVar12 + 4)); + FUN_1008_0e08(0,DAT_1028_086d,uVar18); + uVar8 = *(undefined2 *)(iVar12 + 4); + RELEASEDC(0x1008,uVar18); + DAT_1028_086f = 10; + DAT_1028_0873 = '\0'; + DAT_1028_2679 = 0; + *(undefined2 *)(iVar12 + 0xbca) = 0; + *(undefined2 *)(iVar12 + 0xbcc) = 0; + *(undefined2 *)(iVar12 + 0xbce) = 0; + *(undefined2 *)(iVar12 + 0xbd0) = 0; + *(undefined2 *)(iVar12 + 0xbd2) = 0; + if (DAT_1028_086d == 1) { + DAT_1028_07d3 = 0xefd0; + DAT_1028_07d5 = 3; + DAT_1028_07d7 = 0x30b0; + DAT_1028_07d9 = 1; + uVar18 = *(undefined2 *)(iVar12 + 0x58); + FUN_1020_100b(uVar8); + FUN_1020_0ff7(); + uVar8 = FUN_1020_1017(); + *(undefined2 *)(iVar12 + 0xbaa) = uVar8; + *(undefined2 *)(iVar12 + 0xbac) = uVar18; + uVar8 = *(undefined2 *)(iVar12 + 0x58); + FUN_1020_100b(); + FUN_1020_0ff7(); + uVar18 = FUN_1020_1017(); + *(undefined2 *)(iVar12 + 0xbae) = uVar18; + *(undefined2 *)(iVar12 + 0xbb0) = uVar8; + } + else if (DAT_1028_086d == 2) { + DAT_1028_07d3 = 0xf3b8; + DAT_1028_07d5 = 3; + DAT_1028_07d7 = 0x3c68; + DAT_1028_07d9 = 1; + uVar18 = *(undefined2 *)(iVar12 + 0x58); + FUN_1020_100b(uVar8); + FUN_1020_0ff7(); + uVar8 = FUN_1020_1017(); + *(undefined2 *)(iVar12 + 0xbaa) = uVar8; + *(undefined2 *)(iVar12 + 0xbac) = uVar18; + uVar8 = *(undefined2 *)(iVar12 + 0x58); + FUN_1020_100b(); + FUN_1020_0ff7(); + uVar18 = FUN_1020_1017(); + *(undefined2 *)(iVar12 + 0xbae) = uVar18; + *(undefined2 *)(iVar12 + 0xbb0) = uVar8; + } + else if (DAT_1028_086d == 3) { + DAT_1028_07d3 = 0xefd0; + DAT_1028_07d5 = 3; + DAT_1028_07d7 = 0x30b0; + DAT_1028_07d9 = 1; + uVar18 = *(undefined2 *)(iVar12 + 0x58); + FUN_1020_100b(uVar8); + FUN_1020_0ff7(); + uVar8 = FUN_1020_1017(); + *(undefined2 *)(iVar12 + 0xbaa) = uVar8; + *(undefined2 *)(iVar12 + 0xbac) = uVar18; + uVar8 = *(undefined2 *)(iVar12 + 0x58); + FUN_1020_100b(); + FUN_1020_0ff7(); + uVar18 = FUN_1020_1017(); + *(undefined2 *)(iVar12 + 0xbae) = uVar18; + *(undefined2 *)(iVar12 + 0xbb0) = uVar8; + } + else if (DAT_1028_086d == 4) { + DAT_1028_07d3 = 0xfb88; + DAT_1028_07d5 = 3; + DAT_1028_07d7 = 0x4ff0; + DAT_1028_07d9 = 1; + uVar18 = *(undefined2 *)(iVar12 + 0x58); + FUN_1020_100b(uVar8); + FUN_1020_0ff7(); + uVar8 = FUN_1020_1017(); + *(undefined2 *)(iVar12 + 0xbaa) = uVar8; + *(undefined2 *)(iVar12 + 0xbac) = uVar18; + uVar8 = *(undefined2 *)(iVar12 + 0x58); + FUN_1020_100b(); + FUN_1020_0ff7(); + uVar18 = FUN_1020_1017(); + *(undefined2 *)(iVar12 + 0xbae) = uVar18; + *(undefined2 *)(iVar12 + 0xbb0) = uVar8; + } + else if (DAT_1028_086d == 5) { + DAT_1028_07d3 = 0xf10; + DAT_1028_07d5 = 4; + DAT_1028_07d7 = 0x5f90; + DAT_1028_07d9 = 1; + uVar18 = *(undefined2 *)(iVar12 + 0x58); + FUN_1020_100b(uVar8); + FUN_1020_0ff7(); + uVar8 = FUN_1020_1017(); + *(undefined2 *)(iVar12 + 0xbaa) = uVar8; + *(undefined2 *)(iVar12 + 0xbac) = uVar18; + uVar8 = *(undefined2 *)(iVar12 + 0x58); + FUN_1020_100b(); + FUN_1020_0ff7(); + uVar18 = FUN_1020_1017(); + *(undefined2 *)(iVar12 + 0xbae) = uVar18; + *(undefined2 *)(iVar12 + 0xbb0) = uVar8; + } + else if (DAT_1028_086d == 6) { + DAT_1028_07d3 = 0x1eb0; + DAT_1028_07d5 = 4; + DAT_1028_07d7 = 0x6f30; + DAT_1028_07d9 = 1; + uVar18 = *(undefined2 *)(iVar12 + 0x58); + FUN_1020_100b(uVar8); + FUN_1020_0ff7(); + uVar8 = FUN_1020_1017(); + *(undefined2 *)(iVar12 + 0xbaa) = uVar8; + *(undefined2 *)(iVar12 + 0xbac) = uVar18; + uVar8 = *(undefined2 *)(iVar12 + 0x58); + FUN_1020_100b(); + FUN_1020_0ff7(); + uVar18 = FUN_1020_1017(); + *(undefined2 *)(iVar12 + 0xbae) = uVar18; + *(undefined2 *)(iVar12 + 0xbb0) = uVar8; + } + else if (DAT_1028_086d == 7) { + DAT_1028_07d3 = 0x3238; + DAT_1028_07d5 = 4; + DAT_1028_07d7 = 0x7ae8; + DAT_1028_07d9 = 1; + uVar18 = *(undefined2 *)(iVar12 + 0x58); + FUN_1020_100b(uVar8); + FUN_1020_0ff7(); + uVar8 = FUN_1020_1017(); + *(undefined2 *)(iVar12 + 0xbaa) = uVar8; + *(undefined2 *)(iVar12 + 0xbac) = uVar18; + uVar8 = *(undefined2 *)(iVar12 + 0x58); + FUN_1020_100b(); + FUN_1020_0ff7(); + uVar18 = FUN_1020_1017(); + *(undefined2 *)(iVar12 + 0xbae) = uVar18; + *(undefined2 *)(iVar12 + 0xbb0) = uVar8; + } + else if (DAT_1028_086d == 8) { + DAT_1028_07d3 = 0x3df0; + DAT_1028_07d5 = 4; + DAT_1028_07d7 = 0x7ed0; + DAT_1028_07d9 = 1; + uVar18 = *(undefined2 *)(iVar12 + 0x58); + FUN_1020_100b(uVar8); + FUN_1020_0ff7(); + uVar8 = FUN_1020_1017(); + *(undefined2 *)(iVar12 + 0xbaa) = uVar8; + *(undefined2 *)(iVar12 + 0xbac) = uVar18; + uVar8 = *(undefined2 *)(iVar12 + 0x58); + FUN_1020_100b(); + FUN_1020_0ff7(); + uVar18 = FUN_1020_1017(); + *(undefined2 *)(iVar12 + 0xbae) = uVar18; + *(undefined2 *)(iVar12 + 0xbb0) = uVar8; + } + else if (DAT_1028_086d == 9) { + DAT_1028_07d3 = 0x4d90; + DAT_1028_07d5 = 4; + DAT_1028_07d7 = 0x8a88; + DAT_1028_07d9 = 1; + uVar18 = *(undefined2 *)(iVar12 + 0x58); + FUN_1020_100b(uVar8); + FUN_1020_0ff7(); + uVar8 = FUN_1020_1017(); + *(undefined2 *)(iVar12 + 0xbaa) = uVar8; + *(undefined2 *)(iVar12 + 0xbac) = uVar18; + uVar8 = *(undefined2 *)(iVar12 + 0x58); + FUN_1020_100b(); + FUN_1020_0ff7(); + uVar18 = FUN_1020_1017(); + *(undefined2 *)(iVar12 + 0xbae) = uVar18; + *(undefined2 *)(iVar12 + 0xbb0) = uVar8; + } + else if (DAT_1028_086d == 0x12) { + DAT_1028_07d3 = 0xf588; + DAT_1028_07d5 = 4; + DAT_1028_07d7 = 0x6760; + DAT_1028_07d9 = 1; + *(undefined2 *)(iVar12 + 0xbaa) = 0; + *(undefined2 *)(iVar12 + 0xbac) = 0; + *(undefined2 *)(iVar12 + 0xbae) = 1000; + *(undefined2 *)(iVar12 + 0xbb0) = 0; + } + FUN_1000_c426(&stack0xfffe,1,0); + FUN_1000_9bca(&stack0xfffe); + FUN_1008_0002(0x10); + *(undefined1 *)(iVar12 + 0xbdf) = 0; + } + } + else { + uVar8 = GETDC(unaff_CS,*(undefined2 *)(iVar12 + 4)); + if (DAT_1028_086d < DAT_1028_086f) { + DAT_1028_086d = DAT_1028_086d + 1; + } + else { + DAT_1028_086d = DAT_1028_086d - 1; + } + FUN_1008_0e08(CONCAT11((char)(DAT_1028_086d >> 8),DAT_1028_0873),DAT_1028_086d,uVar8); + RELEASEDC(0x1008,uVar8); + } + } + local_2e = 1; + while( true ) { + if ((*(char *)(iVar12 + local_2e + 0x61) != '\0') && + (pcVar1 = (char *)(iVar12 + local_2e + 0x61), *pcVar1 = *pcVar1 + -1, + *(char *)(iVar12 + local_2e + 0x61) == '\0')) { + FUN_1000_b3f3(&stack0xfffe,local_2e); + } + if (local_2e == 0xaf) break; + local_2e = local_2e + 1; + } + if (DAT_1028_07c7 != '\0') { + if ((DAT_1028_0857 < 0) || ((DAT_1028_0857 < 1 && (DAT_1028_0855 < 6)))) { + bVar14 = 0xfffe < DAT_1028_0855; + DAT_1028_0855 = DAT_1028_0855 + 1; + DAT_1028_0857 = DAT_1028_0857 + (uint)bVar14; + FUN_1000_6f27(&stack0xfffe); + } + else { + DAT_1028_07c7 = '\0'; + } + } + uVar18 = DAT_1028_07e9; + uVar8 = DAT_1028_07e5; + if (1 < *(byte *)(iVar12 + 0x61)) { + if (DAT_1028_41f9 == '\0') { + if (*(char *)(iVar12 + 0xbe1) == '\0') { + *(undefined2 *)(iVar12 + 0xbc2) = DAT_1028_07e3; + *(undefined2 *)(iVar12 + 0xbc4) = uVar8; + uVar8 = DAT_1028_07ed; + *(undefined2 *)(iVar12 + 0xbc6) = DAT_1028_07eb; + *(undefined2 *)(iVar12 + 0xbc8) = uVar8; + FUN_1000_a38e(&stack0xfffe,0); + } + else { + *(undefined1 *)(iVar12 + 0xbe1) = 0; + } + *(undefined1 *)(iVar12 + 0x61) = 1; + uVar8 = DAT_1028_07e9; + DAT_1028_0874 = '\0'; + DAT_1028_41f9 = '\x01'; + if (DAT_1028_424c == '\0') { + *(undefined2 *)(iVar12 + 0xbc2) = DAT_1028_07e7; + *(undefined2 *)(iVar12 + 0xbc4) = uVar8; + uVar8 = DAT_1028_07f1; + *(undefined2 *)(iVar12 + 0xbc6) = DAT_1028_07ef; + *(undefined2 *)(iVar12 + 0xbc8) = uVar8; + FUN_1000_ae6e(&stack0xfffe); + } + else { + DAT_1028_07e3 = DAT_1028_07e7; + DAT_1028_07e5 = DAT_1028_07e9; + DAT_1028_07eb = DAT_1028_07ef; + DAT_1028_07ed = DAT_1028_07f1; + DAT_1028_07f3 = DAT_1028_07f7; + DAT_1028_07f5 = DAT_1028_07f9; + DAT_1028_07fb = DAT_1028_07ff; + DAT_1028_07fd = DAT_1028_0801; + DAT_1028_080b = DAT_1028_0811; + DAT_1028_080d = DAT_1028_0813; + DAT_1028_080f = DAT_1028_0815; + DAT_1028_0803 = DAT_1028_0807; + DAT_1028_0805 = DAT_1028_0809; + FUN_1000_c36b(&stack0xfffe,0,0); + DAT_1028_424c = '\0'; + } + } + else if (DAT_1028_424c == '\0') { + if (*(char *)(iVar12 + 0xbe1) == '\0') { + *(undefined2 *)(iVar12 + 0xbc2) = DAT_1028_07e7; + *(undefined2 *)(iVar12 + 0xbc4) = uVar18; + uVar8 = DAT_1028_07f1; + *(undefined2 *)(iVar12 + 0xbc6) = DAT_1028_07ef; + *(undefined2 *)(iVar12 + 0xbc8) = uVar8; + FUN_1000_a38e(&stack0xfffe,0); + } + else { + *(undefined1 *)(iVar12 + 0xbe1) = 0; + } + *(undefined1 *)(iVar12 + 0x61) = 1; + DAT_1028_0874 = '\0'; + FUN_1000_c36b(&stack0xfffe,0,0); + } + } + if ((*(char *)(iVar12 + 0xbd8) == '\0') && (*(char *)(iVar12 + 0xbdf) == '\0')) { + FUN_1000_c79c(&stack0xfffe); + } + if (*(char *)(iVar12 + 0xbe2) == '\x01') { + *(undefined1 *)(iVar12 + 0xbe2) = 0; + FUN_1000_c426(&stack0xfffe,1,0); + FUN_1000_bdde(&stack0xfffe,2,0); + FUN_1000_9e85(&stack0xfffe); + uVar8 = GETDC(0x1000,*(undefined2 *)(iVar12 + 4)); + FUN_1008_08bb(0x14,0x94,0xf3,0x54,uVar8); + FUN_1008_093f(0x14,0x94,0xf3,0x54,uVar8); + RELEASEDC(0x1008,uVar8); + FUN_1000_c426(&stack0xfffe,0,0); + FUN_1000_bdde(&stack0xfffe,1,0); + } + if (*(char *)(iVar12 + 0xbe0) == '\x01') { + FUN_1000_c426(&stack0xfffe,0,0); + FUN_1000_bdde(&stack0xfffe,1,0); + uVar8 = DAT_1028_396b; + DAT_1028_07d3 = DAT_1028_3969; + DAT_1028_07d5 = DAT_1028_396b; + DAT_1028_07d7 = DAT_1028_396d; + DAT_1028_07d9 = DAT_1028_396f; + *(undefined2 *)(iVar12 + 0xbc2) = DAT_1028_3969; + *(undefined2 *)(iVar12 + 0xbc4) = uVar8; + uVar8 = DAT_1028_07d9; + *(undefined2 *)(iVar12 + 0xbc6) = DAT_1028_07d7; + *(undefined2 *)(iVar12 + 0xbc8) = uVar8; + FUN_1000_a38e(&stack0xfffe,0); + *(undefined1 *)(iVar12 + (uint)DAT_1028_07d1 * 0x14 + 0x47b) = 0; + FUN_1000_b3f3(&stack0xfffe,0x3fc); + *(undefined2 *)(iVar12 + 0xbaa) = 0; + *(undefined2 *)(iVar12 + 0xbac) = 0; + uVar8 = *(undefined2 *)(iVar12 + 0x58); + FUN_1020_100b(); + FUN_1020_0ff7(); + uVar18 = FUN_1020_1017(); + *(undefined2 *)(iVar12 + 0xbae) = uVar18; + *(undefined2 *)(iVar12 + 0xbb0) = uVar8; + *(undefined2 *)(iVar12 + 0xbca) = 0; + *(undefined2 *)(iVar12 + 0xbcc) = 0; + *(undefined2 *)(iVar12 + 0xbce) = 0; + *(undefined2 *)(iVar12 + 0xbd0) = 0; + *(undefined2 *)(iVar12 + 0xbd2) = 0; + DAT_1028_399a = 2; + FUN_1000_c426(&stack0xfffe,1,0); + FUN_1000_bdde(&stack0xfffe,2,0); + DAT_1028_41f9 = '\x01'; + DAT_1028_424c = '\x01'; + *(undefined1 *)(iVar12 + 0x61) = 2; + DAT_1028_0874 = '\x01'; + *(undefined1 *)(iVar12 + 0xbe0) = 0; + } + goto LAB_1000_fd59; + } + if (DAT_1028_07c9 != '\0') { + iVar9 = 2; + iVar11 = 0; + FUN_1020_08e6(); + if (iVar9 == 0 && iVar11 == 0) { + FUN_1020_08e6(); + iVar9 = FUN_1020_08e6(); + if ((iVar9 < 0) || (7 < iVar9)) { + if ((7 < iVar9) && (iVar9 < 0x10)) { + FUN_1000_b3f3(&stack0xfffe,iVar9 + 0x84); + } + } + else { + FUN_1000_b30b(&stack0xfffe,iVar9 + 0x8c); + } + } + iVar9 = 4; + iVar11 = 0; + FUN_1020_08e6(); + if (iVar9 == 0 && iVar11 == 0) { + FUN_1020_08e6(); + iVar9 = FUN_1020_08e6(); + if (iVar9 == 0) { + FUN_1000_b30b(&stack0xfffe,0x3e9); + FUN_1000_b3f3(&stack0xfffe,0x3ea); + } + else if ((iVar9 < 1) || (4 < iVar9)) { + if ((4 < iVar9) && (iVar9 < 9)) { + FUN_1000_b30b(&stack0xfffe,0x3f1 - iVar9); + FUN_1000_b3f3(&stack0xfffe,0x3f2 - iVar9); + } + } + else { + FUN_1000_b30b(&stack0xfffe,iVar9 + 0x3e9); + FUN_1000_b3f3(&stack0xfffe,iVar9 + 1000); + } + } + iVar9 = 0x20; + uVar8 = 0x1020; + FUN_1020_08e6(); + if (iVar9 == 0) { + FUN_1000_b30b(&stack0xfffe,0x99); + FUN_1000_b30b(&stack0xfffe,0x9a); + uVar8 = 0x1000; + FUN_1000_b30b(&stack0xfffe,6); + } + else if (iVar9 == 0x10) { + FUN_1000_b3f3(&stack0xfffe,0x99); + FUN_1000_b3f3(&stack0xfffe,0x9a); + uVar8 = 0x1000; + FUN_1000_b3f3(&stack0xfffe,6); + } + iVar9 = 4; + iVar11 = 0; + uVar18 = 0xf62f; + FUN_1020_08e6(); + if (iVar9 == 0 && iVar11 == 0) { + uVar8 = *(undefined2 *)(iVar12 + 4); + uVar15 = GETDC(0x1020,uVar8); + FUN_1020_08e6(); + iVar9 = FUN_1020_08e6(); + if (iVar9 < 5) { + iVar9 = (iVar9 * 3 + 0x5a) * 0x53; + local_4d = (undefined1)(iVar9 + 0x95b); + uVar2 = (undefined1)((uint)(iVar9 + 0x95b) >> 8); + uVar3 = 0x10; + FUN_1008_0837((*(int *)(iVar9 + 0x9ac) - *(int *)(iVar9 + 0x9a8)) + 1, + (*(int *)(iVar9 + 0x9aa) - *(int *)(iVar9 + 0x9a6)) + -10, + *(undefined2 *)(iVar9 + 0x9a8),*(undefined2 *)(iVar9 + 0x9a6),uVar15); + iVar9 = CONCAT11(uVar2,local_4d); + uVar18 = (undefined2)(CONCAT13(uVar3,CONCAT12(0x28,iVar9)) >> 0x10); + FUN_1008_093f((*(int *)(iVar9 + 0x51) - *(int *)(iVar9 + 0x4d)) + 1, + (*(int *)(iVar9 + 0x4f) - *(int *)(iVar9 + 0x4b)) + -10, + *(undefined2 *)(iVar9 + 0x4d),*(undefined2 *)(iVar9 + 0x4b),uVar15); + } + else { + iVar9 = ((iVar9 + -5) * 3 + 0x5a) * 0x53; + local_4d = (undefined1)(iVar9 + 0x95b); + uVar2 = (undefined1)((uint)(iVar9 + 0x95b) >> 8); + uVar3 = 0x10; + FUN_1008_08bb((*(int *)(iVar9 + 0x9ac) - *(int *)(iVar9 + 0x9a8)) + 1, + (*(int *)(iVar9 + 0x9aa) - *(int *)(iVar9 + 0x9a6)) + -10, + *(undefined2 *)(iVar9 + 0x9a8),*(undefined2 *)(iVar9 + 0x9a6),uVar15); + iVar9 = CONCAT11(uVar2,local_4d); + uVar18 = (undefined2)(CONCAT13(uVar3,CONCAT12(0x28,iVar9)) >> 0x10); + FUN_1008_093f((*(int *)(iVar9 + 0x51) - *(int *)(iVar9 + 0x4d)) + 1, + (*(int *)(iVar9 + 0x4f) - *(int *)(iVar9 + 0x4b)) + -10, + *(undefined2 *)(iVar9 + 0x4d),*(undefined2 *)(iVar9 + 0x4b),uVar15); + } + uVar18 = *(undefined2 *)(iVar12 + 4); + RELEASEDC(0x1008,uVar15); + } + iVar9 = 4; + iVar11 = 0; + FUN_1020_08e6(uVar18,uVar8); + if (iVar9 == 0 && iVar11 == 0) { + uVar15 = GETDC(0x1020,*(undefined2 *)(iVar12 + 4)); + FUN_1020_08e6(); + uVar16 = 0x1020; + iVar9 = FUN_1020_08e6(); + if (iVar9 == 0) { + FUN_1008_0837(9,9,0xd1,0x96,uVar15); + FUN_1008_093f(9,9,0xd1,0x96,uVar15); + FUN_1008_08bb(9,9,0xe0,0xc0,uVar15); + uVar16 = 0x1008; + FUN_1008_093f(9,9,0xe0,0xc0,uVar15); + } + else if (iVar9 == 1) { + FUN_1008_0837(9,9,0xd6,0xa4,uVar15); + FUN_1008_093f(9,9,0xd6,0xa4,uVar15); + FUN_1008_08bb(9,9,0xd1,0x96,uVar15); + uVar16 = 0x1008; + FUN_1008_093f(9,9,0xd1,0x96,uVar15); + } + else if (iVar9 == 2) { + FUN_1008_0837(9,9,0xdb,0xb2,uVar15); + FUN_1008_093f(9,9,0xdb,0xb2,uVar15); + FUN_1008_08bb(9,9,0xd6,0xa4,uVar15); + uVar16 = 0x1008; + FUN_1008_093f(9,9,0xd6,0xa4,uVar15); + } + else if (iVar9 == 3) { + FUN_1008_0837(9,9,0xe0,0xc0,uVar15); + FUN_1008_093f(9,9,0xe0,0xc0,uVar15); + FUN_1008_08bb(9,9,0xdb,0xb2,uVar15); + uVar16 = 0x1008; + FUN_1008_093f(9,9,0xdb,0xb2,uVar15); + } + RELEASEDC(uVar16,uVar15); + } + iVar9 = 8; + iVar11 = 0; + FUN_1020_08e6(uVar18,uVar8); + if (iVar9 == 0 && iVar11 == 0) { + uVar8 = GETDC(0x1020,*(undefined2 *)(iVar12 + 4)); + FUN_1020_08e6(); + iVar9 = FUN_1020_08e6(); + if (iVar9 < 10) { + FUN_1008_0dbd(iVar9,uVar8); + } + else { + FUN_1008_0dbd(0x12 - iVar9,uVar8); + } + RELEASEDC(0x1008,uVar8); + } + iVar9 = 6; + iVar11 = 0; + unaff_CS = 0x1020; + FUN_1020_08e6(); + if (iVar9 == 0 && iVar11 == 0) { + bVar14 = 0xfffe < DAT_1028_087a; + DAT_1028_087a = DAT_1028_087a + 1; + DAT_1028_087c = DAT_1028_087c + (uint)bVar14; + uVar4 = GETDC(0x1020,*(undefined2 *)(iVar12 + 4)); + uVar5 = CREATECOMPATIBLEDC(0x1228,uVar4); + uVar6 = CREATECOMPATIBLEDC(0x1228,uVar4); + uVar7 = CREATECOMPATIBLEBITMAP(0x1228,0x1e,0x11c); + uVar2 = SELECTOBJECT(0x1228,DAT_1028_085f); + uVar16 = uVar6; + uVar3 = SELECTOBJECT(0x1228,uVar7); + uVar15 = uVar6; + BITBLT(0x1228,0x20,0xcc,0x115,0x1d9,uVar5,0x1e,100,0,0); + uVar18 = uVar6; + BITBLT(0x1228,0x20,0xcc,0xe9,0x1d8,uVar5,0x1e,0x89,0,100); + uVar8 = uVar5; + SELECTOBJECT(0x1228,DAT_1028_0861); + iVar9 = 0x31; + iVar11 = 0; + FUN_1020_08e6(uVar8,uVar18,uVar15,uVar16); + if ((iVar11 < 1) && ((iVar11 < 0 || (iVar9 == 0)))) { +LAB_1000_fabd: + uVar16 = 0; + uVar15 = 0; + FUN_1020_08e6(0,0,uVar6); + iVar9 = FUN_1020_08a9(); + iVar9 = 0xed - iVar9; + uVar18 = 0x1e; + uVar8 = uVar5; + FUN_1020_08e6(uVar5,0x1e,iVar9); + iVar11 = FUN_1020_08a9(); + BITBLT(0x1020,0xc6,0x88,0,iVar11 + 400,uVar8,uVar18,iVar9,uVar15,uVar16); + FUN_1020_08e6(uVar6); + iVar9 = FUN_1020_08a9(); + iVar9 = 0xed - iVar9; + uVar18 = 0; + FUN_1020_08e6(0,iVar9); + uVar8 = FUN_1020_08a9(); + BITBLT(0x1020,0xc6,0x88,0,0xa0,uVar5,0x1e,uVar8,uVar18,iVar9); + } + else { + uVar10 = 0x31; + iVar9 = 0; + FUN_1020_08e6(uVar8,uVar18,uVar15); + if ((-1 < iVar9) && ((0 < iVar9 || (0x15 < uVar10)))) goto LAB_1000_fabd; + uVar17 = 0; + uVar16 = 0; + uVar15 = 0xed; + uVar18 = 0x1e; + uVar8 = uVar5; + FUN_1020_08e6(uVar5,0x1e,0xed,0,0,uVar6); + iVar9 = FUN_1020_08a9(); + BITBLT(0x1020,0xc6,0x88,0,iVar9 + 400,uVar8,uVar18,uVar15,uVar16,uVar17); + } + uVar18 = uVar4; + BITBLT(0x1228,0x20,0xcc,0,0,uVar6,0x1e,0xed,0xe9,0x174); + uVar8 = uVar5; + SELECTOBJECT(0x28,uVar2); + uVar2 = (undefined1)uVar6; + SELECTOBJECT(0x28,uVar3); + DELETEOBJECT(0x28,(char)uVar7,uVar2,uVar8,uVar18); + DELETEDC(0x1228,(char)uVar5); + DELETEDC(0x1228,uVar6); + unaff_CS = 0x1228; + RELEASEDC(0x1228,uVar4); + } + } + if ((DAT_1028_07c8 != '\0') && (*(char *)(iVar12 + 0xbdd) == '\0')) { + *(undefined1 *)(iVar12 + 0xbdf) = 1; + if ((DAT_1028_0853 < 0) || ((DAT_1028_0853 < 1 && (DAT_1028_0851 < 0x119)))) { + if ((DAT_1028_0853 == 0) && (DAT_1028_0851 == 1)) { + for (local_30 = 0x81; *(undefined2 *)(local_30 * 0x53 + 0x99e) = 0, local_30 != 0x85; + local_30 = local_30 + 1) { + } + } + bVar14 = 0xfffe < DAT_1028_0851; + DAT_1028_0851 = DAT_1028_0851 + 1; + DAT_1028_0853 = DAT_1028_0853 + (uint)bVar14; + FUN_1000_7440(&stack0xfffe); + } + else { + DAT_1028_07c8 = '\0'; + *(undefined1 *)(iVar12 + 0xbdf) = 0; + DAT_1028_0851 = 0; + DAT_1028_0853 = 0; + uVar8 = GETDC(unaff_CS,*(undefined2 *)(iVar12 + 4)); + FUN_1008_08bb(0x46,0x44,0x29,0x57,uVar8); + FUN_1008_093f(0x46,0x44,0x29,0x57,uVar8); + RELEASEDC(0x1008,uVar8); + for (local_30 = 0xf; + *(undefined1 *)(iVar12 + (uint)DAT_1028_07d1 * 0x14 + local_30 + 0x467) = 0, + local_30 != 0x13; local_30 = local_30 + 1) { + } + } + } + if (*(int *)((uint)DAT_1028_07d0 * 2 + 0x81f) == -1) { + FUN_1000_a72c(&stack0xfffe); + FUN_1000_acc2(&stack0xfffe); + FUN_1000_a604(&stack0xfffe); + FUN_1000_9e85(&stack0xfffe); + uVar8 = GETDC(0x1000,*(undefined2 *)(iVar12 + 4)); + FUN_1008_08bb(0x14,0x94,0xf3,0x54,uVar8); + FUN_1008_093f(0x14,0x94,0xf3,0x54,uVar8); + RELEASEDC(0x1008,uVar8); + DAT_1028_0876 = 0; + DAT_1028_0878 = 0; + } +LAB_1000_fd59: + FUN_1000_99f0(&stack0xfffe); + FUN_1008_00e2(); + *(undefined1 *)(iVar12 + 0x51) = 0; + if (*(int *)(iVar12 + 0x5e) != 0) { + *(int *)(iVar12 + 0x5e) = *(int *)(iVar12 + 0x5e) + -1; + } + return; +} + + +/* ===== 1000:fd85 ne_program_entry ===== */ + +/* WARNING: Control flow encountered bad instruction data */ + +void ne_program_entry(void) + +{ + undefined2 uVar1; + undefined4 uVar2; + + INITTASK(); + FUN_1020_0002(); + FUN_1008_298a(); + FUN_1008_2554(); + FUN_1010_0472(); + FUN_1008_15c2(); + FUN_1008_11b8(); + FUN_1008_0f27(); + uVar1 = 0x1228; + uVar2 = GETVERSION(0x1008); + DAT_1028_07c1 = (undefined2)((ulong)uVar2 >> 0x10); + DAT_1028_07bf = (undefined2)uVar2; + if ((byte)uVar2 < 3) { +LAB_1000_fdf4: + (*DAT_1028_0666)(0x1228,0x10,0x3c8,0x1028,0x396,0x1028,0); + } + else { + if ((byte)uVar2 == 3) { + if ((byte)((ulong)uVar2 >> 8) < 10) goto LAB_1000_fdf4; + } + uVar1 = 0x1018; + FUN_1018_1a61(0x748,0x1028,0x24,0x3e1,0x1028); + (*(code *)*(undefined2 *)(DAT_1028_0748 + 0x1c))(0x1018,0x748,0x1028); + (*(code *)*(undefined2 *)(DAT_1028_0748 + 8))(0x1018,0x748,0x1028,0); + } + FUN_1020_0061(uVar1); + /* WARNING: Bad instruction - Truncating control flow here */ + halt_baddata(); +} + + +/* ===== 1008:0002 FUN_1008_0002 ===== */ + +void __stdcall16far FUN_1008_0002(undefined2 param_1) + +{ + if ((DAT_1028_07c6 == '\0') && (DAT_1028_43f2 != '\0')) { + FUN_1008_1131(param_1); + } + return; +} + + +/* ===== 1008:0023 FUN_1008_0023 ===== */ + +void __stdcall16far FUN_1008_0023(undefined2 param_1) + +{ + undefined2 *puVar1; + undefined2 uVar2; + undefined2 uVar3; + undefined2 uVar4; + undefined2 *puVar5; + undefined2 uVar6; + int local_8; + + puVar5 = (undefined2 *)FUN_1020_012d(0x404); + uVar6 = (undefined2)((ulong)puVar5 >> 0x10); + puVar1 = (undefined2 *)puVar5; + if (puVar5 != (undefined2 *)0x0) { + *puVar5 = 0x300; + puVar1[1] = 0x100; + local_8 = 0; + while( true ) { + *(undefined1 *)(puVar1 + local_8 * 2 + 2) = 0; + *(undefined1 *)((int)puVar1 + local_8 * 4 + 5) = 0; + *(undefined1 *)(puVar1 + local_8 * 2 + 3) = 0; + *(undefined1 *)((int)puVar1 + local_8 * 4 + 7) = 4; + if (local_8 == 0xff) break; + local_8 = local_8 + 1; + } + uVar2 = GETDC(0x1020,param_1); + uVar4 = uVar2; + uVar3 = CREATEPALETTE(0x1228,puVar1); + uVar3 = SELECTPALETTE(0x1228,0,uVar3); + REALIZEPALETTE(0x1228,uVar2,uVar6,uVar4); + uVar6 = uVar2; + uVar4 = SELECTPALETTE(0x1228,1,uVar3); + DELETEOBJECT(0x1228,uVar4,uVar6); + RELEASEDC(0x1228,uVar2); + FUN_1020_0147(0x404,puVar5); + } + return; +} + + +/* ===== 1008:00e2 FUN_1008_00e2 ===== */ + +void __cdecl16far FUN_1008_00e2(void) + +{ + int iVar1; + undefined2 unaff_CS; + undefined2 unaff_SS; + undefined1 local_14 [2]; + int local_12; + + do { + iVar1 = PEEKMESSAGE(unaff_CS,1,0x32,0,0,local_14,unaff_SS); + if ((((iVar1 != 0) && (local_12 != 0x580)) && (local_12 != 0x100)) && (local_12 != 0x101)) { + TRANSLATEMESSAGE(0x1228,local_14); + DISPATCHMESSAGE(0x1228,local_14); + } + unaff_CS = 0x1228; + } while (iVar1 != 0); + return; +} + + +/* ===== 1008:0138 FUN_1008_0138 ===== */ + +void __stdcall16far +FUN_1008_0138(undefined2 param_1,undefined2 param_2,undefined2 param_3,undefined2 param_4, + undefined2 param_5,int param_6,undefined2 param_7,int param_8,undefined2 param_9, + undefined2 param_10,undefined2 param_11,undefined2 param_12,undefined2 param_13, + undefined2 param_14,undefined2 param_15,undefined2 param_16,undefined2 param_17, + undefined2 param_18,undefined2 param_19,undefined2 param_20,undefined2 param_21, + undefined2 param_22,undefined2 param_23,undefined2 param_24,undefined2 param_25, + uint param_26,int param_27,uint param_28,int param_29,uint param_30,int param_31, + uint param_32,int param_33,uint param_34,int param_35,char param_36,undefined1 param_37 + ,char param_38,undefined1 param_39,uint param_40) + +{ + uint uVar1; + undefined2 uVar2; + uint uVar3; + int iVar4; + int iVar5; + undefined2 uVar6; + int iVar7; + bool bVar8; + uint local_a; + int local_8; + uint local_6; + int local_4; + + if (param_40 < 0xb0) { + iVar7 = param_40 * 0x53; + *(undefined1 *)(iVar7 + 0x95b) = param_38; + if (param_26 == 0 && param_27 == 0) { + param_38 = '\x02'; + } + else { + param_38 = '\x01'; + } + if (param_36 == '\x01') { + bVar8 = CARRY2(DAT_1028_0849,param_34); + param_34 = DAT_1028_0849 + param_34; + param_35 = DAT_1028_084b + param_35 + (uint)bVar8; + bVar8 = CARRY2(DAT_1028_084d,param_32); + param_32 = DAT_1028_084d + param_32; + param_33 = DAT_1028_084f + param_33 + (uint)bVar8; + local_6 = param_34 + param_30; + local_4 = param_35 + param_31 + (uint)CARRY2(param_34,param_30); + local_a = param_32 + param_28; + local_8 = param_33 + param_29 + (uint)CARRY2(param_32,param_28); + } + else { + bVar8 = 0x13 < param_32; + param_32 = param_32 - 0x14; + param_33 = param_33 + -1 + (uint)bVar8; + local_6 = param_30; + local_4 = param_31; + local_a = param_28 - 0x14; + local_8 = param_29 + -1 + (uint)(0x13 < param_28); + } + if (((local_4 < 1) && ((local_4 < 0 || (local_6 == 0)))) || + ((local_4 <= param_35 && ((local_4 < param_35 || (local_6 <= param_34)))))) { + if (((local_4 < 1) && ((local_4 < 0 || (local_6 == 0)))) || + ((param_35 <= local_4 && ((param_35 < local_4 || (param_34 <= local_6)))))) { + iVar4 = (param_35 - param_27) - (uint)(param_34 < param_26); + uVar2 = FUN_1020_08a9(); + *(undefined2 *)(iVar7 + 0x95d) = uVar2; + *(int *)(iVar7 + 0x95f) = iVar4; + iVar4 = param_35 + param_27 + (uint)CARRY2(param_34,param_26); + uVar2 = FUN_1020_08a9(); + *(undefined2 *)(iVar7 + 0x965) = uVar2; + *(int *)(iVar7 + 0x967) = iVar4; + } + else { + iVar4 = local_4; + uVar2 = FUN_1020_08a9(); + *(undefined2 *)(iVar7 + 0x95d) = uVar2; + *(int *)(iVar7 + 0x95f) = iVar4; + iVar4 = param_35; + uVar2 = FUN_1020_08a9(); + *(undefined2 *)(iVar7 + 0x965) = uVar2; + *(int *)(iVar7 + 0x967) = iVar4; + } + } + else { + iVar4 = param_35; + uVar2 = FUN_1020_08a9(); + *(undefined2 *)(iVar7 + 0x95d) = uVar2; + *(int *)(iVar7 + 0x95f) = iVar4; + iVar4 = local_4; + uVar2 = FUN_1020_08a9(); + *(undefined2 *)(iVar7 + 0x965) = uVar2; + *(int *)(iVar7 + 0x967) = iVar4; + } + if (((local_8 < 1) && ((local_8 < 0 || (local_a == 0)))) || + ((local_8 <= param_33 && ((local_8 < param_33 || (local_a <= param_32)))))) { + if (((local_8 < 1) && ((local_8 < 0 || (local_a == 0)))) || + ((param_33 <= local_8 && ((param_33 < local_8 || (param_32 <= local_a)))))) { + iVar4 = (param_33 - param_27) - (uint)(param_32 < param_26); + uVar2 = FUN_1020_08a9(); + *(undefined2 *)(iVar7 + 0x961) = uVar2; + *(int *)(iVar7 + 0x963) = iVar4; + iVar4 = param_33 + param_27 + (uint)CARRY2(param_32,param_26); + uVar2 = FUN_1020_08a9(); + *(undefined2 *)(iVar7 + 0x969) = uVar2; + *(int *)(iVar7 + 0x96b) = iVar4; + } + else { + iVar4 = local_8; + uVar2 = FUN_1020_08a9(); + *(undefined2 *)(iVar7 + 0x961) = uVar2; + *(int *)(iVar7 + 0x963) = iVar4; + iVar4 = param_33; + uVar2 = FUN_1020_08a9(); + *(undefined2 *)(iVar7 + 0x969) = uVar2; + *(int *)(iVar7 + 0x96b) = iVar4; + } + } + else { + iVar4 = param_33; + uVar2 = FUN_1020_08a9(); + *(undefined2 *)(iVar7 + 0x961) = uVar2; + *(int *)(iVar7 + 0x963) = iVar4; + iVar4 = local_8; + uVar2 = FUN_1020_08a9(); + *(undefined2 *)(iVar7 + 0x969) = uVar2; + *(int *)(iVar7 + 0x96b) = iVar4; + } + if (param_38 == '\x01') { + iVar4 = param_35; + uVar2 = FUN_1020_08a9(); + *(undefined2 *)(iVar7 + 0x96d) = uVar2; + *(int *)(iVar7 + 0x96f) = iVar4; + iVar4 = param_33; + uVar2 = FUN_1020_08a9(); + *(undefined2 *)(iVar7 + 0x971) = uVar2; + *(int *)(iVar7 + 0x973) = iVar4; + *(undefined2 *)(iVar7 + 0x975) = 0; + *(undefined2 *)(iVar7 + 0x977) = 0; + *(undefined2 *)(iVar7 + 0x979) = 0; + *(undefined2 *)(iVar7 + 0x97b) = 0; + uVar6 = 0; + FUN_1020_08a9(); + uVar2 = FUN_1020_100b(); + *(undefined2 *)(iVar7 + 0x97d) = uVar2; + *(undefined2 *)(iVar7 + 0x97f) = uVar6; + *(int *)(iVar7 + 0x981) = param_27; + if ((*(int *)(iVar7 + 0x95f) < *(int *)(iVar7 + 0x96f)) || + ((*(int *)(iVar7 + 0x95f) <= *(int *)(iVar7 + 0x96f) && + (*(uint *)(iVar7 + 0x95d) < *(uint *)(iVar7 + 0x96d))))) { + uVar1 = *(uint *)(iVar7 + 0x95d); + iVar4 = *(int *)(iVar7 + 0x95f); + *(int *)(iVar7 + 0x95d) = uVar1 + 0xec78; + *(int *)(iVar7 + 0x95f) = iVar4 - (uint)(uVar1 < 5000); + } + else { + iVar5 = param_8; + uVar3 = FUN_1020_08a9(); + uVar1 = *(uint *)(iVar7 + 0x95d); + iVar4 = *(int *)(iVar7 + 0x95f); + *(int *)(iVar7 + 0x95d) = uVar3 + *(uint *)(iVar7 + 0x95d); + *(int *)(iVar7 + 0x95f) = iVar5 + iVar4 + (uint)CARRY2(uVar3,uVar1); + } + if ((*(int *)(iVar7 + 0x963) < *(int *)(iVar7 + 0x973)) || + ((*(int *)(iVar7 + 0x963) <= *(int *)(iVar7 + 0x973) && + (*(uint *)(iVar7 + 0x961) < *(uint *)(iVar7 + 0x971))))) { + uVar1 = *(uint *)(iVar7 + 0x961); + iVar4 = *(int *)(iVar7 + 0x963); + *(int *)(iVar7 + 0x961) = uVar1 + 0xec78; + *(int *)(iVar7 + 0x963) = iVar4 - (uint)(uVar1 < 5000); + } + else { + iVar5 = param_6; + uVar3 = FUN_1020_08a9(); + uVar1 = *(uint *)(iVar7 + 0x961); + iVar4 = *(int *)(iVar7 + 0x963); + *(int *)(iVar7 + 0x961) = uVar3 + *(uint *)(iVar7 + 0x961); + *(int *)(iVar7 + 0x963) = iVar5 + iVar4 + (uint)CARRY2(uVar3,uVar1); + } + if ((*(int *)(iVar7 + 0x96f) < *(int *)(iVar7 + 0x967)) || + ((*(int *)(iVar7 + 0x96f) <= *(int *)(iVar7 + 0x967) && + (*(uint *)(iVar7 + 0x96d) < *(uint *)(iVar7 + 0x965))))) { + uVar1 = *(uint *)(iVar7 + 0x965); + iVar4 = *(int *)(iVar7 + 0x967); + *(int *)(iVar7 + 0x965) = uVar1 + 5000; + *(int *)(iVar7 + 0x967) = iVar4 + (uint)(0xec77 < uVar1); + } + else { + uVar3 = FUN_1020_08a9(); + uVar1 = *(uint *)(iVar7 + 0x965); + iVar4 = *(int *)(iVar7 + 0x967); + *(int *)(iVar7 + 0x965) = uVar3 + *(uint *)(iVar7 + 0x965); + *(int *)(iVar7 + 0x967) = param_8 + iVar4 + (uint)CARRY2(uVar3,uVar1); + } + if ((*(int *)(iVar7 + 0x973) < *(int *)(iVar7 + 0x96b)) || + ((*(int *)(iVar7 + 0x973) <= *(int *)(iVar7 + 0x96b) && + (*(uint *)(iVar7 + 0x971) < *(uint *)(iVar7 + 0x969))))) { + uVar1 = *(uint *)(iVar7 + 0x969); + iVar4 = *(int *)(iVar7 + 0x96b); + *(int *)(iVar7 + 0x969) = uVar1 + 5000; + *(int *)(iVar7 + 0x96b) = iVar4 + (uint)(0xec77 < uVar1); + } + else { + uVar3 = FUN_1020_08a9(); + uVar1 = *(uint *)(iVar7 + 0x969); + iVar4 = *(int *)(iVar7 + 0x96b); + *(int *)(iVar7 + 0x969) = uVar3 + *(uint *)(iVar7 + 0x969); + *(int *)(iVar7 + 0x96b) = param_6 + iVar4 + (uint)CARRY2(uVar3,uVar1); + } + DAT_1028_0849 = param_34; + DAT_1028_084b = param_35; + DAT_1028_084d = param_32; + DAT_1028_084f = param_33; + } + else if (param_38 == '\x02') { + uVar1 = *(uint *)(iVar7 + 0x95d); + iVar4 = *(int *)(iVar7 + 0x95f); + *(int *)(iVar7 + 0x95d) = uVar1 + 0xec78; + *(int *)(iVar7 + 0x95f) = iVar4 - (uint)(uVar1 < 5000); + uVar1 = *(uint *)(iVar7 + 0x965); + iVar4 = *(int *)(iVar7 + 0x967); + *(int *)(iVar7 + 0x965) = uVar1 + 5000; + *(int *)(iVar7 + 0x967) = iVar4 + (uint)(0xec77 < uVar1); + uVar1 = *(uint *)(iVar7 + 0x961); + iVar4 = *(int *)(iVar7 + 0x963); + *(int *)(iVar7 + 0x961) = uVar1 + 0xec78; + *(int *)(iVar7 + 0x963) = iVar4 - (uint)(uVar1 < 5000); + uVar1 = *(uint *)(iVar7 + 0x969); + iVar4 = *(int *)(iVar7 + 0x96b); + *(int *)(iVar7 + 0x969) = uVar1 + 5000; + *(int *)(iVar7 + 0x96b) = iVar4 + (uint)(0xec77 < uVar1); + uVar2 = FUN_1020_08a9(); + *(undefined2 *)(iVar7 + 0x96d) = uVar2; + *(int *)(iVar7 + 0x96f) = param_35; + uVar2 = FUN_1020_08a9(); + *(undefined2 *)(iVar7 + 0x971) = uVar2; + *(int *)(iVar7 + 0x973) = param_33; + iVar4 = local_4; + uVar2 = FUN_1020_08a9(); + *(undefined2 *)(iVar7 + 0x975) = uVar2; + *(int *)(iVar7 + 0x977) = iVar4; + iVar4 = local_8; + uVar2 = FUN_1020_08a9(); + *(undefined2 *)(iVar7 + 0x979) = uVar2; + *(int *)(iVar7 + 0x97b) = iVar4; + DAT_1028_0849 = local_6; + DAT_1028_084b = local_4; + DAT_1028_084d = local_a; + DAT_1028_084f = local_8; + *(undefined2 *)(iVar7 + 0x97d) = 0; + *(undefined2 *)(iVar7 + 0x97f) = 0; + *(undefined2 *)(iVar7 + 0x981) = 0; + } + *(undefined2 *)(iVar7 + 0x983) = param_23; + *(undefined2 *)(iVar7 + 0x985) = param_24; + *(undefined2 *)(iVar7 + 0x987) = param_25; + *(undefined2 *)(iVar7 + 0x989) = param_20; + *(undefined2 *)(iVar7 + 0x98b) = param_21; + *(undefined2 *)(iVar7 + 0x98d) = param_22; + *(undefined1 *)(iVar7 + 0x98f) = param_39; + *(undefined2 *)(iVar7 + 0x990) = param_17; + *(undefined2 *)(iVar7 + 0x992) = param_18; + *(undefined2 *)(iVar7 + 0x994) = param_19; + *(undefined2 *)(iVar7 + 0x996) = param_14; + *(undefined2 *)(iVar7 + 0x998) = param_15; + *(undefined2 *)(iVar7 + 0x99a) = param_16; + *(undefined1 *)(iVar7 + 0x95c) = param_37; + *(undefined2 *)(iVar7 + 0x99c) = param_13; + *(undefined2 *)(iVar7 + 0x99e) = param_12; + *(undefined2 *)(iVar7 + 0x9a0) = param_10; + *(undefined2 *)(iVar7 + 0x9a2) = param_11; + *(undefined2 *)(iVar7 + 0x9a4) = param_9; + *(undefined2 *)(iVar7 + 0x9a6) = param_4; + *(undefined2 *)(iVar7 + 0x9a8) = param_3; + *(undefined2 *)(iVar7 + 0x9aa) = param_2; + *(undefined2 *)(iVar7 + 0x9ac) = param_1; + } + return; +} + + +/* ===== 1008:0787 FUN_1008_0787 ===== */ + +void __stdcall16far +FUN_1008_0787(undefined2 param_1,undefined2 param_2,undefined2 param_3,undefined2 param_4, + int param_5) + +{ + param_5 = param_5 * 8; + *(undefined2 *)(param_5 + 0x4263) = param_4; + *(undefined2 *)(param_5 + 0x4265) = param_3; + *(undefined2 *)(param_5 + 16999) = param_2; + *(undefined2 *)(param_5 + 0x4269) = param_1; + return; +} + + +/* ===== 1008:07b6 FUN_1008_07b6 ===== */ + +void __stdcall16far +FUN_1008_07b6(undefined2 param_1,undefined2 param_2,undefined2 param_3,undefined2 param_4, + undefined2 param_5,undefined2 param_6) + +{ + undefined2 uVar1; + undefined2 uVar2; + undefined2 uVar3; + undefined2 uVar4; + undefined2 uVar5; + undefined2 uVar6; + undefined2 uVar7; + + uVar4 = param_6; + uVar1 = CREATECOMPATIBLEDC(); + uVar2 = CREATECOMPATIBLEDC(0x1228,param_6,uVar4); + uVar3 = SELECTOBJECT(0x1228,DAT_1028_085b); + uVar7 = uVar2; + uVar4 = SELECTOBJECT(0x1228,param_1); + uVar6 = uVar1; + BITBLT(0x1228,0x20,0xcc,0,0,uVar2,param_2,param_3,param_4,param_5); + uVar5 = uVar2; + SELECTOBJECT(0x1228,uVar4); + uVar4 = uVar1; + SELECTOBJECT(0x1228,uVar3); + DELETEDC(0x1228,uVar2,uVar4,uVar5,uVar6,uVar7); + DELETEDC(0x1228,uVar1); + return; +} + + +/* ===== 1008:0837 FUN_1008_0837 ===== */ + +void __stdcall16far +FUN_1008_0837(undefined2 param_1,undefined2 param_2,undefined2 param_3,undefined2 param_4, + undefined2 param_5) + +{ + undefined2 uVar1; + undefined2 uVar2; + undefined2 uVar3; + undefined2 uVar4; + undefined2 uVar5; + undefined2 uVar6; + undefined2 uVar7; + + uVar4 = param_5; + uVar1 = CREATECOMPATIBLEDC(); + uVar2 = CREATECOMPATIBLEDC(0x1228,param_5,uVar4); + uVar3 = SELECTOBJECT(0x1228,DAT_1028_085b); + uVar7 = uVar2; + uVar4 = SELECTOBJECT(0x1228,DAT_1028_085f); + uVar6 = uVar1; + BITBLT(0x1228,0x20,0xcc,param_3,param_4,uVar2,param_1,param_2,param_3,param_4); + uVar5 = uVar2; + SELECTOBJECT(0x1228,uVar4); + uVar4 = uVar1; + SELECTOBJECT(0x1228,uVar3); + DELETEDC(0x1228,uVar2,uVar4,uVar5,uVar6,uVar7); + DELETEDC(0x1228,uVar1); + return; +} + + +/* ===== 1008:08bb FUN_1008_08bb ===== */ + +void __stdcall16far +FUN_1008_08bb(undefined2 param_1,undefined2 param_2,undefined2 param_3,undefined2 param_4, + undefined2 param_5) + +{ + undefined2 uVar1; + undefined2 uVar2; + undefined2 uVar3; + undefined2 uVar4; + undefined2 uVar5; + undefined2 uVar6; + undefined2 uVar7; + + uVar4 = param_5; + uVar1 = CREATECOMPATIBLEDC(); + uVar2 = CREATECOMPATIBLEDC(0x1228,param_5,uVar4); + uVar3 = SELECTOBJECT(0x1228,DAT_1028_085b); + uVar7 = uVar2; + uVar4 = SELECTOBJECT(0x1228,DAT_1028_085d); + uVar6 = uVar1; + BITBLT(0x1228,0x20,0xcc,param_3,param_4,uVar2,param_1,param_2,param_3,param_4); + uVar5 = uVar2; + SELECTOBJECT(0x1228,uVar4); + uVar4 = uVar1; + SELECTOBJECT(0x1228,uVar3); + DELETEDC(0x1228,uVar2,uVar4,uVar5,uVar6,uVar7); + DELETEDC(0x1228,uVar1); + return; +} + + +/* ===== 1008:093f FUN_1008_093f ===== */ + +void __stdcall16far +FUN_1008_093f(undefined2 param_1,undefined2 param_2,undefined2 param_3,undefined2 param_4, + undefined2 param_5) + +{ + undefined2 uVar1; + undefined2 uVar2; + undefined2 uVar3; + undefined2 uVar4; + undefined2 uVar5; + + uVar5 = param_5; + uVar1 = CREATECOMPATIBLEDC(); + uVar4 = uVar1; + uVar2 = SELECTOBJECT(0x1228,DAT_1028_085b); + BITBLT(0x1228,0x20,0xcc,param_3,param_4,uVar1,param_1,param_2,param_3,param_4); + uVar3 = uVar1; + SELECTOBJECT(0x1228,uVar2); + DELETEDC(0x1228,uVar1,uVar3,param_5,uVar4,uVar5); + return; +} + + +/* ===== 1008:0996 FUN_1008_0996 ===== */ + +void __stdcall16far FUN_1008_0996(undefined2 param_1,uint param_2,int param_3) + +{ + undefined2 uVar1; + undefined2 uVar2; + undefined2 uVar3; + undefined2 uVar4; + undefined2 uVar5; + int iVar6; + byte bVar7; + undefined2 uVar8; + undefined2 uVar9; + undefined2 uVar10; + undefined2 uVar11; + undefined2 local_32; + undefined2 local_1c; + undefined1 local_4; + + uVar2 = param_1; + uVar1 = CREATECOMPATIBLEDC(); + uVar2 = CREATECOMPATIBLEDC(0x1228,param_1,uVar2); + uVar3 = CREATECOMPATIBLEBITMAP(0x1228,0x28,0x96); + if (param_2 == 1) { + local_32 = 0x129; + } + else if (param_2 == 2) { + local_32 = 0x155; + } + else if (param_2 == 3) { + local_32 = 0x181; + } + else if (param_2 == 4) { + local_32 = 0x1ad; + } + else { + local_32 = 0xfd; + } + if ((param_3 < 0) || + ((((param_3 < 1 && (param_2 == 0)) || (0 < param_3)) || ((-1 < param_3 && (4 < param_2)))))) { + local_1c = param_3; + } + else { + local_1c = *(int *)(param_2 * 4 + 0x980); + } + uVar11 = uVar1; + uVar4 = SELECTOBJECT(0x1228,DAT_1028_085b); + uVar10 = uVar2; + uVar5 = SELECTOBJECT(0x1228,uVar3); + uVar9 = uVar2; + BITBLT(0x1228,0x20,0xcc,local_32 + -0x14,0x1de,uVar1,0x28,0x82,0,0); + local_4 = 0; + while( true ) { + bVar7 = 10; + FUN_1020_08e6(uVar9,uVar10,uVar11); + uVar8 = 0x1020; + iVar6 = FUN_1020_08e6(); + if ((((bVar7 != 0) || (0 < local_1c)) || ((-1 < local_1c && (iVar6 != 0)))) || (local_4 == 0)) { + SELECTOBJECT(0x1020,DAT_1028_0861); + uVar8 = 0x1228; + BITBLT(0x1228,0xc6,0x88,0,(uint)bVar7 << 4,uVar1,0x1c,0x10,0,(7 - (uint)local_4) * 0x10); + } + if (local_4 == 7) break; + local_4 = local_4 + 1; + } + BITBLT(uVar8,0x20,0xcc,0,0,uVar2,0x28,0x82,local_32 + -0x14,0x1de); + uVar10 = uVar1; + SELECTOBJECT(0x1228,uVar4); + uVar9 = uVar2; + SELECTOBJECT(0x1228,uVar5); + DELETEOBJECT(0x1228,uVar3,uVar9,uVar10,param_1); + DELETEDC(0x1228,uVar1); + DELETEDC(0x1228,uVar2); + return; +} + + +/* ===== 1008:0b9e FUN_1008_0b9e ===== */ + +void __stdcall16far FUN_1008_0b9e(byte param_1,undefined2 param_2) + +{ + int iVar1; + int local_6; + int local_4; + + if ((((param_1 == DAT_1028_07d1) || (DAT_1028_086b == 99)) && (param_1 != 0)) && (param_1 < 5)) { + iVar1 = *(int *)((uint)param_1 * 4 + 0x980); + if ((iVar1 < 0x14) && ((iVar1 < 0x13 || (*(uint *)((uint)param_1 * 4 + 0x97e) < 0xd621)))) { + iVar1 = *(int *)((uint)param_1 * 4 + 0x980); + if ((iVar1 < 10) && ((iVar1 < 9 || (*(uint *)((uint)param_1 * 4 + 0x97e) < 0xeb11)))) { + iVar1 = *(int *)((uint)param_1 * 4 + 0x980); + if ((iVar1 < 3) && ((iVar1 < 2 || (*(uint *)((uint)param_1 * 4 + 0x97e) < 0x22e1)))) { + iVar1 = *(int *)((uint)param_1 * 4 + 0x980); + if ((iVar1 < 1) && ((iVar1 < 0 || (*(uint *)((uint)param_1 * 4 + 0x97e) < 0x7d1)))) { + local_4 = 0; + } + else { + local_4 = 1; + } + } + else { + local_4 = 2; + } + } + else { + local_4 = 3; + } + } + else { + local_4 = 4; + } + if (local_4 != DAT_1028_086b) { + if (local_4 == 0) { + FUN_1008_0837(0x8e,0x92,0x45,0x17c,param_2); + } + else { + FUN_1008_07b6(*(undefined2 *)(local_4 * 2 + 0x4319),0x8e,0x92,0x45,0x17c,param_2); + } + FUN_1008_093f(0x8e,0x92,0x45,0x17c,param_2); + local_6 = 0; + while( true ) { + if (local_6 == local_4) { + FUN_1008_0837(0xb,0xb,(4 - local_6) * 0x17 + 0x4d,0x220,param_2); + FUN_1008_093f(0xb,0xb,(4 - local_6) * 0x17 + 0x4d,0x220,param_2); + } + else { + FUN_1008_08bb(0xb,0xb,(4 - local_6) * 0x17 + 0x4d,0x220,param_2); + FUN_1008_093f(0xb,0xb,(4 - local_6) * 0x17 + 0x4d,0x220,param_2); + } + if (local_6 == 4) break; + local_6 = local_6 + 1; + } + } + DAT_1028_086b = local_4; + } + else if (param_1 == 0) { + FUN_1008_08bb(0x8e,0x92,0x45,0x17c,param_2); + FUN_1008_093f(0x8e,0x92,0x45,0x17c,param_2); + local_6 = 0; + while( true ) { + FUN_1008_08bb(0xb,0xb,(4 - local_6) * 0x17 + 0x4d,0x220,param_2); + FUN_1008_093f(0xb,0xb,(4 - local_6) * 0x17 + 0x4d,0x220,param_2); + if (local_6 == 4) break; + local_6 = local_6 + 1; + } + DAT_1028_086b = 99; + } + return; +} + + +/* ===== 1008:0dbd FUN_1008_0dbd ===== */ + +void __stdcall16far FUN_1008_0dbd(int param_1,undefined2 param_2) + +{ + if (param_1 == 0) { + FUN_1008_08bb(0x3d,0x44,300,0x7b,param_2); + } + else { + FUN_1008_07b6(((undefined2 *)&DAT_1028_4321)[param_1],0x3d,0x44,300,0x7b,param_2); + } + FUN_1008_093f(0x3d,0x44,300,0x7b,param_2); + return; +} + + +/* ===== 1008:0e08 FUN_1008_0e08 ===== */ + +void __stdcall16far FUN_1008_0e08(char param_1,uint param_2,undefined2 param_3) + +{ + int iVar1; + undefined2 uVar2; + undefined2 uVar3; + undefined2 uVar4; + undefined2 uVar5; + undefined2 uVar6; + undefined2 uVar7; + undefined2 local_16; + + if (param_2 == 0) { + FUN_1008_08bb(0x4a,100,0x2f,0xee,param_3); + FUN_1008_093f(0x4a,100,0x2f,0xee,param_3); + } + else { + uVar3 = param_3; + uVar2 = CREATECOMPATIBLEDC(); + uVar3 = CREATECOMPATIBLEDC(0x1228,param_3,uVar3); + uVar4 = SELECTOBJECT(0x1228,DAT_1028_085b); + uVar5 = SELECTOBJECT(0x1228,DAT_1028_0863); + local_16 = 0; + if (param_1 == '\0') { + local_16 = 0x94; + } + if (9 < param_2) { + local_16 = local_16 + 0x4a; + param_2 = param_2 - 9; + } + iVar1 = (param_2 - 1) * 100; + uVar7 = uVar2; + BITBLT(0x1228,0x20,0xcc,local_16,iVar1,uVar3,0x4a,100,0x2f,0xee); + BITBLT(0x1228,0x20,0xcc,local_16,iVar1,uVar3,0x4a,100,0x2f,0xee); + uVar6 = uVar2; + SELECTOBJECT(0x1228,uVar4); + uVar4 = uVar3; + SELECTOBJECT(0x1228,uVar5); + DELETEDC(0x1228,uVar3,uVar4,uVar6,param_3,uVar7); + DELETEDC(0x1228,uVar2); + } + return; +} + + +/* ===== 1008:0f27 FUN_1008_0f27 ===== */ + +void __cdecl16far FUN_1008_0f27(void) + +{ + return; +} + + +/* ===== 1008:0f2e FUN_1008_0f2e ===== */ + +void __cdecl16far FUN_1008_0f2e(void) + +{ + undefined2 uVar1; + int iVar2; + undefined2 uVar3; + int unaff_BP; + undefined2 unaff_SS; + undefined4 uVar4; + undefined1 *puVar5; + undefined2 uVar6; + undefined2 uVar7; + undefined2 uVar8; + undefined1 *puVar9; + undefined1 *puVar10; + undefined1 local_2de [512]; + undefined1 local_de [102]; + undefined1 local_78 [102]; + undefined2 local_12; + undefined4 local_10; + int local_c; + int local_a; + undefined2 local_8; + undefined2 local_6; + undefined2 uStack_4; + int iStack_2; + + iStack_2 = unaff_BP + 1; + uStack_4 = 0x1028; + DAT_1028_43f2 = 0; + DAT_1028_43f3 = 0; + DAT_1028_43ee = 0; + puVar10 = local_78; + puVar9 = local_2de; + uVar1 = unaff_SS; + uVar8 = unaff_SS; + FUN_1020_082e(0); + FUN_1008_2f2f(puVar9,uVar1,puVar10,uVar8); + puVar9 = local_de; + puVar10 = local_78; + uVar7 = 0x1008; + uVar6 = 0xf2c; + puVar5 = local_2de; + uVar1 = unaff_SS; + uVar8 = unaff_SS; + uVar3 = unaff_SS; + FUN_1020_082e(0); + uVar1 = FUN_1020_0a7d(puVar5,uVar1,uVar6,uVar7); + FUN_1008_2f07(uVar1,puVar10,uVar8,puVar9,uVar3); + FUN_1008_2f4d(0x442,0x1028,local_de,unaff_SS); + uVar1 = 0x1028; + local_c = GETPRIVATEPROFILEINT(0x1008,local_de,unaff_SS,1,0x44f,0x1028,0x446); + if ((local_c != 0) && (DAT_1028_43ee = WAVEOUTGETNUMDEVS(0x1228,uVar1), DAT_1028_43ee != 0)) { + iVar2 = WAVEOUTGETDEVCAPS(0x1228,0x30,0x43be,0x1028); + if (iVar2 == 0) { + if ((DAT_1028_43ea & 4) == 0) { + DAT_1028_43f4 = -1; + } + else { + local_8 = 0; + local_6 = 0; + WAVEOUTGETVOLUME(0x1228,&local_8,unaff_SS); + DAT_1028_43f4 = (local_8._1_1_ / 10) * '\n'; + } + local_a = 1; + while( true ) { + if (*(int *)(local_a * 4 + 0x3e6) != 0 || *(int *)(local_a * 4 + 1000) != 0) { + uVar1 = DAT_1028_06fe; + uVar8 = DAT_1028_06fe; + uVar3 = FINDRESOURCE(0x1228,0x455,0x1028,local_a + 2000,local_a + 2000 >> 0xf); + local_12 = LOADRESOURCE(0x1228,uVar3); + uVar4 = FUN_1008_15c7(*(undefined2 *)(local_a * 4 + 0x3e6), + *(undefined2 *)(local_a * 4 + 1000),0x42); + *(int *)((undefined1 *)&DAT_1028_43f2 + local_a * 4) = (int)uVar4; + *(int *)((undefined1 *)&DAT_1028_43f4 + local_a * 4) = (int)((ulong)uVar4 >> 0x10); + local_10 = LOCKRESOURCE(0x1008,local_12,uVar1,uVar8); + FUN_1020_16a5(*(undefined2 *)(local_a * 4 + 0x3e6), + (int)*(undefined4 *)((undefined1 *)&DAT_1028_43f2 + local_a * 4), + (int)((ulong)*(undefined4 *)((undefined1 *)&DAT_1028_43f2 + local_a * 4) >> + 0x10),local_10); + GLOBALUNLOCK(0x1020,local_12); + FREERESOURCE(0x1228,local_12); + } + if (local_a == 0x16) break; + local_a = local_a + 1; + } + DAT_1028_43f2 = 1; + } + else { + DAT_1028_43ee = 0; + } + } + return; +} + + +/* ===== 1008:10e3 FUN_1008_10e3 ===== */ + +void __cdecl16far FUN_1008_10e3(void) + +{ + undefined2 unaff_CS; + int local_6; + + if (DAT_1028_43ee != 0) { + if (DAT_1028_43f3 != '\0') { + SNDPLAYSOUND(unaff_CS,0,0); + } + local_6 = 1; + while( true ) { + FUN_1008_15e7(*(undefined2 *)((undefined1 *)&DAT_1028_43f2 + local_6 * 4), + *(undefined2 *)((undefined1 *)&DAT_1028_43f4 + local_6 * 4)); + if (local_6 == 0x16) break; + local_6 = local_6 + 1; + } + DAT_1028_43f3 = '\0'; + } + return; +} + + +/* ===== 1008:1131 FUN_1008_1131 ===== */ + +undefined2 __stdcall16far FUN_1008_1131(int param_1) + +{ + int iVar1; + undefined2 unaff_CS; + undefined2 uVar2; + undefined2 local_6; + + if (((DAT_1028_43ee != 0) && (DAT_1028_43f2 != '\0')) && + (*(int *)(param_1 * 4 + 0x3e6) != 0 || *(int *)(param_1 * 4 + 1000) != 0)) { + uVar2 = unaff_CS; + if (DAT_1028_43f3 != '\0') { + uVar2 = 0x1228; + SNDPLAYSOUND(unaff_CS,0,0); + } + iVar1 = SNDPLAYSOUND(uVar2,5,(int)*(undefined4 *)((undefined1 *)&DAT_1028_43f2 + param_1 * 4)); + DAT_1028_43f3 = iVar1 != 0; + } + return local_6; +} + + +/* ===== 1008:118f FUN_1008_118f ===== */ + +undefined2 __cdecl16far FUN_1008_118f(void) + +{ + undefined2 unaff_CS; + undefined2 local_6; + + if ((DAT_1028_43ee != 0) && (DAT_1028_43f3 != '\0')) { + SNDPLAYSOUND(unaff_CS,0,0); + } + return local_6; +} + + +/* ===== 1008:11b8 FUN_1008_11b8 ===== */ + +void __cdecl16far FUN_1008_11b8(void) + +{ + return; +} + + +/* ===== 1008:11c5 FUN_1008_11c5 ===== */ + +/* WARNING: Removing unreachable block (ram,0x1008123e) */ +/* WARNING: Removing unreachable block (ram,0x10081234) */ + +void __cdecl16far FUN_1008_11c5(void) + +{ + int iVar1; + undefined2 *puVar2; + undefined2 uVar3; + bool bVar4; + undefined2 *puVar5; + uint local_10; + int local_e; + + iVar1 = FUN_1020_08a9(); + puVar5 = (undefined2 *)FUN_1020_012d(iVar1 + 8); + uVar3 = (undefined2)((ulong)puVar5 >> 0x10); + puVar2 = (undefined2 *)puVar5; + puVar2[1] = 0x100; + *puVar5 = 0x300; + local_10 = 0; + local_e = 0; + while( true ) { + iVar1 = FUN_1020_08a9(); + *(undefined1 *)(puVar2 + local_10 * 2 + 2) = *(undefined1 *)(iVar1 + 0x4450); + iVar1 = FUN_1020_08a9(); + *(undefined1 *)((int)puVar2 + local_10 * 4 + 5) = *(undefined1 *)(iVar1 + 0x4451); + iVar1 = FUN_1020_08a9(); + *(undefined1 *)(puVar2 + local_10 * 2 + 3) = *(undefined1 *)(iVar1 + 0x4452); + *(undefined1 *)((int)puVar2 + local_10 * 4 + 7) = 0; + if ((local_e == 0) && (local_10 == 0xff)) break; + bVar4 = 0xfffe < local_10; + local_10 = local_10 + 1; + local_e = local_e + (uint)bVar4; + } + DAT_1028_444e = CREATEPALETTE(0x1020,puVar2); + uVar3 = FUN_1020_039d(puVar5,uVar3); + FUN_1020_0147(uVar3,puVar5); + return; +} + + +/* ===== 1008:1326 FUN_1008_1326 ===== */ + +void __stdcall16far +FUN_1008_1326(undefined4 param_1,undefined2 param_2,undefined2 param_3,undefined2 param_4) + +{ + undefined2 uVar1; + int iVar2; + undefined1 uVar3; + undefined2 unaff_CS; + undefined4 uVar4; + undefined2 uVar5; + undefined2 local_e; + + uVar5 = param_4; + uVar1 = FINDRESOURCE(unaff_CS,0x45a,0x1028,param_2,param_3); + uVar1 = LOADRESOURCE(0x1228,uVar1); + uVar4 = LOCKRESOURCE(0x1228,uVar1,param_4,uVar5); + local_e = 0; + while( true ) { + iVar2 = FUN_1020_039d(); + uVar3 = *(undefined1 *)((int)uVar4 + iVar2); + iVar2 = FUN_1020_039d(); + *(undefined1 *)((int)param_1 + iVar2) = uVar3; + if (local_e == 0x2ff) break; + local_e = local_e + 1; + } + GLOBALUNLOCK(0x1020,uVar1); + return; +} + + +/* ===== 1008:13a8 FUN_1008_13a8 ===== */ + +void __stdcall16far FUN_1008_13a8(undefined4 param_1) + +{ + uint uVar1; + int iVar2; + int iVar3; + int iVar4; + int iVar5; + undefined2 uVar6; + bool bVar7; + uint local_10; + int local_e; + + uVar6 = (undefined2)((ulong)param_1 >> 0x10); + iVar5 = (int)param_1; + iVar4 = -(uint)(1 << ((byte)*(undefined2 *)(iVar5 + 0xe) & 0x1f) == 0); + uVar1 = FUN_1020_08a9(); + iVar2 = uVar1 + 8; + iVar4 = iVar4 + (uint)(0xfff7 < uVar1); + local_10 = 0; + local_e = 0; + while( true ) { + iVar3 = FUN_1020_08a9(iVar2,iVar4); + *(undefined1 *)(iVar5 + local_10 * 4 + 0x2a) = *(undefined1 *)(iVar3 + 0x4450); + iVar3 = FUN_1020_08a9(); + *(undefined1 *)(iVar5 + local_10 * 4 + 0x29) = *(undefined1 *)(iVar3 + 0x4451); + iVar3 = FUN_1020_08a9(); + *(undefined1 *)(iVar5 + local_10 * 4 + 0x28) = *(undefined1 *)(iVar3 + 0x4452); + *(undefined1 *)(iVar5 + local_10 * 4 + 0x2b) = 0; + if ((local_e == 0) && (local_10 == 0xff)) break; + bVar7 = 0xfffe < local_10; + local_10 = local_10 + 1; + local_e = local_e + (uint)bVar7; + } + return; +} + + +/* ===== 1008:149d FUN_1008_149d ===== */ + +undefined2 __stdcall16far FUN_1008_149d(undefined2 param_1,undefined2 param_2,undefined2 param_3) + +{ + undefined2 uVar1; + undefined2 uVar2; + int unaff_BP; + undefined2 unaff_CS; + undefined2 unaff_SS; + undefined4 uVar3; + undefined4 uVar4; + undefined2 uVar5; + undefined2 uVar6; + undefined1 local_32 [14]; + byte local_24; + undefined2 local_a; + undefined2 local_8; + undefined2 local_6; + undefined2 uStack_4; + int iStack_2; + + iStack_2 = unaff_BP + 1; + uStack_4 = 0x1028; + uVar5 = param_3; + local_a = FINDRESOURCE(unaff_CS,0x45e,0x1028,param_1,param_2); + local_8 = LOADRESOURCE(0x1228,local_a); + uVar3 = LOCKRESOURCE(0x1228,local_8,param_3,uVar5); + FUN_1020_0891(0x28,local_32,unaff_SS,uVar3); + uVar4 = FUN_1020_012d((1 << (local_24 & 0x1f)) * 4 + 0x28); + FUN_1020_0891(0x28,uVar4,local_32,unaff_SS); + FUN_1008_13a8(uVar4); + uVar6 = 0x1028; + uVar1 = CREATEDC(0x1008,0,0,0,0,0,0,0x462); + uVar5 = uVar1; + uVar2 = SELECTPALETTE(0x1228,0,DAT_1028_444e); + UNREALIZEOBJECT(0x1228,DAT_1028_444e,uVar5,uVar6); + REALIZEPALETTE(0x1228,uVar1); + uVar6 = uVar1; + local_6 = CREATEDIBITMAP(0x1228,0,uVar4,(int)uVar3 + 0x28,(int)((ulong)uVar3 >> 0x10),4,0,local_32 + ,unaff_SS); + uVar5 = uVar1; + SELECTPALETTE(0x1228,0,uVar2); + DELETEDC(0x1228,uVar1,uVar5,uVar6); + GLOBALUNLOCK(0x1228,local_8); + FREERESOURCE(0x1228,local_8); + return local_6; +} + + +/* ===== 1008:15c2 FUN_1008_15c2 ===== */ + +void __cdecl16far FUN_1008_15c2(void) + +{ + return; +} + + +/* ===== 1008:15c7 FUN_1008_15c7 ===== */ + +void __stdcall16far FUN_1008_15c7(undefined2 param_1,undefined2 param_2,undefined2 param_3) + +{ + undefined2 uVar1; + int unaff_BP; + int iVar2; + undefined2 unaff_CS; + undefined2 uVar3; + + iVar2 = unaff_BP + 1; + uVar3 = 0x1028; + uVar1 = GLOBALALLOC(unaff_CS,param_1,param_2); + GLOBALLOCK(0x1228,uVar1,param_3,uVar3,iVar2); + return; +} + + +/* ===== 1008:15e7 FUN_1008_15e7 ===== */ + +void __stdcall16far FUN_1008_15e7(undefined2 param_1,undefined2 param_2) + +{ + undefined2 uVar1; + int unaff_BP; + int iVar2; + undefined2 uVar3; + + iVar2 = unaff_BP + 1; + uVar3 = 0x1028; + uVar1 = GLOBALHANDLE(); + GLOBALUNLOCK(0x1228,uVar1,uVar1,param_2,uVar3,iVar2); + GLOBALFREE(0x1228); + return; +} + + +/* ===== 1008:1607 FUN_1008_1607 ===== */ + +undefined4 __stdcall16far +FUN_1008_1607(undefined4 param_1,undefined2 param_2,undefined2 param_3,undefined2 param_4, + undefined2 param_5,undefined2 param_6,undefined2 param_7,undefined2 param_8, + undefined2 param_9,undefined2 param_10,undefined2 param_11) + +{ + int iVar1; + undefined2 uVar2; + bool bVar3; + undefined2 local_8; + + bVar3 = true; + FUN_1020_03ef(); + if (!bVar3) { + if (DAT_1028_066a == '\0') { + local_8 = 0x7f02; + } + else { + local_8 = 0x7f05; + } + uVar2 = (undefined2)((ulong)param_1 >> 0x10); + iVar1 = (int)param_1; + FUN_1008_2996(iVar1,uVar2,0,local_8,0,param_10,param_11); + *(undefined2 *)(iVar1 + 0x26) = param_8; + *(undefined2 *)(iVar1 + 0x28) = param_9; + *(undefined2 *)(iVar1 + 0x2a) = param_6; + *(undefined2 *)(iVar1 + 0x2c) = param_7; + *(undefined2 *)(iVar1 + 0x2e) = param_4; + *(undefined2 *)(iVar1 + 0x30) = param_5; + *(undefined2 *)(iVar1 + 0x32) = param_3; + } + return param_1; +} + + +/* ===== 1008:168e FUN_1008_168e ===== */ + +undefined1 __stdcall16far FUN_1008_168e(undefined4 param_1) + +{ + int iVar1; + undefined2 uVar2; + undefined2 unaff_CS; + + uVar2 = (undefined2)((ulong)param_1 >> 0x10); + iVar1 = (int)param_1; + GETDLGITEMTEXT(unaff_CS,*(undefined2 *)(iVar1 + 0x32),*(undefined2 *)(iVar1 + 0x2e), + *(undefined2 *)(iVar1 + 0x30),0x65); + return 1; +} + + +/* ===== 1008:16be FUN_1008_16be ===== */ + +void __stdcall16far FUN_1008_16be(undefined4 param_1) + +{ + int unaff_BP; + int iVar1; + int iVar2; + undefined2 uVar3; + undefined2 uVar4; + + iVar1 = unaff_BP + 1; + uVar4 = 0x1028; + uVar3 = (undefined2)((ulong)param_1 >> 0x10); + iVar2 = (int)param_1; + FUN_1018_0d9b(iVar2,uVar3); + SETWINDOWTEXT(0x1018,*(undefined2 *)(iVar2 + 0x26),*(undefined2 *)(iVar2 + 0x28), + *(undefined2 *)(iVar2 + 4),uVar4,iVar1); + SETDLGITEMTEXT(0x1228,*(undefined2 *)(iVar2 + 0x2a),*(undefined2 *)(iVar2 + 0x2c),100); + SETDLGITEMTEXT(0x1228,*(undefined2 *)(iVar2 + 0x2e),*(undefined2 *)(iVar2 + 0x30),0x65); + SENDDLGITEMMESSAGE(0x1228,0,0,*(int *)(iVar2 + 0x32) + -1,0x415,0x65); + return; +} + + +/* ===== 1008:172f FUN_1008_172f ===== */ + +int FUN_1008_172f(int param_1,int param_2) + +{ + undefined2 local_4; + + if (param_2 < param_1) { + local_4 = param_2; + } + else { + local_4 = param_1; + } + return local_4; +} + + +/* ===== 1008:1754 FUN_1008_1754 ===== */ + +int FUN_1008_1754(int param_1,int param_2) + +{ + undefined2 local_4; + + if (param_1 < param_2) { + local_4 = param_2; + } + else { + local_4 = param_1; + } + return local_4; +} + + +/* ===== 1008:1779 FUN_1008_1779 ===== */ + +void __cdecl16near FUN_1008_1779(void) + +{ + undefined2 uVar1; + undefined2 unaff_CS; + undefined4 uVar2; + + uVar1 = DAT_1028_0586; + if (DAT_1028_058f == '\0') { + DAT_1028_4ad4 = GETDC(); + } + else { + DAT_1028_4ad4 = BEGINPAINT(unaff_CS,0x4ad6,0x1028,DAT_1028_0586); + } + uVar1 = GETSTOCKOBJECT(0x1228,0x10,DAT_1028_4ad4,uVar1); + DAT_1028_4af6 = SELECTOBJECT(0x1228,uVar1); + uVar2 = GETSYSCOLOR(0x1228,8,DAT_1028_4ad4); + SETTEXTCOLOR(0x1228,uVar2); + uVar2 = GETSYSCOLOR(0x1228,5,DAT_1028_4ad4); + SETBKCOLOR(0x1228,uVar2); + return; +} + + +/* ===== 1008:17e2 FUN_1008_17e2 ===== */ + +void __cdecl16near FUN_1008_17e2(void) + +{ + undefined2 unaff_CS; + + SELECTOBJECT(unaff_CS,DAT_1028_4af6); + if (DAT_1028_058f == '\0') { + RELEASEDC(0x1228,DAT_1028_4ad4); + } + else { + ENDPAINT(0x1228,0x4ad6,0x1028); + } + return; +} + + +/* ===== 1008:1818 FUN_1008_1818 ===== */ + +void __cdecl16near FUN_1008_1818(void) + +{ + undefined2 unaff_CS; + int iVar1; + undefined2 uVar2; + + uVar2 = DAT_1028_0586; + CREATECARET(unaff_CS,2,DAT_1028_4ace,0); + iVar1 = (DAT_1028_0544 - DAT_1028_0548) * DAT_1028_4ace; + SETCARETPOS(0x1228,(DAT_1028_0546 - DAT_1028_054a) * DAT_1028_4ad0 + DAT_1028_4ad2); + SHOWCARET(0x1228,DAT_1028_0586,iVar1,uVar2); + return; +} + + +/* ===== 1008:185b FUN_1008_185b ===== */ + +void __cdecl16near FUN_1008_185b(void) + +{ + DESTROYCARET(); + return; +} + + +/* ===== 1008:1865 FUN_1008_1865 ===== */ + +void __cdecl16near FUN_1008_1865(void) + +{ + undefined2 uVar1; + undefined2 unaff_CS; + undefined2 uVar2; + undefined2 uVar3; + + uVar3 = 0; + uVar2 = 0; + uVar1 = FUN_1008_1754(DAT_1028_4aca,1); + SETSCROLLRANGE(unaff_CS,0,uVar1,uVar2,uVar3); + SETSCROLLPOS(0x1228,1,DAT_1028_0548,0); + uVar3 = 1; + uVar2 = 0; + uVar1 = FUN_1008_1754(DAT_1028_4acc,1); + SETSCROLLRANGE(0x1228,0,uVar1,uVar2,uVar3); + SETSCROLLPOS(0x1228,1,DAT_1028_054a,1); + return; +} + + +/* ===== 1008:18d0 FUN_1008_18d0 ===== */ + +void __cdecl16near FUN_1008_18d0(void) + +{ + if ((DAT_1028_058d != '\0') && (DAT_1028_058e != '\0')) { + FUN_1008_185b(); + } + FUN_1020_0061(); + return; +} + + +/* ===== 1008:18ee FUN_1008_18ee ===== */ + +void __stdcall16far FUN_1008_18ee(undefined2 param_1,undefined2 param_2) + +{ + undefined2 uVar1; + int iVar2; + int iVar3; + undefined2 unaff_CS; + undefined2 uVar4; + undefined2 uVar5; + + if (DAT_1028_058c != '\0') { + uVar5 = 0; + uVar1 = FUN_1008_172f(DAT_1028_4aca,param_2); + iVar2 = FUN_1008_1754(uVar1,uVar5); + uVar1 = 0; + uVar5 = FUN_1008_172f(DAT_1028_4acc,param_1); + iVar3 = FUN_1008_1754(uVar5,uVar1); + if ((iVar2 != DAT_1028_0548) || (iVar3 != DAT_1028_054a)) { + uVar5 = unaff_CS; + if (iVar2 != DAT_1028_0548) { + uVar5 = 0x1228; + uVar1 = DAT_1028_0586; + SETSCROLLPOS(unaff_CS,1,iVar2,0); + } + uVar4 = uVar5; + if (iVar3 != DAT_1028_054a) { + uVar4 = 0x1228; + SETSCROLLPOS(uVar5,1,iVar3,1); + } + uVar5 = DAT_1028_0586; + SCROLLWINDOW(uVar4,0,0,0,0,(DAT_1028_054a - iVar3) * DAT_1028_4ad0, + (DAT_1028_0548 - iVar2) * DAT_1028_4ace); + DAT_1028_0548 = iVar2; + DAT_1028_054a = iVar3; + UPDATEWINDOW(0x1228,DAT_1028_0586,uVar5,uVar1); + } + } + return; +} + + +/* ===== 1008:19b7 FUN_1008_19b7 ===== */ + +void __cdecl16far FUN_1008_19b7(void) + +{ + int iVar1; + undefined2 uVar2; + undefined2 uVar3; + + iVar1 = (DAT_1028_0544 - DAT_1028_4ac6) + 1; + uVar2 = FUN_1008_172f(DAT_1028_0544,DAT_1028_0548); + uVar2 = FUN_1008_1754(uVar2,iVar1); + iVar1 = (DAT_1028_0546 - DAT_1028_4ac8) + 1; + uVar3 = FUN_1008_172f(DAT_1028_0546,DAT_1028_054a); + uVar3 = FUN_1008_1754(uVar3,iVar1); + FUN_1008_18ee(uVar3,uVar2); + return; +} + + +/* ===== 1008:19f8 FUN_1008_19f8 ===== */ + +/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */ + +undefined4 FUN_1008_19f8(int param_1,int param_2) + +{ + param_1 = param_1 + DAT_1028_0588; + if (DAT_1028_0542 <= param_1) { + param_1 = param_1 - DAT_1028_0542; + } + return CONCAT22((int)((ulong)_DAT_1028_4ac2 >> 0x10), + (int)_DAT_1028_4ac2 + param_1 * DAT_1028_0540 + param_2); +} + + +/* ===== 1008:1a39 FUN_1008_1a39 ===== */ + +void FUN_1008_1a39(int param_1,int param_2) + +{ + undefined2 unaff_CS; + undefined4 uVar1; + int iVar2; + int iVar3; + undefined2 uVar4; + + if (param_2 < param_1) { + FUN_1008_1779(); + iVar3 = (param_2 - DAT_1028_0548) * DAT_1028_4ace; + iVar2 = (DAT_1028_0546 - DAT_1028_054a) * DAT_1028_4ad0; + uVar4 = DAT_1028_4ad4; + uVar1 = FUN_1008_19f8(DAT_1028_0546,param_2); + TEXTOUT(unaff_CS,param_1 - param_2,uVar1,iVar2,iVar3); + FUN_1008_17e2(uVar4); + } + return; +} + + +/* ===== 1008:1a82 FUN_1008_1a82 ===== */ + +void FUN_1008_1a82(int param_1) + +{ + int iVar1; + undefined2 unaff_SS; + undefined4 uVar2; + undefined2 uVar3; + + FUN_1008_1a39(*(undefined2 *)(param_1 + -6),*(undefined2 *)(param_1 + -4)); + *(undefined2 *)(param_1 + -4) = 0; + *(undefined2 *)(param_1 + -6) = 0; + DAT_1028_0544 = 0; + iVar1 = DAT_1028_0546 + 1; + if (DAT_1028_0546 + 1 == DAT_1028_0542) { + DAT_1028_0588 = DAT_1028_0588 + 1; + if (DAT_1028_0588 == DAT_1028_0542) { + DAT_1028_0588 = 0; + } + uVar2 = FUN_1008_19f8(DAT_1028_0546,0); + FUN_1020_16c9(0x20,DAT_1028_0540,uVar2); + uVar3 = DAT_1028_0586; + SCROLLWINDOW(0x1020,0,0,0,0,-DAT_1028_4ad0,0); + UPDATEWINDOW(0x1228,DAT_1028_0586,uVar3); + iVar1 = DAT_1028_0546; + } + DAT_1028_0546 = iVar1; + return; +} + + +/* ===== 1008:1b11 FUN_1008_1b11 ===== */ + +void __stdcall16far FUN_1008_1b11(int param_1,byte *param_2) + +{ + int unaff_BP; + undefined2 uVar1; + byte *pbVar2; + undefined1 *puVar3; + byte bVar4; + int iVar5; + int iVar6; + undefined2 uVar7; + int iStack_2; + + iStack_2 = unaff_BP + 1; + uVar7 = 0x1028; + uVar1 = 0x1008; + FUN_1008_2442(); + iVar5 = DAT_1028_0544; + iVar6 = DAT_1028_0544; + for (; param_1 != 0; param_1 = param_1 + -1) { + bVar4 = *param_2; + if (bVar4 < 0x20) { + if (bVar4 == 0xd) { + FUN_1008_1a82(&iStack_2); + } + else if (bVar4 == 8) { + if (0 < DAT_1028_0544) { + DAT_1028_0544 = DAT_1028_0544 + -1; + puVar3 = (undefined1 *)FUN_1008_19f8(DAT_1028_0546,DAT_1028_0544); + *puVar3 = 0x20; + if (DAT_1028_0544 < iVar6) { + iVar6 = DAT_1028_0544; + } + } + } + else if (bVar4 == 7) { + MESSAGEBEEP(uVar1,0,iVar5,iVar6,uVar7); + uVar1 = 0x1228; + } + } + else { + bVar4 = *param_2; + pbVar2 = (byte *)FUN_1008_19f8(DAT_1028_0546,DAT_1028_0544); + *pbVar2 = bVar4; + DAT_1028_0544 = DAT_1028_0544 + 1; + if (iVar5 < DAT_1028_0544) { + iVar5 = DAT_1028_0544; + } + if (DAT_1028_0544 == DAT_1028_0540) { + FUN_1008_1a82(&iStack_2); + } + } + param_2 = (byte *)CONCAT22(param_2._2_2_,(byte *)param_2 + 1); + } + FUN_1008_1a39(iVar5,iVar6); + if (DAT_1028_055e != '\0') { + FUN_1008_19b7(); + } + return; +} + + +/* ===== 1008:1be9 FUN_1008_1be9 ===== */ + +void __stdcall16far FUN_1008_1be9(void) + +{ + undefined2 unaff_SS; + + FUN_1008_1b11(1,&stack0x0004,unaff_SS); + return; +} + + +/* ===== 1008:1c03 FUN_1008_1c03 ===== */ + +bool __cdecl16far FUN_1008_1c03(void) + +{ + int iVar1; + int unaff_BP; + undefined2 uVar2; + undefined2 unaff_SS; + undefined1 local_18 [2]; + int local_16; + undefined2 uStack_4; + int iStack_2; + + iStack_2 = unaff_BP + 1; + uStack_4 = 0x1028; + uVar2 = 0x1008; + FUN_1008_2442(); + while (iVar1 = PEEKMESSAGE(uVar2,1,0,0,0,local_18,unaff_SS), iVar1 != 0) { + if (local_16 == 0x12) { + FUN_1008_18d0(); + } + TRANSLATEMESSAGE(0x1228,local_18); + uVar2 = 0x1228; + DISPATCHMESSAGE(0x1228,local_18); + } + return 0 < DAT_1028_058a; +} + + +/* ===== 1008:1c5f FUN_1008_1c5f ===== */ + +undefined1 __cdecl16far FUN_1008_1c5f(void) + +{ + char cVar1; + int unaff_BP; + int iVar2; + undefined2 uVar3; + undefined1 uVar4; + undefined2 uVar5; + + iVar2 = unaff_BP + 1; + uVar5 = 0x1028; + FUN_1008_19b7(); + uVar3 = 0x1008; + cVar1 = FUN_1008_1c03(); + if (cVar1 == '\0') { + DAT_1028_058e = 1; + if (DAT_1028_058d != '\0') { + uVar3 = 0x1c84; + FUN_1008_1818(); + } + do { + WAITMESSAGE(uVar3,0x1008,uVar5,iVar2); + cVar1 = FUN_1008_1c03(); + } while (cVar1 == '\0'); + if (DAT_1028_058d != '\0') { + FUN_1008_185b(); + } + DAT_1028_058e = 0; + } + DAT_1028_058a = DAT_1028_058a + -1; + uVar4 = DAT_1028_4af8; + FUN_1020_16a5(DAT_1028_058a,(undefined1 *)&DAT_1028_4af8,0x1028,0x4af9,0x1028); + return uVar4; +} + + +/* ===== 1008:1cc6 FUN_1008_1cc6 ===== */ + +int __stdcall16far FUN_1008_1cc6(int param_1,undefined4 param_2) + +{ + uint uVar1; + byte bVar2; + int iVar3; + undefined2 uVar4; + uint local_a; + + local_a = 0; + do { + bVar2 = FUN_1008_1c5f(); + iVar3 = (int)param_2; + uVar4 = (undefined2)((ulong)param_2 >> 0x10); + if (bVar2 == 8) { + if (local_a != 0) { + local_a = local_a - 1; + FUN_1008_1be9(8); + } + } + else if ((0x1f < bVar2) && (local_a < param_1 - 2U)) { + *(byte *)(iVar3 + local_a) = bVar2; + FUN_1008_1be9(CONCAT11((char)(local_a >> 8),bVar2)); + local_a = local_a + 1; + } + } while ((bVar2 != 0xd) && ((DAT_1028_055f == '\0' || (bVar2 != 0x1a)))); + *(byte *)(iVar3 + local_a) = bVar2; + uVar1 = local_a + 1; + if (bVar2 == 0xd) { + *(undefined1 *)(iVar3 + uVar1) = 10; + FUN_1008_1be9(CONCAT11((char)(uVar1 >> 8),0xd)); + uVar1 = local_a + 2; + } + local_a = uVar1; + FUN_1008_19b7(); + return local_a; +} + + +/* ===== 1008:1d77 FUN_1008_1d77 ===== */ + +/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */ + +void __cdecl16near FUN_1008_1d77(void) + +{ + DAT_1028_058c = 1; + _DAT_1028_4ac2 = FUN_1020_012d(DAT_1028_0540 * DAT_1028_0542); + FUN_1020_16c9(CONCAT11((char)((uint)(DAT_1028_0540 * DAT_1028_0542) >> 8),0x20), + DAT_1028_0540 * DAT_1028_0542,_DAT_1028_4ac2); + if (DAT_1028_0560 == '\0') { + GETSYSTEMMENU(0x1020,0); + ENABLEMENUITEM(0x1228,3,0xf060); + } + return; +} + + +/* ===== 1008:1dcc FUN_1008_1dcc ===== */ + +void __cdecl16near FUN_1008_1dcc(void) + +{ + int iVar1; + int iVar2; + int iVar3; + undefined2 unaff_CS; + undefined4 uVar4; + int iVar5; + int iVar6; + int local_8; + + DAT_1028_058f = 1; + FUN_1008_1779(); + iVar1 = FUN_1008_1754(DAT_1028_4ada / DAT_1028_4ace + DAT_1028_0548,0); + iVar2 = FUN_1008_172f((DAT_1028_4ade + DAT_1028_4ace + -1) / DAT_1028_4ace + DAT_1028_0548, + DAT_1028_0540); + local_8 = FUN_1008_1754(DAT_1028_4adc / DAT_1028_4ad0 + DAT_1028_054a,0); + iVar3 = FUN_1008_172f((DAT_1028_4ae0 + DAT_1028_4ad0 + -1) / DAT_1028_4ad0 + DAT_1028_054a, + DAT_1028_0542); + for (; local_8 < iVar3; local_8 = local_8 + 1) { + iVar6 = (iVar1 - DAT_1028_0548) * DAT_1028_4ace; + iVar5 = (local_8 - DAT_1028_054a) * DAT_1028_4ad0; + uVar4 = FUN_1008_19f8(local_8,iVar1); + TEXTOUT(unaff_CS,iVar2 - iVar1,uVar4,iVar5,iVar6); + unaff_CS = 0x1228; + } + FUN_1008_17e2(); + DAT_1028_058f = 0; + return; +} + + +/* ===== 1008:1e8a FUN_1008_1e8a ===== */ + +int FUN_1008_1e8a(int param_1,int param_2,int param_3,int param_4) + +{ + int iVar1; + undefined2 unaff_SS; + undefined2 local_4; + + iVar1 = *(int *)(param_1 + 6); + if (iVar1 == 0) { + local_4 = param_4 + -1; + } + else if (iVar1 == 1) { + local_4 = param_4 + 1; + } + else if (iVar1 == 2) { + local_4 = param_4 - param_3; + } + else if (iVar1 == 3) { + local_4 = param_4 + param_3; + } + else if (iVar1 == 6) { + local_4 = 0; + } + else if (iVar1 == 7) { + local_4 = param_2; + } + else if (iVar1 == 4) { + local_4 = *(int *)(param_1 + 4); + } + else { + local_4 = param_4; + } + return local_4; +} + + +/* ===== 1008:1f0c FUN_1008_1f0c ===== */ + +void FUN_1008_1f0c(undefined2 param_1,undefined2 param_2,int param_3) + +{ + undefined2 local_6; + undefined2 local_4; + + local_4 = DAT_1028_0548; + local_6 = DAT_1028_054a; + if (param_3 == 0) { + local_4 = FUN_1008_1e8a(&stack0xfffe,DAT_1028_4aca,DAT_1028_4ac6 / 2,DAT_1028_0548); + } + else if (param_3 == 1) { + local_6 = FUN_1008_1e8a(&stack0xfffe,DAT_1028_4acc,DAT_1028_4ac8,DAT_1028_054a); + } + FUN_1008_18ee(local_6,local_4); + return; +} + + +/* ===== 1008:1f68 FUN_1008_1f68 ===== */ + +void FUN_1008_1f68(int param_1,int param_2) + +{ + if ((DAT_1028_058d != '\0') && (DAT_1028_058e != '\0')) { + FUN_1008_185b(); + } + DAT_1028_4ac6 = param_2 / DAT_1028_4ace; + DAT_1028_4ac8 = param_1 / DAT_1028_4ad0; + DAT_1028_4aca = FUN_1008_1754(DAT_1028_0540 - DAT_1028_4ac6,0); + DAT_1028_4acc = FUN_1008_1754(DAT_1028_0542 - DAT_1028_4ac8,0); + DAT_1028_0548 = FUN_1008_172f(DAT_1028_4aca,DAT_1028_0548); + DAT_1028_054a = FUN_1008_172f(DAT_1028_4acc,DAT_1028_054a); + FUN_1008_1865(); + if ((DAT_1028_058d != '\0') && (DAT_1028_058e != '\0')) { + FUN_1008_1818(); + } + return; +} + + +/* ===== 1008:1fe8 FUN_1008_1fe8 ===== */ + +void FUN_1008_1fe8(undefined4 param_1) + +{ + int iVar1; + undefined2 uVar2; + undefined2 unaff_CS; + undefined2 unaff_SS; + int iVar3; + int iVar4; + undefined2 uVar5; + int iVar6; + int local_26; + undefined2 local_24; + int local_1e; + int local_1a; + int local_6; + int local_4; + + FUN_1008_1779(); + uVar2 = DAT_1028_4ad4; + GETTEXTMETRICS(unaff_CS,&local_26,unaff_SS); + DAT_1028_4ace = local_1a; + DAT_1028_4ad0 = local_26 + local_1e; + DAT_1028_4ad2 = local_24; + iVar1 = GETSYSTEMMETRICS(0x1228,0x20,uVar2); + iVar1 = GETSYSTEMMETRICS(0x1228,2,iVar1 << 1); + iVar6 = 0; + uVar5 = 0x1228; + uVar2 = GETSYSTEMMETRICS(0x1228,0,DAT_1028_0540 * DAT_1028_4ace + iVar1); + local_4 = FUN_1008_172f(uVar2,uVar5); + local_4 = local_4 + iVar6; + iVar1 = GETSYSTEMMETRICS(0x1228,0x21); + uVar2 = GETSYSTEMMETRICS(0x1228,4,iVar1 << 1); + iVar4 = 0x1228; + iVar1 = GETSYSTEMMETRICS(0x1228,3,uVar2); + iVar6 = 1; + uVar5 = 0x1228; + uVar2 = GETSYSTEMMETRICS(0x1228,1,DAT_1028_0542 * DAT_1028_4ad0 + iVar1 + iVar4); + local_6 = FUN_1008_172f(uVar2,uVar5); + local_6 = local_6 + iVar6; + uVar5 = (undefined2)((ulong)param_1 >> 0x10); + iVar6 = (int)param_1; + *(int *)(iVar6 + 4) = local_4; + *(int *)(iVar6 + 6) = local_6; + iVar1 = GETSYSTEMMETRICS(0x1228,0x20); + iVar4 = 0x1228; + iVar1 = GETSYSTEMMETRICS(0x1228,2,iVar1 << 1); + *(int *)(iVar6 + 0xc) = DAT_1028_4ace * 0x10 + iVar1 + iVar4; + uVar2 = GETSYSTEMMETRICS(0x1228,4); + iVar1 = GETSYSTEMMETRICS(0x1228,0x21,uVar2); + iVar3 = 3; + iVar4 = 0x1228; + iVar1 = GETSYSTEMMETRICS(0x1228,3,iVar1 << 1); + *(int *)(iVar6 + 0xe) = DAT_1028_4ad0 * 4 + iVar1 + iVar4 + iVar3; + *(int *)(iVar6 + 0x10) = local_4; + *(int *)(iVar6 + 0x12) = local_6; + FUN_1008_17e2(); + return; +} + + +/* ===== 1008:211a FUN_1008_211a ===== */ + +void FUN_1008_211a(char param_1) + +{ + if ((DAT_1028_0560 != '\0') && (param_1 == '\x03')) { + FUN_1008_18d0(); + } + if (DAT_1028_058a < 0x40) { + ((undefined1 *)&DAT_1028_4af8)[DAT_1028_058a] = param_1; + DAT_1028_058a = DAT_1028_058a + 1; + } + return; +} + + +/* ===== 1008:2147 FUN_1008_2147 ===== */ + +void FUN_1008_2147(char param_1) + +{ + int iVar1; + int iVar2; + int local_6; + + if ((DAT_1028_0560 != '\0') && (param_1 == '\x03')) { + FUN_1008_18d0(); + } + iVar1 = GETKEYSTATE(); + local_6 = 1; + while ((iVar2 = local_6 * 4, *(char *)(iVar2 + 0x58c) != param_1 || + ((bool)*(char *)(iVar2 + 0x58d) != iVar1 < 0))) { + if (local_6 == 0xc) { + return; + } + local_6 = local_6 + 1; + } + FUN_1008_1f0c(0,*(undefined1 *)(iVar2 + 0x58f),*(undefined1 *)(iVar2 + 0x58e)); + return; +} + + +/* ===== 1008:21ba FUN_1008_21ba ===== */ + +void __cdecl16near FUN_1008_21ba(void) + +{ + DAT_1028_058d = 1; + if (DAT_1028_058e != '\0') { + FUN_1008_1818(); + } + return; +} + + +/* ===== 1008:21ce FUN_1008_21ce ===== */ + +void __cdecl16near FUN_1008_21ce(void) + +{ + if (DAT_1028_058e != '\0') { + FUN_1008_185b(); + } + DAT_1028_058d = 0; + return; +} + + +/* ===== 1008:21e2 FUN_1008_21e2 ===== */ + +/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */ + +void __cdecl16near FUN_1008_21e2(void) + +{ + FUN_1020_0147(DAT_1028_0540 * DAT_1028_0542,DAT_1028_4ac2,_DAT_1028_4ac4); + DAT_1028_0544 = 0; + DAT_1028_0546 = 0; + DAT_1028_0548 = 0; + DAT_1028_054a = 0; + POSTQUITMESSAGE(0x1020,0); + DAT_1028_058c = 0; + return; +} + + +/* ===== 1008:2219 FUN_1008_2219 ===== */ + +undefined4 __stdcall16far +FUN_1008_2219(undefined2 param_1,undefined2 param_2,undefined2 param_3,int param_4, + undefined2 param_5) + +{ + undefined2 unaff_CS; + undefined2 unaff_SS; + undefined4 uVar1; + + uVar1 = 0; + *(undefined2 *)&DAT_1028_0586 = param_5; + if (param_4 == 1) { + FUN_1008_1d77(); + uVar1 = 0; + } + else if (param_4 == 0xf) { + FUN_1008_1dcc(); + uVar1 = 0; + } + else if (param_4 == 0x115) { + FUN_1008_1f0c(param_1,param_3,1); + uVar1 = 0; + } + else if (param_4 == 0x114) { + FUN_1008_1f0c(param_1,param_3,0); + uVar1 = 0; + } + else if (param_4 == 5) { + FUN_1008_1f68(param_2,param_1); + uVar1 = 0; + } + else if (param_4 == 0x24) { + FUN_1008_1fe8(param_1,param_2); + uVar1 = 0; + } + else if (param_4 == 0x102) { + FUN_1008_211a(CONCAT11(1,(undefined1)param_3)); + uVar1 = 0; + } + else if (param_4 == 0x100) { + FUN_1008_2147(CONCAT11(1,(undefined1)param_3)); + uVar1 = 0; + } + else if (param_4 == 7) { + FUN_1008_21ba(); + uVar1 = 0; + } + else if (param_4 == 8) { + FUN_1008_21ce(); + uVar1 = 0; + } + else if (param_4 == 2) { + FUN_1008_21e2(); + } + else { + uVar1 = DEFWINDOWPROC(unaff_CS,param_1,param_2,param_3,param_4); + } + return uVar1; +} + + +/* ===== 1008:22fc FUN_1008_22fc ===== */ + +undefined2 __stdcall16far FUN_1008_22fc(undefined4 param_1) + +{ + int iVar1; + undefined2 uVar2; + + uVar2 = (undefined2)((ulong)param_1 >> 0x10); + iVar1 = (int)param_1; + if (*(int *)(iVar1 + 8) != 0) { + FUN_1008_1b11(*(undefined2 *)(iVar1 + 8),*(undefined2 *)(iVar1 + 0xc), + *(undefined2 *)(iVar1 + 0xe)); + *(undefined2 *)(iVar1 + 8) = 0; + FUN_1008_1c03(); + } + return 0; +} + + +/* ===== 1008:233c FUN_1008_233c ===== */ + +undefined2 __stdcall16far FUN_1008_233c(undefined4 param_1) + +{ + undefined2 uVar1; + int iVar2; + undefined2 uVar3; + + uVar3 = (undefined2)((ulong)param_1 >> 0x10); + iVar2 = (int)param_1; + uVar1 = FUN_1008_1cc6(*(undefined2 *)(iVar2 + 4),*(undefined2 *)(iVar2 + 0xc), + *(undefined2 *)(iVar2 + 0xe)); + *(undefined2 *)(iVar2 + 10) = uVar1; + *(undefined2 *)(iVar2 + 8) = 0; + return 0; +} + + +/* ===== 1008:2374 FUN_1008_2374 ===== */ + +undefined2 __stdcall16far FUN_1008_2374(void) + +{ + return 0; +} + + +/* ===== 1008:238b FUN_1008_238b ===== */ + +undefined2 __stdcall16far FUN_1008_238b(undefined4 param_1) + +{ + int iVar1; + undefined2 uVar2; + + uVar2 = (undefined2)((ulong)param_1 >> 0x10); + iVar1 = (int)param_1; + if (*(int *)(iVar1 + 2) == -0x284f) { + *(undefined2 *)(iVar1 + 0x14) = 0x233c; + *(undefined2 *)(iVar1 + 0x16) = 0x1008; + *(undefined2 *)(iVar1 + 0x18) = 0; + *(undefined2 *)(iVar1 + 0x1a) = 0; + } + else { + *(undefined2 *)(iVar1 + 2) = 0xd7b2; + *(undefined2 *)(iVar1 + 0x14) = 0x22fc; + *(undefined2 *)(iVar1 + 0x16) = 0x1008; + *(undefined2 *)(iVar1 + 0x18) = 0x22fc; + *(undefined2 *)(iVar1 + 0x1a) = 0x1008; + } + *(undefined2 *)(iVar1 + 0x1c) = 0x2374; + *(undefined2 *)(iVar1 + 0x1e) = 0x1008; + return 0; +} + + +/* ===== 1008:23fd FUN_1008_23fd ===== */ + +void __stdcall16far FUN_1008_23fd(undefined2 *param_1) + +{ + undefined2 *puVar1; + undefined2 uVar2; + + uVar2 = (undefined2)((ulong)param_1 >> 0x10); + puVar1 = (undefined2 *)param_1; + *param_1 = 0xffff; + puVar1[1] = 0xd7b0; + puVar1[2] = 0x80; + puVar1[6] = puVar1 + 0x40; + puVar1[7] = uVar2; + puVar1[8] = 0x238b; + puVar1[9] = 0x1008; + *(undefined1 *)(puVar1 + 0x18) = 0; + return; +} + + +/* ===== 1008:2442 FUN_1008_2442 ===== */ + +void __cdecl16far FUN_1008_2442(void) + +{ + int unaff_BP; + int iVar1; + undefined2 unaff_CS; + undefined2 uVar2; + + iVar1 = unaff_BP + 1; + if (DAT_1028_058c == '\0') { + DAT_1028_0586 = + CREATEWINDOW(unaff_CS,0,0,DAT_1028_06fe,0,0,DAT_1028_053e,DAT_1028_053c,DAT_1028_053a, + DAT_1028_0538,0,0xff,0x4a6e,0x1028,DAT_1028_0578,DAT_1028_057a,0x1028); + uVar2 = DAT_1028_0586; + SHOWWINDOW(0x1228,DAT_1028_0700); + UPDATEWINDOW(0x1228,DAT_1028_0586,uVar2,iVar1); + } + return; +} + + +/* ===== 1008:24a5 FUN_1008_24a5 ===== */ + +void __cdecl16far FUN_1008_24a5(void) + +{ + undefined2 uVar1; + int iVar2; + int unaff_BP; + undefined2 unaff_CS; + undefined2 unaff_SS; + undefined1 local_9a [128]; + undefined1 local_1a [18]; + undefined2 local_8; + undefined2 local_6; + undefined2 uStack_4; + int iStack_2; + + iStack_2 = unaff_BP + 1; + uStack_4 = 0x1028; + DAT_1028_0712 = DAT_1028_4abe; + DAT_1028_0714 = DAT_1028_4ac0; + if ((DAT_1028_058c != '\0') && (DAT_1028_0718 == 0 && DAT_1028_071a == 0)) { + local_8 = 0x4a6e; + local_6 = 0x1028; + WVSPRINTF(unaff_CS,&local_8,unaff_SS,DAT_1028_054c,DAT_1028_054e,local_9a); + SETWINDOWTEXT(0x1228,local_9a); + uVar1 = GETSYSTEMMENU(0x1228,0); + ENABLEMENUITEM(0x1228,0,0xf060); + DAT_1028_0560 = 0; + while (iVar2 = GETMESSAGE(0x1228,0,0,0,local_1a,unaff_SS,uVar1), iVar2 != 0) { + uVar1 = unaff_SS; + TRANSLATEMESSAGE(0x1228,local_1a); + DISPATCHMESSAGE(0x1228,local_1a); + } + } + return; +} + + +/* ===== 1008:2554 FUN_1008_2554 ===== */ + +void __cdecl16far FUN_1008_2554(void) + +{ + undefined2 unaff_CS; + undefined2 uVar1; + + if (DAT_1028_06fc == 0) { + DAT_1028_056c = DAT_1028_06fe; + DAT_1028_056e = LOADICON(unaff_CS,0x7f00,0); + DAT_1028_0570 = LOADCURSOR(0x1228,0x7f00,0); + DAT_1028_0572 = 6; + REGISTERCLASS(0x1228,0x562); + } + FUN_1008_23fd(0x4b38,0x1028); + uVar1 = 0x1028; + FUN_1020_0527(0x1008,0x4b38); + FUN_1020_038f(uVar1); + FUN_1008_23fd(0x4c38,0x1028); + uVar1 = 0x1028; + FUN_1020_052c(0x1008,0x4c38); + FUN_1020_038f(uVar1); + uVar1 = DAT_1028_06fe; + GETMODULEFILENAME(0x1020,0x50,0x4a6e,0x1028); + Ordinal_6(0x1228,0x4a6e,0x1028,0x4a6e,0x1028,uVar1); + DAT_1028_4abe = DAT_1028_0712; + DAT_1028_4ac0 = DAT_1028_0714; + DAT_1028_0712 = 0x24a5; + DAT_1028_0714 = 0x1008; + return; +} + + +/* ===== 1008:2608 FUN_1008_2608 ===== */ + +void __cdecl16near FUN_1008_2608(void) + +{ + char *pcVar1; + char *pcVar2; + code *pcVar3; + int iVar4; + char *unaff_DI; + char *pcVar5; + undefined2 unaff_ES; + undefined2 unaff_SS; + char local_52 [80]; + + pcVar5 = local_52; + iVar4 = 0x4f; + do { + pcVar1 = unaff_DI; + unaff_DI = unaff_DI + 1; + if (*pcVar1 == '\0') break; + pcVar2 = pcVar5; + pcVar5 = pcVar5 + 1; + *pcVar2 = *pcVar1; + iVar4 = iVar4 + -1; + } while (iVar4 != 0); + *pcVar5 = '\0'; + Ordinal_5(); + pcVar3 = (code *)swi(0x21); + (*pcVar3)(); + return; +} + + +/* ===== 1008:2643 FUN_1008_2643 ===== */ + +char * __stdcall16far FUN_1008_2643(char *param_1,char *param_2,char *param_3) + +{ + char *pcVar1; + char *pcVar2; + char cVar3; + char cVar4; + uint uVar5; + char *pcVar6; + char *pcVar7; + char *pcVar8; + undefined2 uVar9; + undefined2 uVar10; + bool bVar11; + undefined2 uVar12; + + uVar12 = 0x1028; + uVar10 = (undefined2)((ulong)param_1 >> 0x10); + pcVar6 = (char *)param_1; + uVar9 = (undefined2)((ulong)param_3 >> 0x10); + uVar5 = 0x4f; + pcVar8 = (char *)param_3; + do { + if (uVar5 != 0) { + pcVar7 = (char *)param_2; + do { + pcVar1 = pcVar7; + pcVar7 = pcVar7 + 1; + if (*pcVar1 == '\0') break; + pcVar2 = pcVar8; + pcVar8 = pcVar8 + 1; + *pcVar2 = *pcVar1; + uVar5 = uVar5 - 1; + } while (uVar5 != 0); + } + bVar11 = false; + *pcVar8 = '\0'; + FUN_1008_2608(pcVar6,uVar10,uVar12); + if ((!bVar11) && ((uVar5 & 0x18) == 0)) { + return param_3; + } + uVar5 = 0x4f; + cVar3 = *pcVar6; + cVar4 = '\0'; + pcVar8 = (char *)param_3; + if (cVar3 == '\0') { + *param_3 = '\0'; + return param_3; + } + do { + pcVar6 = pcVar6 + 1; + if (cVar3 == ';') break; + if (uVar5 != 0) { + pcVar1 = pcVar8; + pcVar8 = pcVar8 + 1; + *pcVar1 = cVar3; + uVar5 = uVar5 - 1; + cVar4 = cVar3; + } + cVar3 = *pcVar6; + } while (cVar3 != '\0'); + if (((uVar5 != 0) && (cVar4 != ':')) && (cVar4 != '\\')) { + pcVar1 = pcVar8; + pcVar8 = pcVar8 + 1; + *pcVar1 = '\\'; + uVar5 = uVar5 - 1; + } + } while( true ); +} + + +/* ===== 1008:26b0 FUN_1008_26b0 ===== */ + +uint __stdcall16far +FUN_1008_26b0(int param_1,int param_2,int param_3,int param_4,int param_5,int param_6,int param_7, + undefined2 param_8) + +{ + long lVar1; + undefined4 local_14; + int local_10; + undefined2 local_e; + uint local_c; + uint local_a; + uint local_8; + + lVar1 = FUN_1008_2fe3(0x5c,param_7,param_8); + if (lVar1 == 0) { + lVar1 = FUN_1008_2fe3(0x3a,param_7,param_8); + } + local_e = (undefined2)((ulong)lVar1 >> 0x10); + local_10 = (int)lVar1; + if (lVar1 == 0) { + local_10 = param_7; + local_e = param_8; + } + else { + local_10 = local_10 + 1; + } + local_14 = (char *)FUN_1008_2fbb(0x2e,local_10,local_e); + if (local_14 == (char *)0x0) { + local_14 = (char *)FUN_1008_2ea9(local_10,local_e); + } + local_8 = local_10 - param_7; + if (0x43 < local_8) { + local_8 = 0x43; + } + local_a = (int)(char *)local_14 - local_10; + if (8 < local_a) { + local_a = 8; + } + local_c = 0; + lVar1 = FUN_1008_2fbb(0x3f,local_10,local_e); + if (lVar1 == 0) { + lVar1 = FUN_1008_2fbb(0x2a,local_10,local_e); + if (lVar1 == 0) goto LAB_1008_2784; + } + local_c = 8; +LAB_1008_2784: + if (local_8 != 0) { + local_c = local_c | 4; + } + if (local_a != 0) { + local_c = local_c | 2; + } + if (*local_14 != '\0') { + local_c = local_c | 1; + } + if (param_5 != 0 || param_6 != 0) { + FUN_1008_2f07(local_8,param_7,param_8,param_5,param_6); + } + if (param_3 != 0 || param_4 != 0) { + FUN_1008_2f07(local_a,local_10,local_e,param_3,param_4); + } + if (param_1 != 0 || param_2 != 0) { + FUN_1008_2f07(4,(char *)local_14,local_14._2_2_,param_1,param_2); + } + return local_c; +} + + +/* ===== 1008:2819 FUN_1008_2819 ===== */ + +char * __stdcall16far FUN_1008_2819(undefined2 param_1,undefined2 param_2) + +{ + int iVar1; + int iVar2; + undefined4 local_e; + char *local_8; + undefined2 local_6; + + iVar1 = FUN_1008_2e92(param_1,param_2); + local_e = (char *)GETDOSENVIRONMENT(0x1008); + do { + if (*local_e == '\0') { + local_8 = (char *)0x0; + local_6 = 0; +LAB_1008_2896: + return (char *)CONCAT22(local_6,local_8); + } + iVar2 = FUN_1008_2f70(iVar1,param_1,param_2,(char *)local_e,local_e._2_2_); + if ((iVar2 == 0) && (((char *)local_e)[iVar1] == '=')) { + local_8 = (char *)local_e + iVar1 + 1; + local_6 = local_e._2_2_; + goto LAB_1008_2896; + } + iVar2 = FUN_1008_2e92((char *)local_e,local_e._2_2_); + local_e = (char *)CONCAT22(local_e._2_2_,(char *)local_e + iVar2 + 1); + } while( true ); +} + + +/* ===== 1008:28a3 FUN_1008_28a3 ===== */ + +undefined4 __stdcall16far +FUN_1008_28a3(undefined4 param_1,undefined2 param_2,undefined1 param_3,undefined2 param_4, + undefined2 param_5,undefined2 param_6) + +{ + undefined2 uVar1; + int iVar2; + undefined2 uVar3; + bool bVar4; + + FUN_1020_03cb(); + bVar4 = true; + FUN_1020_03ef(); + if (!bVar4) { + uVar3 = (undefined2)((ulong)param_1 >> 0x10); + iVar2 = (int)param_1; + FUN_1008_2d99(iVar2,uVar3,0); + *(undefined2 *)(iVar2 + 2) = 0; + *(undefined2 *)(iVar2 + 4) = param_6; + uVar1 = FUN_1008_295c(iVar2,uVar3,param_3,param_4,param_5); + *(undefined2 *)(iVar2 + 2) = uVar1; + if (*(int *)(iVar2 + 2) == 0) { + FUN_1020_0439(); + } + } + return param_1; +} + + +/* ===== 1008:2906 FUN_1008_2906 ===== */ + +void __stdcall16far FUN_1008_2906(undefined4 param_1) + +{ + undefined2 uVar1; + + FUN_1020_03cb(); + uVar1 = (undefined2)((ulong)param_1 >> 0x10); + FUN_1008_2932((int)param_1,uVar1); + FUN_1008_2dcd((int)param_1,uVar1,0); + FUN_1020_0439(); + return; +} + + +/* ===== 1008:2932 FUN_1008_2932 ===== */ + +void __stdcall16far FUN_1008_2932(undefined4 param_1) + +{ + int iVar1; + undefined2 uVar2; + + FUN_1020_03cb(); + uVar2 = (undefined2)((ulong)param_1 >> 0x10); + iVar1 = (int)param_1; + if (*(int *)(iVar1 + 2) != 0) { + TIMEKILLEVENT(0x1020,*(undefined2 *)(iVar1 + 2)); + } + *(undefined2 *)(iVar1 + 2) = 0; + return; +} + + +/* ===== 1008:295c FUN_1008_295c ===== */ + +undefined2 __stdcall16far +FUN_1008_295c(undefined2 param_1,undefined2 param_2,undefined1 param_3,undefined2 param_4, + undefined2 param_5) + +{ + undefined1 extraout_AH; + undefined2 uVar1; + + FUN_1020_03cb(); + uVar1 = SYSTEMTIMERMAKE(0x1020,CONCAT11(extraout_AH,param_3),param_4,param_5); + return uVar1; +} + + +/* ===== 1008:298a FUN_1008_298a ===== */ + +void __cdecl16far FUN_1008_298a(void) + +{ + FUN_1020_03cb(); + return; +} + + +/* ===== 1008:2996 FUN_1008_2996 ===== */ + +undefined4 __stdcall16far +FUN_1008_2996(undefined4 param_1,undefined2 param_2,undefined2 param_3,int param_4, + undefined2 param_5,undefined2 param_6) + +{ + int unaff_BP; + int iVar1; + undefined2 uVar2; + bool bVar3; + undefined4 uVar4; + + bVar3 = true; + FUN_1020_03ef(0x1028,unaff_BP + 1); + if (!bVar3) { + uVar2 = (undefined2)((ulong)param_1 >> 0x10); + iVar1 = (int)param_1; + FUN_1018_0341(iVar1,uVar2,0,param_5,param_6); + FUN_1018_0627(iVar1,uVar2); + if (param_4 == 0) { + *(undefined2 *)(iVar1 + 0x1d) = param_3; + *(undefined2 *)(iVar1 + 0x1f) = 0; + } + else { + uVar4 = FUN_1008_302c(param_3,param_4); + *(undefined2 *)(iVar1 + 0x1d) = (int)uVar4; + *(undefined2 *)(iVar1 + 0x1f) = (int)((ulong)uVar4 >> 0x10); + } + *(undefined2 *)(iVar1 + 0x21) = 0; + *(undefined2 *)(iVar1 + 0x23) = 0; + *(undefined1 *)(iVar1 + 0x25) = 0; + } + return param_1; +} + + +/* ===== 1008:2a0e FUN_1008_2a0e ===== */ + +void __stdcall16far FUN_1008_2a0e(undefined4 param_1) + +{ + int unaff_BP; + int iVar1; + int iVar2; + undefined2 uVar3; + undefined2 uVar4; + + iVar1 = unaff_BP + 1; + uVar4 = 0x1028; + uVar3 = (undefined2)((ulong)param_1 >> 0x10); + iVar2 = (int)param_1; + if (*(int *)(iVar2 + 0x1f) != 0) { + FUN_1008_3099(*(undefined2 *)(iVar2 + 0x1d),*(undefined2 *)(iVar2 + 0x1f)); + } + FUN_1018_03ff(iVar2,uVar3,0); + FUN_1020_0439(uVar4,iVar1); + return; +} + + +/* ===== 1008:2a45 FUN_1008_2a45 ===== */ + +uint __stdcall16far FUN_1008_2a45(undefined4 param_1) + +{ + uint in_AX; + uint uVar1; + int iVar2; + undefined2 uVar3; + undefined2 local_8; + + uVar3 = (undefined2)((ulong)param_1 >> 0x10); + iVar2 = (int)param_1; + if (*(int *)(iVar2 + 2) == 0) { + FUN_1018_0627(iVar2,uVar3); + FUN_1018_05f3(iVar2,uVar3); + *(undefined1 *)(iVar2 + 0x25) = 0; + if (*(int *)(iVar2 + 6) == 0 && *(int *)(iVar2 + 8) == 0) { + local_8 = 0; + } + else { + local_8 = *(undefined2 *)((int)*(undefined4 *)(iVar2 + 6) + 4); + } + in_AX = (*DAT_1028_0652)(0x1018,*(undefined2 *)(iVar2 + 0x21),*(undefined2 *)(iVar2 + 0x23), + *(undefined2 *)(iVar2 + 0x12),*(undefined2 *)(iVar2 + 0x14),local_8, + *(undefined2 *)(iVar2 + 0x1d),*(undefined2 *)(iVar2 + 0x1f), + DAT_1028_06fe); + *(uint *)(iVar2 + 4) = in_AX; + if (*(int *)(iVar2 + 4) == 0) { + *(undefined2 *)(iVar2 + 2) = 0xffff; + } + } + uVar1 = in_AX & 0xff00; + if (*(int *)(iVar2 + 2) == 0) { + uVar1 = uVar1 + 1; + } + return uVar1; +} + + +/* ===== 1008:2ae3 FUN_1008_2ae3 ===== */ + +int __stdcall16far FUN_1008_2ae3(undefined4 param_1) + +{ + undefined2 uVar1; + int iVar2; + int iVar3; + undefined2 uVar4; + undefined2 uVar5; + undefined2 uVar6; + undefined2 local_8; + undefined2 local_6; + + uVar4 = (undefined2)((ulong)param_1 >> 0x10); + iVar2 = (int)param_1; + if (*(int *)(iVar2 + 2) == 0) { + FUN_1018_0627(iVar2,uVar4); + FUN_1018_05f3(iVar2,uVar4); + *(undefined1 *)(iVar2 + 0x25) = 1; + if (*(int *)(iVar2 + 6) == 0 && *(int *)(iVar2 + 8) == 0) { + local_8 = 0; + } + else { + local_8 = *(undefined2 *)((int)*(undefined4 *)(iVar2 + 6) + 4); + } + uVar5 = (undefined2)((ulong)DAT_1028_064e >> 0x10); + uVar1 = *(undefined2 *)((int)DAT_1028_064e + 0xe); + uVar5 = *(undefined2 *)((int)DAT_1028_064e + 0x10); + local_6 = (*DAT_1028_0656)(0x1018,*(undefined2 *)(iVar2 + 0x21),*(undefined2 *)(iVar2 + 0x23), + *(undefined2 *)(iVar2 + 0x12),*(undefined2 *)(iVar2 + 0x14),local_8, + *(undefined2 *)(iVar2 + 0x1d),*(undefined2 *)(iVar2 + 0x1f), + DAT_1028_06fe); + uVar6 = (undefined2)((ulong)DAT_1028_064e >> 0x10); + iVar3 = (int)DAT_1028_064e; + *(undefined2 *)(iVar3 + 0xe) = uVar1; + *(undefined2 *)(iVar3 + 0x10) = uVar5; + if (local_6 == -1) { + *(undefined2 *)(iVar2 + 2) = 0xffff; + } + *(undefined2 *)(iVar2 + 4) = 0; + } + else { + local_6 = *(int *)(iVar2 + 2); + } + return local_6; +} + + +/* ===== 1008:2bb1 FUN_1008_2bb1 ===== */ + +void __stdcall16far FUN_1008_2bb1(undefined2 param_1,undefined4 param_2) + +{ + undefined2 uVar1; + + uVar1 = (undefined2)((ulong)param_2 >> 0x10); + if (*(int *)((int)param_2 + 4) != 0) { + FUN_1018_060d((int)param_2,uVar1); + } + return; +} + + +/* ===== 1008:2bd1 FUN_1008_2bd1 ===== */ + +void __stdcall16far FUN_1008_2bd1(undefined4 param_1,undefined2 param_2) + +{ + undefined2 uVar1; + + uVar1 = (undefined2)((ulong)param_1 >> 0x10); + if (*(char *)((int)param_1 + 0x25) != '\0') { + FUN_1018_085a((int)param_1,uVar1,0x2bb1,0x1008); + ENDDIALOG(0x1018,param_2); + } + return; +} + + +/* ===== 1008:2c08 FUN_1008_2c08 ===== */ + +void __stdcall16far FUN_1008_2c08(int *param_1) + +{ + (*(code *)*(undefined2 *)(*param_1 + 0x38))(); + return; +} + + +/* ===== 1008:2c1f FUN_1008_2c1f ===== */ + +void __stdcall16far FUN_1008_2c1f(int *param_1,undefined4 param_2) + +{ + char cVar1; + int iVar2; + undefined2 uVar3; + undefined2 uVar4; + + uVar3 = (undefined2)((ulong)DAT_1028_064e >> 0x10); + iVar2 = (int)param_2; + uVar4 = (undefined2)((ulong)param_2 >> 0x10); + if (((int)((ulong)param_1 >> 0x10) == ((int *)DAT_1028_064e)[5]) && + ((int *)param_1 == (int *)((int *)DAT_1028_064e)[4])) { + cVar1 = (*(code *)*(undefined2 *)(*DAT_1028_064e + 0x44))(); + *(int *)(iVar2 + 10) = (int)(cVar1 == '\0'); + *(undefined2 *)(iVar2 + 0xc) = 0; + } + else { + cVar1 = (*(code *)*(undefined2 *)(*param_1 + 0x3c))(); + *(int *)(iVar2 + 10) = (int)(cVar1 == '\0'); + *(undefined2 *)(iVar2 + 0xc) = 0; + } + return; +} + + +/* ===== 1008:2c83 FUN_1008_2c83 ===== */ + +void __stdcall16far FUN_1008_2c83(undefined2 param_1,undefined2 param_2,undefined4 param_3) + +{ + int *piVar1; + int iVar2; + int unaff_BP; + int iVar3; + undefined2 uVar4; + long lVar5; + undefined2 uVar6; + undefined2 uVar7; + + iVar3 = unaff_BP + 1; + uVar7 = 0x1028; + uVar4 = (undefined2)((ulong)param_3 >> 0x10); + uVar6 = *(undefined2 *)((int)param_3 + 4); + SETFOCUS(); + lVar5 = FUN_1018_0097(*(undefined2 *)((int)param_3 + 4)); + uVar4 = (undefined2)((ulong)lVar5 >> 0x10); + iVar2 = (int)lVar5; + if ((lVar5 != 0) && (*(int *)(iVar2 + 0x43) != 0 || *(int *)(iVar2 + 0x45) != 0)) { + piVar1 = (int *)*(undefined4 *)(iVar2 + 0x43); + (*(code *)*(undefined2 *)(*piVar1 + 0xc)) + (0x1018,(int *)piVar1,(int)((ulong)piVar1 >> 0x10),uVar6,lVar5,uVar7,iVar3); + } + DAT_1028_06f2 = 1; + return; +} + + +/* ===== 1008:2cd9 FUN_1008_2cd9 ===== */ + +void __stdcall16far FUN_1008_2cd9(undefined2 param_1,undefined2 param_2,undefined4 param_3) + +{ + undefined2 uVar1; + + uVar1 = (undefined2)((ulong)param_3 >> 0x10); + *(undefined2 *)((int)param_3 + 10) = 0; + *(undefined2 *)((int)param_3 + 0xc) = 0; + return; +} + + +/* ===== 1008:2cf2 FUN_1008_2cf2 ===== */ + +void __stdcall16far FUN_1008_2cf2(int *param_1) + +{ + char cVar1; + undefined2 uVar2; + + uVar2 = (undefined2)((ulong)param_1 >> 0x10); + if (*(char *)((int)(int *)param_1 + 0x25) == '\0') { + FUN_1018_0f38((int *)param_1,uVar2); + } + else { + cVar1 = (*(code *)*(undefined2 *)(*param_1 + 0x3c))(); + if (cVar1 != '\0') { + (*(code *)*(undefined2 *)(*param_1 + 0x44))(); + (*(code *)*(undefined2 *)(*param_1 + 0x50))(); + } + } + return; +} + + +/* ===== 1008:2d3a FUN_1008_2d3a ===== */ + +void __stdcall16far FUN_1008_2d3a(int *param_1) + +{ + undefined2 uVar1; + + uVar1 = (undefined2)((ulong)param_1 >> 0x10); + if (*(char *)((int)(int *)param_1 + 0x25) == '\0') { + FUN_1018_0f38((int *)param_1,uVar1); + } + else { + (*(code *)*(undefined2 *)(*param_1 + 0x50))(); + } + return; +} + + +/* ===== 1008:2d66 FUN_1008_2d66 ===== */ + +void __stdcall16far FUN_1008_2d66(void) + +{ + FUN_1020_16e1(); + return; +} + + +/* ===== 1008:2d87 FUN_1008_2d87 ===== */ + +void __cdecl16far FUN_1008_2d87(void) + +{ + FUN_1020_005d(); + return; +} + + +/* ===== 1008:2d99 FUN_1008_2d99 ===== */ + +undefined4 __stdcall16far FUN_1008_2d99(undefined4 param_1) + +{ + int unaff_BP; + + FUN_1020_03ef(0x1028,unaff_BP + 1); + return param_1; +} + + +/* ===== 1008:2db3 FUN_1008_2db3 ===== */ + +void __stdcall16far FUN_1008_2db3(int *param_1) + +{ + (*(code *)*(undefined2 *)(*param_1 + 8))(); + return; +} + + +/* ===== 1008:2dcd FUN_1008_2dcd ===== */ + +void __stdcall16far FUN_1008_2dcd(void) + +{ + int unaff_BP; + + FUN_1020_0439(0x1028,unaff_BP + 1); + return; +} + + +/* ===== 1008:2de0 FUN_1008_2de0 ===== */ + +uint __cdecl16far FUN_1008_2de0(void) + +{ + uint uVar1; + + uVar1 = (DAT_1028_06f6 | DAT_1028_06f8) & 0xff00; + if ((DAT_1028_06f6 | DAT_1028_06f8) == 0) { + uVar1 = 1; + } + return uVar1; +} + + +/* ===== 1008:2dff FUN_1008_2dff ===== */ + +void __cdecl16far FUN_1008_2dff(void) + +{ + char cVar1; + int unaff_BP; + undefined4 uVar2; + + cVar1 = FUN_1008_2de0(0x1028,unaff_BP + 1); + uVar2 = CONCAT22(DAT_1028_06f8,DAT_1028_06f6); + if (cVar1 != '\0') { + uVar2 = FUN_1020_012d(DAT_1028_06f4); + } + DAT_1028_06f8 = (undefined2)((ulong)uVar2 >> 0x10); + DAT_1028_06f6 = (undefined2)uVar2; + return; +} + + +/* ===== 1008:2e22 FUN_1008_2e22 ===== */ + +undefined2 __stdcall16far FUN_1008_2e22(int param_1) + +{ + char cVar1; + undefined2 local_6; + + if (param_1 != 0) { + if (DAT_1028_06fa == '\0') { + cVar1 = FUN_1008_2de0(); + if (cVar1 == '\0') { + FUN_1020_0147(DAT_1028_06f4,DAT_1028_06f6,DAT_1028_06f8); + DAT_1028_06f6 = 0; + DAT_1028_06f8 = 0; + local_6 = 2; + } + else { + local_6 = 0; + } + } + else { + local_6 = 1; + } + } + return local_6; +} + + +/* ===== 1008:2e76 FUN_1008_2e76 ===== */ + +void __cdecl16far FUN_1008_2e76(void) + +{ + int unaff_BP; + + FUN_1008_2dff(0x1028,unaff_BP + 1); + DAT_1028_070e = 0x2e22; + DAT_1028_0710 = 0x1008; + return; +} + + +/* ===== 1008:2e92 FUN_1008_2e92 ===== */ + +int __stdcall16far FUN_1008_2e92(char *param_1) + +{ + char *pcVar1; + int iVar2; + char *pcVar3; + + pcVar3 = (char *)param_1; + iVar2 = -1; + do { + if (iVar2 == 0) break; + iVar2 = iVar2 + -1; + pcVar1 = pcVar3; + pcVar3 = pcVar3 + 1; + } while (*pcVar1 != '\0'); + return -2 - iVar2; +} + + +/* ===== 1008:2ea9 FUN_1008_2ea9 ===== */ + +char * __stdcall16far FUN_1008_2ea9(char *param_1) + +{ + char *pcVar1; + int iVar2; + char *pcVar3; + undefined2 uVar4; + + uVar4 = (undefined2)((ulong)param_1 >> 0x10); + pcVar3 = (char *)param_1; + iVar2 = -1; + do { + if (iVar2 == 0) break; + iVar2 = iVar2 + -1; + pcVar1 = pcVar3; + pcVar3 = pcVar3 + 1; + } while (*pcVar1 != '\0'); + return (char *)CONCAT22(uVar4,pcVar3 + -1); +} + + +/* ===== 1008:2ec0 FUN_1008_2ec0 ===== */ + +undefined1 * __stdcall16far FUN_1008_2ec0(int param_1,undefined1 *param_2,undefined1 *param_3) + +{ + undefined1 *puVar1; + undefined1 *puVar2; + undefined1 *puVar3; + undefined1 *puVar4; + byte bVar5; + + bVar5 = 0; + puVar3 = (undefined1 *)param_2; + puVar4 = (undefined1 *)param_3; + if (puVar3 < puVar4) { + bVar5 = 1; + puVar3 = puVar3 + param_1 + -1; + puVar4 = puVar4 + param_1 + -1; + } + for (; param_1 != 0; param_1 = param_1 + -1) { + puVar2 = puVar4; + puVar4 = puVar4 + (uint)bVar5 * -2 + 1; + puVar1 = puVar3; + puVar3 = puVar3 + (uint)bVar5 * -2 + 1; + *puVar2 = *puVar1; + } + return param_3; +} + + +/* ===== 1008:2ee5 FUN_1008_2ee5 ===== */ + +char * __stdcall16far FUN_1008_2ee5(char *param_1,char *param_2) + +{ + char *pcVar1; + char *pcVar2; + uint uVar3; + char *pcVar4; + char *pcVar5; + undefined2 uVar6; + + uVar6 = (undefined2)((ulong)param_1 >> 0x10); + pcVar4 = (char *)param_1; + uVar3 = 0xffff; + pcVar5 = pcVar4; + do { + if (uVar3 == 0) break; + uVar3 = uVar3 - 1; + pcVar1 = pcVar5; + pcVar5 = pcVar5 + 1; + } while (*pcVar1 != '\0'); + pcVar5 = (char *)param_2; + for (uVar3 = ~uVar3; uVar3 != 0; uVar3 = uVar3 - 1) { + pcVar2 = pcVar5; + pcVar5 = pcVar5 + 1; + pcVar1 = pcVar4; + pcVar4 = pcVar4 + 1; + *pcVar2 = *pcVar1; + } + return param_2; +} + + +/* ===== 1008:2f07 FUN_1008_2f07 ===== */ + +char * __stdcall16far FUN_1008_2f07(int param_1,char *param_2,char *param_3) + +{ + char *pcVar1; + char *pcVar2; + int iVar3; + char *pcVar4; + char *pcVar5; + undefined2 uVar6; + undefined2 uVar7; + + uVar6 = (undefined2)((ulong)param_2 >> 0x10); + pcVar4 = (char *)param_2; + iVar3 = param_1; + pcVar5 = pcVar4; + do { + if (iVar3 == 0) break; + iVar3 = iVar3 + -1; + pcVar1 = pcVar5; + pcVar5 = pcVar5 + 1; + } while (*pcVar1 != '\0'); + uVar7 = (undefined2)((ulong)param_3 >> 0x10); + pcVar5 = (char *)param_3; + for (param_1 = param_1 - iVar3; param_1 != 0; param_1 = param_1 + -1) { + pcVar2 = pcVar5; + pcVar5 = pcVar5 + 1; + pcVar1 = pcVar4; + pcVar4 = pcVar4 + 1; + *pcVar2 = *pcVar1; + } + *pcVar5 = '\0'; + return param_3; +} + + +/* ===== 1008:2f2f FUN_1008_2f2f ===== */ + +byte * __stdcall16far FUN_1008_2f2f(byte *param_1,byte *param_2) + +{ + byte *pbVar1; + uint uVar2; + byte *pbVar3; + byte *pbVar4; + undefined2 uVar5; + + pbVar3 = (byte *)param_1; + uVar5 = (undefined2)((ulong)param_2 >> 0x10); + pbVar4 = (byte *)param_2; + for (uVar2 = (uint)*param_1; pbVar3 = pbVar3 + 1, uVar2 != 0; uVar2 = uVar2 - 1) { + pbVar1 = pbVar4; + pbVar4 = pbVar4 + 1; + *pbVar1 = *pbVar3; + } + *pbVar4 = 0; + return param_2; +} + + +/* ===== 1008:2f4d FUN_1008_2f4d ===== */ + +undefined4 __stdcall16far +FUN_1008_2f4d(undefined2 param_1,undefined2 param_2,undefined2 param_3,undefined2 param_4) + +{ + undefined4 uVar1; + + uVar1 = FUN_1008_2ea9(param_3,param_4); + FUN_1008_2ee5(param_1,param_2,uVar1); + return CONCAT22(param_4,param_3); +} + + +/* ===== 1008:2f70 FUN_1008_2f70 ===== */ + +void __stdcall16far FUN_1008_2f70(int param_1,char *param_2,char *param_3) + +{ + char *pcVar1; + char *pcVar2; + byte bVar3; + int iVar4; + undefined1 uVar5; + int iVar6; + uint uVar7; + char *pcVar8; + char *pcVar9; + undefined2 uVar10; + undefined2 uVar11; + bool bVar12; + + uVar10 = (undefined2)((ulong)param_2 >> 0x10); + pcVar9 = (char *)param_2; + if (param_1 != 0) { + iVar4 = 0; + iVar6 = param_1; + pcVar8 = pcVar9; + do { + if (iVar6 == 0) break; + iVar6 = iVar6 + -1; + pcVar1 = pcVar8; + pcVar8 = pcVar8 + 1; + } while (*pcVar1 != '\0'); + param_1 = param_1 - iVar6; + bVar12 = param_1 == 0; + uVar11 = (undefined2)((ulong)param_3 >> 0x10); + pcVar8 = (char *)param_3; +LAB_1008_2f90: + do { + if (param_1 != 0) { + param_1 = param_1 + -1; + pcVar2 = pcVar9; + pcVar9 = pcVar9 + 1; + pcVar1 = pcVar8; + pcVar8 = pcVar8 + 1; + bVar12 = *pcVar1 == *pcVar2; + if (bVar12) goto LAB_1008_2f90; + } + if (bVar12) { + return; + } + bVar3 = pcVar8[-1]; + uVar5 = (undefined1)((uint)iVar4 >> 8); + iVar4 = CONCAT11(uVar5,bVar3); + if ((0x60 < bVar3) && (bVar3 < 0x7b)) { + iVar4 = CONCAT11(uVar5,bVar3 - 0x20); + } + bVar3 = pcVar9[-1]; + uVar7 = (uint)bVar3; + if ((0x60 < bVar3) && (bVar3 < 0x7b)) { + uVar7 = (uint)(byte)(bVar3 - 0x20); + } + iVar4 = iVar4 - uVar7; + bVar12 = true; + } while (iVar4 == 0); + } + return; +} + + +/* ===== 1008:2fbb FUN_1008_2fbb ===== */ + +char * __stdcall16far FUN_1008_2fbb(char param_1,char *param_2) + +{ + char *pcVar1; + char *pcVar2; + uint uVar3; + undefined2 uVar4; + char *pcVar5; + undefined2 uVar6; + bool bVar7; + + uVar6 = (undefined2)((ulong)param_2 >> 0x10); + pcVar5 = (char *)param_2; + uVar3 = 0xffff; + bVar7 = true; + pcVar2 = pcVar5; + do { + if (uVar3 == 0) break; + uVar3 = uVar3 - 1; + pcVar1 = pcVar2; + pcVar2 = pcVar2 + 1; + bVar7 = *pcVar1 == '\0'; + } while (!bVar7); + uVar3 = ~uVar3; + do { + if (uVar3 == 0) break; + uVar3 = uVar3 - 1; + pcVar1 = pcVar5; + pcVar5 = pcVar5 + 1; + bVar7 = param_1 == *pcVar1; + } while (!bVar7); + pcVar2 = (char *)0x0; + uVar4 = 0; + if (bVar7) { + pcVar2 = pcVar5 + -1; + uVar4 = uVar6; + } + return (char *)CONCAT22(uVar4,pcVar2); +} + + +/* ===== 1008:2fe3 FUN_1008_2fe3 ===== */ + +char * __stdcall16far FUN_1008_2fe3(char param_1,char *param_2) + +{ + char *pcVar1; + char *pcVar2; + uint uVar3; + undefined2 uVar4; + char *pcVar5; + undefined2 uVar6; + bool bVar7; + + uVar6 = (undefined2)((ulong)param_2 >> 0x10); + pcVar5 = (char *)param_2; + uVar3 = 0xffff; + do { + if (uVar3 == 0) break; + uVar3 = uVar3 - 1; + pcVar1 = pcVar5; + pcVar5 = pcVar5 + 1; + } while (*pcVar1 != '\0'); + uVar3 = ~uVar3; + pcVar5 = pcVar5 + -1; + bVar7 = pcVar5 == (char *)0x0; + do { + if (uVar3 == 0) break; + uVar3 = uVar3 - 1; + pcVar1 = pcVar5; + pcVar5 = pcVar5 + -1; + bVar7 = param_1 == *pcVar1; + } while (!bVar7); + pcVar2 = (char *)0x0; + uVar4 = 0; + if (bVar7) { + pcVar2 = pcVar5 + 1; + uVar4 = uVar6; + } + return (char *)CONCAT22(uVar4,pcVar2); +} + + +/* ===== 1008:300a FUN_1008_300a ===== */ + +void __stdcall16far FUN_1008_300a(char *param_1,char *param_2) + +{ + char *pcVar1; + uint uVar2; + int iVar3; + char *pcVar4; + char *pcVar5; + undefined2 uVar6; + + uVar6 = (undefined2)((ulong)param_1 >> 0x10); + pcVar4 = (char *)param_1; + uVar2 = 0xffff; + pcVar5 = pcVar4; + do { + if (uVar2 == 0) break; + uVar2 = uVar2 - 1; + pcVar1 = pcVar5; + pcVar5 = pcVar5 + 1; + } while (*pcVar1 != '\0'); + iVar3 = ~uVar2 - 1; + pcVar5 = (char *)param_2; + *param_2 = (char)iVar3; + for (; pcVar5 = pcVar5 + 1, iVar3 != 0; iVar3 = iVar3 + -1) { + pcVar1 = pcVar4; + pcVar4 = pcVar4 + 1; + *pcVar5 = *pcVar1; + } + return; +} + + +/* ===== 1008:302c FUN_1008_302c ===== */ + +undefined4 __stdcall16far FUN_1008_302c(char *param_1) + +{ + int iVar1; + long lVar2; + undefined4 uVar3; + + uVar3 = 0; + if (((char *)param_1 != (char *)0x0 || param_1._2_2_ != 0) && (uVar3 = 0, *param_1 != '\0')) { + iVar1 = FUN_1008_2e92((char *)param_1,param_1._2_2_); + lVar2 = FUN_1020_012d(iVar1 + 1); + uVar3 = 0; + if (lVar2 != 0) { + uVar3 = FUN_1008_2ec0(iVar1 + 1,(char *)param_1,param_1._2_2_,lVar2); + } + } + return uVar3; +} + + +/* ===== 1008:3099 FUN_1008_3099 ===== */ + +void __stdcall16far FUN_1008_3099(int param_1,int param_2) + +{ + int iVar1; + + if (param_1 != 0 || param_2 != 0) { + iVar1 = FUN_1008_2e92(param_1,param_2); + FUN_1020_0147(iVar1 + 1,param_1,param_2); + } + return; +} + + +/* ===== 1010:0002 FUN_1010_0002 ===== */ + +void __cdecl16far FUN_1010_0002(void) + +{ + if (0x1f < DAT_1028_4781) { + FREELIBRARY(); + } + DAT_1028_4784 = 0; + DAT_1028_4750 = 0; + DAT_1028_4752 = 0; + DAT_1028_4754 = 0; + DAT_1028_4756 = 0; + DAT_1028_4758 = 0; + DAT_1028_475a = 0; + DAT_1028_475c = 0; + DAT_1028_475e = 0; + DAT_1028_4760 = 0; + DAT_1028_4762 = 0; + DAT_1028_4764 = 0; + DAT_1028_4766 = 0; + DAT_1028_4768 = 0; + DAT_1028_476a = 0; + DAT_1028_476c = 0; + DAT_1028_476e = 0; + DAT_1028_4770 = 0; + DAT_1028_4772 = 0; + DAT_1028_4774 = 0; + DAT_1028_4776 = 0; + DAT_1028_4778 = 0; + DAT_1028_477a = 0; + return; +} + + +/* ===== 1010:0079 FUN_1010_0079 ===== */ + +void __cdecl16far FUN_1010_0079(void) + +{ + undefined2 uVar1; + + if ((DAT_1028_4784 != '\0') && (DAT_1028_4778 != (code *)0x0 || DAT_1028_477a != 0)) { + uVar1 = GETCURRENTTASK(); + (*DAT_1028_4778)(0x1228,uVar1); + FUN_1010_0002(); + } + return; +} + + +/* ===== 1010:00a2 FUN_1010_00a2 ===== */ + +undefined2 __stdcall16far +FUN_1010_00a2(undefined2 param_1,undefined2 param_2,undefined2 param_3,undefined2 param_4) + +{ + undefined1 extraout_AH; + undefined1 extraout_AH_00; + undefined1 extraout_AH_01; + undefined1 extraout_AH_02; + undefined1 extraout_AH_03; + undefined1 uVar1; + int unaff_BP; + undefined2 unaff_SS; + undefined4 uVar2; + char *pcVar3; + undefined1 local_163 [9]; + undefined1 local_15a [5]; + undefined1 local_155 [256]; + char local_55 [80]; + undefined1 local_5; + undefined2 uStack_4; + int iStack_2; + + iStack_2 = unaff_BP + 1; + uStack_4 = 0x1028; + local_5 = 0; + local_155[0] = 0; + FUN_1008_2643(local_155,unaff_SS,param_3,param_4,local_55,unaff_SS); + if (local_55[0] == '\0') { + GETWINDOWSDIRECTORY(0x1008,0xff,local_155); + FUN_1008_2643(local_155,unaff_SS,param_3,param_4,local_55,unaff_SS); + if (local_55[0] == '\0') { + GETSYSTEMDIRECTORY(0x1008,0xff,local_155); + FUN_1008_2643(local_155,unaff_SS,param_3,param_4,local_55,unaff_SS); + if (local_55[0] == '\0') { + GETMODULEHANDLE(0x1008,param_1); + GETMODULEFILENAME(0x1228,0x100,local_155,unaff_SS); + FUN_1008_26b0(local_15a,unaff_SS,local_163,unaff_SS,local_155,unaff_SS,local_155,unaff_SS); + FUN_1008_2643(local_155,unaff_SS,param_3,param_4,local_55,unaff_SS); + if (local_55[0] == '\0') { + pcVar3 = local_55; + uVar2 = FUN_1008_2819(0x46a,0x1028); + FUN_1008_2643(uVar2,param_3,param_4,pcVar3,unaff_SS); + uVar1 = extraout_AH_03; + if (local_55[0] != '\0') { + local_5 = 1; + } + } + else { + local_5 = 1; + uVar1 = extraout_AH_02; + } + } + else { + local_5 = 1; + uVar1 = extraout_AH_01; + } + } + else { + local_5 = 1; + uVar1 = extraout_AH_00; + } + } + else { + local_5 = 1; + uVar1 = extraout_AH; + } + return CONCAT11(uVar1,local_5); +} + + +/* ===== 1010:01c2 FUN_1010_01c2 ===== */ + +char __stdcall16far +FUN_1010_01c2(undefined1 param_1,undefined1 param_2,char param_3,undefined2 param_4, + undefined2 param_5) + +{ + char cVar1; + int iVar2; + undefined2 uVar3; + code *pcVar4; + undefined4 uVar5; + undefined4 uVar6; + uint uVar7; + uint uVar8; + uint uVar9; + uint uVar10; + undefined2 uVar11; + undefined2 uVar12; + char local_5; + + local_5 = '\x01'; + if (DAT_1028_4784 == '\0') { + if (DAT_1028_478c == '\0') { + uVar12 = 0x8000; + SETERRORMODE(); + uVar11 = 0x1028; + DAT_1028_4781 = LOADLIBRARY(0x1228,0x478d); + uVar3 = 0x1228; + SETERRORMODE(0x1228,0,uVar11,uVar12); + } + else { + uVar3 = 0x1010; + cVar1 = FUN_1010_00a2(param_4,param_5,0x478d,0x1028); + if (cVar1 == '\0') { + DAT_1028_4781 = 0; + } + else { + uVar3 = 0x1228; + DAT_1028_4781 = LOADLIBRARY(0x1010,0x478d); + } + } + if (0x1f < DAT_1028_4781) { + pcVar4 = (code *)GETPROCADDRESS(uVar3,0x470,0x1028); + DAT_1028_4752 = (undefined2)((ulong)pcVar4 >> 0x10); + DAT_1028_4750 = (code *)pcVar4; + uVar5 = GETPROCADDRESS(0x1228,0x482,0x1028); + DAT_1028_4756 = (undefined2)((ulong)uVar5 >> 0x10); + DAT_1028_4754 = (undefined2)uVar5; + uVar5 = GETPROCADDRESS(0x1228,0x493,0x1028); + DAT_1028_475a = (undefined2)((ulong)uVar5 >> 0x10); + DAT_1028_4758 = (undefined2)uVar5; + pcVar4 = (code *)GETPROCADDRESS(0x1228,0x4a3,0x1028); + DAT_1028_475e = (undefined2)((ulong)pcVar4 >> 0x10); + DAT_1028_475c = (code *)pcVar4; + uVar5 = GETPROCADDRESS(0x1228,0x4b0,0x1028); + DAT_1028_4762 = (undefined2)((ulong)uVar5 >> 0x10); + DAT_1028_4760 = (undefined2)uVar5; + pcVar4 = (code *)GETPROCADDRESS(0x1228,0x4c3,0x1028); + DAT_1028_4766 = (undefined2)((ulong)pcVar4 >> 0x10); + DAT_1028_4764 = (code *)pcVar4; + pcVar4 = (code *)GETPROCADDRESS(0x1228,0x4cf,0x1028); + DAT_1028_476a = (undefined2)((ulong)pcVar4 >> 0x10); + DAT_1028_4768 = (code *)pcVar4; + uVar9 = 0x1028; + uVar10 = DAT_1028_4781; + uVar5 = GETPROCADDRESS(0x1228,0x4dd,0x1028); + DAT_1028_476e = (undefined2)((ulong)uVar5 >> 0x10); + DAT_1028_476c = (undefined2)uVar5; + if (DAT_1028_478c == '\0') { + uVar9 = DAT_1028_4781; + uVar6 = GETPROCADDRESS(0x1228,0x4ee,0x1028); + uVar5 = CONCAT22(DAT_1028_476e,DAT_1028_476c); + } + else { + uVar6 = 0; + } + DAT_1028_4772 = (undefined2)((ulong)uVar6 >> 0x10); + DAT_1028_4770 = (undefined2)uVar6; + DAT_1028_476e = (undefined2)((ulong)uVar5 >> 0x10); + DAT_1028_476c = (undefined2)uVar5; + uVar8 = DAT_1028_4781; + uVar5 = GETPROCADDRESS(0x1228,0x501,0x1028); + DAT_1028_4776 = (undefined2)((ulong)uVar5 >> 0x10); + DAT_1028_4774 = (undefined2)uVar5; + uVar7 = DAT_1028_4781; + uVar5 = GETPROCADDRESS(0x1228,0x512,0x1028); + DAT_1028_477a = (undefined2)((ulong)uVar5 >> 0x10); + DAT_1028_4778 = (undefined2)uVar5; + uVar3 = GETCURRENTTASK(0x1228,uVar7,uVar8,uVar9,uVar10); + iVar2 = (*DAT_1028_4768)(0x1228,uVar3); + DAT_1028_4784 = iVar2 != 0; + if ((bool)DAT_1028_4784) { + DAT_1028_477c = (*DAT_1028_4764)(0x1228); + iVar2 = (*DAT_1028_475c)(0x1228); + if ((iVar2 == 0) || (DAT_1028_477c < 9)) { + DAT_1028_4784 = false; + } + else { + DAT_1028_4784 = true; + } + } + if ((bool)DAT_1028_4784 == false) { + FUN_1010_0002(); + } + else { + DAT_1028_477f = param_2; + DAT_1028_4780 = param_1; + if ((DAT_1028_478c == '\0') && (param_3 != '\0')) { + iVar2 = (*DAT_1028_4750)(0x1228,DAT_1028_06fe); + DAT_1028_477e = iVar2 != 0; + } + else { + DAT_1028_477e = 0; + } + } + } + local_5 = DAT_1028_4784; + } + return local_5; +} + + +/* ===== 1010:03af FUN_1010_03af ===== */ + +undefined2 __stdcall16far +FUN_1010_03af(undefined1 param_1,undefined1 param_2,undefined1 param_3,undefined2 param_4, + undefined2 param_5) + +{ + undefined2 uVar1; + + uVar1 = FUN_1010_01c2(param_1,param_2,param_3,param_4,param_5); + DAT_1028_4783 = 0; + return uVar1; +} + + +/* ===== 1010:03e0 FUN_1010_03e0 ===== */ + +void __stdcall16far FUN_1010_03e0(undefined4 param_1) + +{ + int unaff_BP; + + FUN_1010_0079(0x1028,unaff_BP + 1); + FUN_1018_1b08((int)param_1,(int)((ulong)param_1 >> 0x10),0); + FUN_1020_0439(); + return; +} + + +/* ===== 1010:0405 FUN_1010_0405 ===== */ + +undefined1 __stdcall16far FUN_1010_0405(byte *param_1) + +{ + byte *pbVar1; + byte *pbVar2; + int iVar3; + uint uVar4; + int unaff_BP; + byte *pbVar5; + undefined2 unaff_SS; + undefined1 local_185 [128]; + byte local_105; + byte abStack_104 [255]; + undefined1 local_5; + undefined2 uStack_4; + int iStack_2; + + iStack_2 = unaff_BP + 1; + uStack_4 = 0x1028; + pbVar5 = (byte *)param_1; + local_105 = *param_1; + pbVar2 = abStack_104; + for (uVar4 = (uint)local_105; pbVar5 = pbVar5 + 1, uVar4 != 0; uVar4 = uVar4 - 1) { + pbVar1 = pbVar2; + pbVar2 = pbVar2 + 1; + *pbVar1 = *pbVar5; + } + FUN_1020_0667(&local_105,unaff_SS,local_185,unaff_SS); + FUN_1020_06ab(1,local_185,unaff_SS); + iVar3 = FUN_1020_0388(); + if (iVar3 == 0) { + local_5 = 1; + FUN_1020_072c(local_185,unaff_SS); + FUN_1020_038f(); + } + else { + local_5 = 0; + } + return local_5; +} + + +/* ===== 1010:0472 FUN_1010_0472 ===== */ + +/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */ + +void __cdecl16far FUN_1010_0472(void) + +{ + char cVar1; + undefined2 unaff_CS; + undefined2 uVar2; + undefined2 unaff_SS; + undefined1 *puVar3; + undefined1 *puVar4; + undefined2 uVar5; + undefined2 uVar6; + undefined1 local_202 [256]; + undefined1 local_102 [256]; + + DAT_1028_47a2 = GETSYSTEMDIRECTORY(unaff_CS,200,0x47a4); + puVar4 = local_102; + uVar5 = unaff_SS; + FUN_1008_300a(0x47a4,0x1028); + FUN_1020_0a51(0x470,0x1008); + puVar3 = local_202; + uVar2 = unaff_SS; + FUN_1008_300a(0x522,0x1028); + FUN_1020_0a51(puVar3,uVar2); + FUN_1020_09ec(0xff,0x486d,0x1028,puVar4,uVar5); + puVar4 = local_102; + uVar5 = unaff_SS; + FUN_1008_300a(0x47a4,0x1028); + FUN_1020_0a51(0x470,0x1008); + puVar3 = local_202; + uVar2 = unaff_SS; + FUN_1008_300a(0x52c,0x1028); + FUN_1020_0a51(puVar3,uVar2); + uVar2 = 0x1020; + FUN_1020_09ec(0xff,0x496d,0x1028,puVar4,uVar5); + if (DAT_1028_47a2 != 0) { + uVar6 = 0x1028; + uVar5 = 0x478d; + puVar4 = local_102; + uVar2 = unaff_SS; + FUN_1008_300a(0x52c,0x1028); + FUN_1008_2f2f(puVar4,uVar2,uVar5,uVar6); + uVar2 = 0x1010; + cVar1 = FUN_1010_0405(0x496d,0x1028); + if (cVar1 == '\0') { + uVar2 = 0x1010; + cVar1 = FUN_1010_0405(0x486d,0x1028); + if (cVar1 != '\0') { + uVar6 = 0x1028; + uVar5 = 0x478d; + puVar4 = local_102; + FUN_1008_300a(0x522,0x1028); + uVar2 = 0x1008; + FUN_1008_2f2f(puVar4,unaff_SS,uVar5,uVar6); + } + } + } + DAT_1028_4750 = 0; + DAT_1028_4752 = 0; + DAT_1028_4754 = 0; + DAT_1028_4756 = 0; + DAT_1028_4758 = 0; + DAT_1028_475a = 0; + DAT_1028_475c = 0; + DAT_1028_475e = 0; + DAT_1028_4760 = 0; + DAT_1028_4762 = 0; + DAT_1028_4764 = 0; + DAT_1028_4766 = 0; + DAT_1028_4768 = 0; + DAT_1028_476a = 0; + DAT_1028_476c = 0; + DAT_1028_476e = 0; + DAT_1028_4770 = 0; + DAT_1028_4772 = 0; + DAT_1028_4774 = 0; + DAT_1028_4776 = 0; + DAT_1028_4778 = 0; + DAT_1028_477a = 0; + _DAT_1028_478a = GETVERSION(uVar2); + uVar2 = _DAT_1028_478a; + if ((DAT_1028_478a == '\x03') && + (DAT_1028_478b = (byte)((uint)_DAT_1028_478a >> 8), DAT_1028_478b < 10)) { + DAT_1028_478c = 1; + } + else { + DAT_1028_478c = 0; + } + DAT_1028_477e = 0; + DAT_1028_477f = 0; + DAT_1028_4780 = 1; + DAT_1028_4781 = 0; + DAT_1028_4783 = 0; + DAT_1028_4784 = 0; + _DAT_1028_478a = uVar2; + return; +} + + +/* ===== 1018:0002 FUN_1018_0002 ===== */ + +void __cdecl16near FUN_1018_0002(void) + +{ + int *piVar1; + int iVar2; + int iVar3; + int in_AX; + int iVar4; + int in_BX; + int *piVar5; + int *piVar6; + bool bVar7; + + piVar5 = (int *)*(int *)(in_BX + 4); + if ((piVar5 != (int *)0x0) && (in_AX != piVar5[1])) { + bVar7 = false; + do { + iVar4 = piVar5[3]; + piVar6 = piVar5 + 4; + do { + if (iVar4 == 0) break; + iVar4 = iVar4 + -1; + piVar1 = piVar6; + piVar6 = piVar6 + 1; + bVar7 = in_AX == *piVar1; + } while (!bVar7); + if (bVar7) { + iVar2 = piVar5[3]; + iVar3 = *(int *)(in_BX + 4); + *(int *)(iVar3 + 2) = in_AX; + *(undefined2 *)(iVar3 + 4) = piVar6 + ((iVar2 + -1) * 2 - iVar4); + return; + } + piVar5 = (int *)*piVar5; + bVar7 = piVar5 == (int *)0x0; + } while (!bVar7); + } + return; +} + + +/* ===== 1018:0045 FUN_1018_0045 ===== */ + +void __stdcall16far FUN_1018_0045(undefined2 param_1,undefined2 param_2) + +{ + undefined2 unaff_CS; + + SETPROP(unaff_CS,param_2,0x67a,0x1028); + SETPROP(0x1228,param_1,0x67e,0x1028); + return; +} + + +/* ===== 1018:0071 FUN_1018_0071 ===== */ + +void __stdcall16far FUN_1018_0071(void) + +{ + undefined2 unaff_CS; + + REMOVEPROP(unaff_CS,0x67a,0x1028); + REMOVEPROP(0x1228,0x67e,0x1028); + return; +} + + +/* ===== 1018:0097 FUN_1018_0097 ===== */ + +undefined4 __stdcall16far FUN_1018_0097(int param_1) + +{ + int iVar1; + char *pcVar2; + undefined2 uVar3; + int iVar4; + undefined2 uVar5; + char *pcVar6; + + iVar1 = ISWINDOW(); + iVar4 = iVar1 >> 0xf; + uVar3 = 0; + if (iVar1 != 0) { + pcVar6 = (char *)GETWINDOWLONG(0x1228,0xfffc); + uVar5 = (undefined2)((ulong)pcVar6 >> 0x10); + pcVar2 = (char *)pcVar6; + if (((*pcVar6 == -0x18) && (-1 - (int)pcVar2 == *(int *)(pcVar2 + 1))) && + (*(int *)0x2 == 0x2e5b)) { + uVar3 = *(undefined2 *)(pcVar2 + 3); + iVar4 = *(int *)(pcVar2 + 5); + } + else { + GETPROP(0x1228,0x67a,0x1028); + iVar4 = param_1; + uVar3 = GETPROP(0x1228,0x67e,0x1028); + } + } + return CONCAT22(iVar4,uVar3); +} + + +/* ===== 1018:0103 FUN_1018_0103 ===== */ + +void __cdecl16near FUN_1018_0103(void) + +{ + (*DAT_1028_0682)(); + return; +} + + +/* ===== 1018:0133 FUN_1018_0133 ===== */ + +undefined4 __stdcall16far +FUN_1018_0133(undefined2 param_1,undefined2 param_2,undefined2 param_3,int param_4,int param_5) + +{ + int *in_BX; + undefined2 *unaff_DI; + undefined2 unaff_ES; + undefined2 unaff_SS; + + in_BX[2] = param_5; + if (param_4 < 0) { + unaff_DI = (undefined2 *)(*in_BX + 0xc); + } + else { + FUN_1018_0002(); + } + if (*(int *)&DAT_1028_0684 != 0) { + FUN_1018_0103(); + } + (*(code *)*unaff_DI)(); + return CONCAT22(param_3,param_4); +} + + +/* ===== 1018:018b FUN_1018_018b ===== */ + +void __stdcall16far +FUN_1018_018b(undefined2 param_1,undefined2 param_2,undefined2 param_3,undefined2 param_4, + undefined2 param_5) + +{ + undefined2 *puVar1; + undefined4 uVar2; + undefined2 unaff_CS; + undefined2 unaff_SS; + undefined2 uVar3; + + uVar2 = *(undefined4 *)((int)*(undefined4 *)&DAT_1028_0676 + 0x12); + uVar3 = param_5; + SETWINDOWLONG(unaff_CS,(int)uVar2,(int)((ulong)uVar2 >> 0x10),0xfffc); + FUN_1018_0045((int)*(undefined4 *)&DAT_1028_0676, + (int)((ulong)*(undefined4 *)&DAT_1028_0676 >> 0x10),param_5); + puVar1 = (undefined2 *)((int)*(undefined4 *)&DAT_1028_0676 + 0x12); + (*(code *)*puVar1)(0x1018,param_1,param_2,param_3,param_4,param_5,uVar3); + return; +} + + +/* ===== 1018:01dc FUN_1018_01dc ===== */ + +undefined1 * __stdcall16far FUN_1018_01dc(undefined2 param_1,undefined2 param_2) + +{ + undefined1 *puVar1; + undefined2 *puVar2; + undefined2 uVar3; + int iVar4; + undefined2 unaff_CS; + undefined2 *puVar5; + undefined2 uVar6; + undefined4 local_10; + + if (DAT_1028_066e == (undefined1 *)0x0 && DAT_1028_0670 == 0) { + uVar6 = 0; + uVar3 = GLOBALALLOC(unaff_CS,0x100,0); + puVar5 = (undefined2 *)GLOBALLOCK(0x1228,uVar3,uVar6); + uVar6 = (undefined2)((ulong)puVar5 >> 0x10); + puVar2 = (undefined2 *)puVar5; + *puVar5 = DAT_1028_066c; + FUN_1020_16a5(5,puVar2 + 1,uVar6,0x686,0x1028); + uVar3 = DAT_1028_0674; + *(undefined2 *)((int)puVar2 + 7) = DAT_1028_0672; + *(undefined2 *)((int)puVar2 + 9) = uVar3; + local_10 = (undefined1 *)CONCAT22(uVar6,(undefined1 *)((int)puVar2 + 0xb)); + do { + *local_10 = 0xe8; + iVar4 = (int)((ulong)local_10 >> 0x10); + *(int *)((undefined1 *)local_10 + 1) = -1 - (int)(undefined1 *)local_10; + *(undefined1 **)((undefined1 *)local_10 + 3) = DAT_1028_066e; + *(int *)((undefined1 *)local_10 + 5) = DAT_1028_0670; + DAT_1028_066e = (undefined1 *)local_10; + local_10._0_2_ = (undefined1 *)local_10 + 7; + local_10 = (undefined1 *)CONCAT22(iVar4,(undefined1 *)local_10); + DAT_1028_0670 = iVar4; + } while ((undefined1 *)local_10 != (undefined1 *)0x100); + unaff_CS = 0x1228; + DAT_1028_066c = uVar6; + PRESTOCHANGOSELECTOR(0x1020,uVar6); + } + iVar4 = DAT_1028_0670; + puVar1 = DAT_1028_066e; + uVar3 = ALLOCCSTODSALIAS(unaff_CS,DAT_1028_0670); + DAT_1028_066e = *(undefined1 **)(puVar1 + 3); + DAT_1028_0670 = *(int *)(puVar1 + 5); + *(undefined2 *)(puVar1 + 3) = param_1; + *(undefined2 *)(puVar1 + 5) = param_2; + FREESELECTOR(0x1228,uVar3); + return (undefined1 *)CONCAT22(iVar4,puVar1); +} + + +/* ===== 1018:02fa FUN_1018_02fa ===== */ + +void __stdcall16far FUN_1018_02fa(int param_1,undefined2 param_2) + +{ + undefined2 uVar1; + undefined2 uVar2; + int unaff_BP; + int iVar3; + undefined2 uVar4; + int iVar5; + undefined2 uVar6; + + iVar3 = unaff_BP + 1; + uVar6 = 0x1028; + uVar4 = param_2; + iVar5 = param_1; + uVar2 = ALLOCCSTODSALIAS(); + uVar1 = DAT_1028_0670; + *(undefined2 *)(iVar5 + 3) = DAT_1028_066e; + *(undefined2 *)(iVar5 + 5) = uVar1; + FREESELECTOR(0x1228,uVar2,uVar4,iVar5,uVar2,uVar6,iVar3); + DAT_1028_066e = param_1; + DAT_1028_0670 = param_2; + return; +} + + +/* ===== 1018:0341 FUN_1018_0341 ===== */ + +undefined4 __stdcall16far +FUN_1018_0341(undefined4 param_1,undefined2 param_2,undefined2 param_3,undefined2 param_4) + +{ + int unaff_BP; + int iVar1; + undefined2 uVar2; + bool bVar3; + undefined4 uVar4; + + bVar3 = true; + FUN_1020_03ef(0x1028,unaff_BP + 1); + if (!bVar3) { + uVar2 = (undefined2)((ulong)param_1 >> 0x10); + iVar1 = (int)param_1; + FUN_1008_2d99(iVar1,uVar2,0); + *(undefined2 *)(iVar1 + 2) = 0; + *(undefined2 *)(iVar1 + 4) = 0; + *(undefined2 *)(iVar1 + 0x17) = 0; + *(undefined2 *)(iVar1 + 6) = param_3; + *(undefined2 *)(iVar1 + 8) = param_4; + if (*(int *)(iVar1 + 6) == 0 && *(int *)(iVar1 + 8) == 0) { + *(undefined2 *)(iVar1 + 0x19) = 0; + *(undefined2 *)(iVar1 + 0x1b) = 0; + } + else { + FUN_1018_069a((int)*(undefined4 *)(iVar1 + 6),(int)((ulong)*(undefined4 *)(iVar1 + 6) >> 0x10) + ,iVar1,uVar2); + } + *(undefined2 *)(iVar1 + 10) = 0; + *(undefined2 *)(iVar1 + 0xc) = 0; + *(undefined2 *)(iVar1 + 0xe) = 0; + *(undefined2 *)(iVar1 + 0x10) = 0; + uVar4 = FUN_1018_01dc(iVar1,uVar2); + *(undefined2 *)(iVar1 + 0x12) = (int)uVar4; + *(undefined2 *)(iVar1 + 0x14) = (int)((ulong)uVar4 >> 0x10); + *(undefined1 *)(iVar1 + 0x16) = 0; + FUN_1018_060d(iVar1,uVar2); + } + return param_1; +} + + +/* ===== 1018:03e9 FUN_1018_03e9 ===== */ + +void __stdcall16far FUN_1018_03e9(undefined2 param_1,undefined4 param_2) + +{ + FUN_1008_2db3((int)param_2,(int)((ulong)param_2 >> 0x10)); + return; +} + + +/* ===== 1018:03ff FUN_1018_03ff ===== */ + +void __stdcall16far FUN_1018_03ff(int *param_1) + +{ + int *piVar1; + undefined2 uVar2; + + uVar2 = (undefined2)((ulong)param_1 >> 0x10); + piVar1 = (int *)param_1; + (*(code *)*(undefined2 *)(*param_1 + 0x24))(); + FUN_1018_085a(piVar1,uVar2,0x3e9,0x1018); + if (piVar1[3] != 0 || piVar1[4] != 0) { + FUN_1018_071c((int)*(undefined4 *)(piVar1 + 3),(int)((ulong)*(undefined4 *)(piVar1 + 3) >> 0x10) + ,piVar1,uVar2); + } + FUN_1018_02fa(piVar1[9],piVar1[10]); + FUN_1008_2dcd(piVar1,uVar2,0); + FUN_1020_0439(); + return; +} + + +/* ===== 1018:0466 FUN_1018_0466 ===== */ + +undefined2 __stdcall16far FUN_1018_0466(int param_1,undefined4 param_2) + +{ + int iVar1; + undefined1 uVar2; + undefined2 unaff_SS; + + iVar1 = *(int *)((int)param_2 + 0x17); + if ((*(int *)(param_1 + -6) < 0) || (iVar1 != *(int *)(param_1 + -6))) { + uVar2 = 0; + } + else { + uVar2 = 1; + } + return CONCAT11((char)((uint)iVar1 >> 8),uVar2); +} + + +/* ===== 1018:049e FUN_1018_049e ===== */ + +uint __stdcall16far FUN_1018_049e(undefined2 param_1,int *param_2) + +{ + uint uVar1; + int iVar2; + int unaff_BP; + int *piVar3; + undefined2 uVar4; + undefined1 local_58 [82]; + char local_6; + undefined2 uStack_4; + int iStack_2; + + iStack_2 = unaff_BP + 1; + uStack_4 = 0x1028; + uVar4 = (undefined2)((ulong)param_2 >> 0x10); + piVar3 = (int *)param_2; + uVar1 = FUN_1018_0673(piVar3,uVar4,4); + if ((char)uVar1 != '\0') { + uVar1 = (*(code *)*(undefined2 *)(*param_2 + 0x20))(0x1018,piVar3,uVar4); + if ((char)uVar1 == '\0') { + uVar1 = uVar1 & 0xff00; + goto LAB_1018_04d1; + } + } + uVar1 = CONCAT11((char)(uVar1 >> 8),1); +LAB_1018_04d1: + local_6 = (char)uVar1; + if (local_6 != '\0') { + iVar2 = ISICONIC(0x1018,piVar3[2]); + uVar1 = 0; + if (iVar2 != 0) { + GETWINDOWTEXT(0x1228,0x51,local_58); + uVar1 = SETWINDOWTEXT(0x1228,local_58); + } + } + uVar1 = uVar1 & 0xff00; + if (local_6 == '\0') { + uVar1 = uVar1 + 1; + } + return uVar1; +} + + +/* ===== 1018:0524 FUN_1018_0524 ===== */ + +undefined1 __stdcall16far FUN_1018_0524(undefined2 param_1,undefined4 param_2) + +{ + char cVar1; + undefined2 uVar2; + + uVar2 = (undefined2)((ulong)param_2 >> 0x10); + if ((*(int *)((int)param_2 + 0x17) == 0) && + (cVar1 = FUN_1018_049e(param_1,(int)param_2,uVar2), cVar1 != '\0')) { + return 1; + } + return 0; +} + + +/* ===== 1018:055c FUN_1018_055c ===== */ + +uint __stdcall16far FUN_1018_055c(undefined4 param_1) + +{ + uint uVar1; + int unaff_BP; + undefined2 uVar2; + long lVar3; + undefined4 uVar4; + char local_d; + int iStack_2; + + iStack_2 = unaff_BP + 1; + local_d = '\0'; + do { + uVar2 = (undefined2)((ulong)param_1 >> 0x10); + lVar3 = FUN_1018_080d((int)param_1,uVar2,0x466,0x1018); + uVar1 = 0; + if (lVar3 != 0) { + uVar1 = FUN_1018_049e(&iStack_2,lVar3); + local_d = (char)uVar1; + } + } while ((local_d == '\0') && (uVar1 = 0, lVar3 != 0)); + if (local_d == '\0') { + uVar4 = FUN_1018_080d((int)param_1,uVar2,0x524,0x1018); + uVar1 = (uint)uVar4 | (uint)((ulong)uVar4 >> 0x10); + if (uVar1 == 0) { + return 1; + } + } + return uVar1 & 0xff00; +} + + +/* ===== 1018:05dc FUN_1018_05dc ===== */ + +undefined2 __stdcall16far FUN_1018_05dc(void) + +{ + return 0; +} + + +/* ===== 1018:05f3 FUN_1018_05f3 ===== */ + +void __stdcall16far FUN_1018_05f3(undefined4 param_1) + +{ + FUN_1018_0641((int)param_1,(int)((ulong)param_1 >> 0x10),1,1); + return; +} + + +/* ===== 1018:060d FUN_1018_060d ===== */ + +void __stdcall16far FUN_1018_060d(undefined4 param_1) + +{ + FUN_1018_0641((int)param_1,(int)((ulong)param_1 >> 0x10),1,4); + return; +} + + +/* ===== 1018:0627 FUN_1018_0627 ===== */ + +void __stdcall16far FUN_1018_0627(undefined4 param_1) + +{ + FUN_1018_0641((int)param_1,(int)((ulong)param_1 >> 0x10),0,4); + return; +} + + +/* ===== 1018:0641 FUN_1018_0641 ===== */ + +void __stdcall16far FUN_1018_0641(undefined4 param_1,char param_2,byte param_3) + +{ + int iVar1; + undefined2 uVar2; + + iVar1 = (int)param_1; + uVar2 = (undefined2)((ulong)param_1 >> 0x10); + if (param_2 == '\0') { + *(byte *)(iVar1 + 0x16) = ~param_3 & *(byte *)(iVar1 + 0x16); + } + else { + *(byte *)(iVar1 + 0x16) = *(byte *)(iVar1 + 0x16) | param_3; + } + return; +} + + +/* ===== 1018:0673 FUN_1018_0673 ===== */ + +uint __stdcall16far FUN_1018_0673(undefined4 param_1,byte param_2) + +{ + uint in_AX; + uint uVar1; + + uVar1 = in_AX & 0xff00; + if ((*(byte *)((int)param_1 + 0x16) & param_2) == param_2) { + uVar1 = uVar1 + 1; + } + return uVar1; +} + + +/* ===== 1018:069a FUN_1018_069a ===== */ + +void __stdcall16far FUN_1018_069a(undefined4 param_1,undefined4 param_2) + +{ + int iVar1; + int iVar2; + undefined2 uVar3; + undefined2 uVar4; + undefined2 uVar5; + + if ((int)param_2 != 0 || param_2._2_2_ != 0) { + uVar3 = (undefined2)((ulong)param_1 >> 0x10); + iVar1 = (int)param_1; + if (*(int *)(iVar1 + 10) == 0 && *(int *)(iVar1 + 0xc) == 0) { + *(int *)(iVar1 + 10) = (int)param_2; + *(int *)(iVar1 + 0xc) = param_2._2_2_; + *(int *)((int)param_2 + 0x19) = (int)param_2; + *(int *)((int)param_2 + 0x1b) = param_2._2_2_; + } + else { + uVar4 = (undefined2)((ulong)*(undefined4 *)(iVar1 + 10) >> 0x10); + iVar2 = (int)*(undefined4 *)(iVar1 + 10); + uVar5 = *(undefined2 *)(iVar2 + 0x1b); + *(undefined2 *)((int)param_2 + 0x19) = *(undefined2 *)(iVar2 + 0x19); + *(undefined2 *)((int)param_2 + 0x1b) = uVar5; + uVar5 = (undefined2)((ulong)*(undefined4 *)(iVar1 + 10) >> 0x10); + iVar2 = (int)*(undefined4 *)(iVar1 + 10); + *(int *)(iVar2 + 0x19) = (int)param_2; + *(int *)(iVar2 + 0x1b) = param_2._2_2_; + *(int *)(iVar1 + 10) = (int)param_2; + *(int *)(iVar1 + 0xc) = param_2._2_2_; + } + } + return; +} + + +/* ===== 1018:071c FUN_1018_071c ===== */ + +void __stdcall16far FUN_1018_071c(undefined4 param_1,int param_2,int param_3) + +{ + int *piVar1; + int iVar2; + undefined2 uVar3; + undefined2 uVar4; + int local_c; + int iStack_a; + + uVar3 = (undefined2)((ulong)param_1 >> 0x10); + iVar2 = (int)param_1; + if (*(int *)(iVar2 + 10) != 0 || *(int *)(iVar2 + 0xc) != 0) { + local_c = *(int *)(iVar2 + 10); + iStack_a = *(int *)(iVar2 + 0xc); + while (((*(int *)(local_c + 0x1b) != *(int *)(iVar2 + 0xc) || + (*(int *)(local_c + 0x19) != *(int *)(iVar2 + 10))) && + ((*(int *)(local_c + 0x1b) != param_3 || (*(int *)(local_c + 0x19) != param_2))))) { + piVar1 = (int *)(local_c + 0x19); + iStack_a = *(int *)(local_c + 0x1b); + local_c = *piVar1; + } + if ((*(int *)(local_c + 0x1b) == param_3) && (*(int *)(local_c + 0x19) == param_2)) { + if ((*(int *)(local_c + 0x1b) == iStack_a) && (*(int *)(local_c + 0x19) == local_c)) { + *(undefined2 *)(iVar2 + 10) = 0; + *(undefined2 *)(iVar2 + 0xc) = 0; + } + else { + if ((*(int *)(local_c + 0x1b) == *(int *)(iVar2 + 0xc)) && + (*(int *)(local_c + 0x19) == *(int *)(iVar2 + 10))) { + *(int *)(iVar2 + 10) = local_c; + *(int *)(iVar2 + 0xc) = iStack_a; + } + uVar4 = (undefined2)((ulong)*(undefined4 *)(local_c + 0x19) >> 0x10); + iVar2 = (int)*(undefined4 *)(local_c + 0x19); + uVar3 = *(undefined2 *)(iVar2 + 0x1b); + *(undefined2 *)(local_c + 0x19) = *(undefined2 *)(iVar2 + 0x19); + *(undefined2 *)(local_c + 0x1b) = uVar3; + } + } + } + return; +} + + +/* ===== 1018:080d FUN_1018_080d ===== */ + +undefined4 __stdcall16far FUN_1018_080d(undefined4 param_1,code *param_2) + +{ + undefined4 uVar1; + char cVar2; + int iVar3; + int iVar4; + int iVar5; + int iVar6; + int iVar7; + + uVar1 = *(undefined4 *)((int)param_1 + 10); + iVar5 = (int)((ulong)uVar1 >> 0x10); + iVar3 = (int)uVar1; + iVar4 = iVar3; + iVar6 = iVar5; + iVar7 = iVar5; + if (iVar5 != 0 || iVar3 != 0) { + do { + iVar6 = (int)((ulong)*(undefined4 *)(iVar4 + 0x19) >> 0x10); + iVar4 = (int)*(undefined4 *)(iVar4 + 0x19); + cVar2 = (*param_2)(); + if (cVar2 != '\0') goto LAB_1018_084f; + iVar7 = iVar6; + } while ((iVar4 != iVar3) || (iVar6 != iVar5)); + iVar4 = 0; + iVar6 = 0; + } +LAB_1018_084f: + return CONCAT22(iVar6,iVar4); +} + + +/* ===== 1018:085a FUN_1018_085a ===== */ + +void __stdcall16far FUN_1018_085a(undefined4 param_1,code *param_2) + +{ + int iVar1; + undefined4 uVar2; + int iVar3; + int iVar4; + int iVar5; + int iVar6; + + uVar2 = *(undefined4 *)((int)param_1 + 10); + iVar5 = (int)((ulong)uVar2 >> 0x10); + iVar3 = (int)uVar2; + if (iVar5 != 0 || iVar3 != 0) { + iVar4 = (int)*(undefined4 *)(iVar3 + 0x19); + iVar6 = (int)((ulong)*(undefined4 *)(iVar3 + 0x19) >> 0x10); + while ((iVar4 != iVar3 || (iVar6 != iVar5))) { + iVar1 = *(int *)(iVar4 + 0x1b); + iVar4 = *(int *)(iVar4 + 0x19); + (*param_2)(); + iVar6 = iVar1; + } + (*param_2)(); + } + return; +} + + +/* ===== 1018:08ac FUN_1018_08ac ===== */ + +undefined2 __stdcall16far FUN_1018_08ac(void) + +{ + return 0xffff; +} + + +/* ===== 1018:08c3 FUN_1018_08c3 ===== */ + +void __stdcall16far +FUN_1018_08c3(undefined2 param_1,undefined2 param_2,undefined2 *param_3,undefined4 param_4) + +{ + undefined2 *puVar1; + int unaff_BP; + + FUN_1018_0002((int)param_4,(int)((ulong)param_4 >> 0x10),(undefined2 *)param_3, + (int)((ulong)param_3 >> 0x10),0x1028,unaff_BP + 1); + if (DAT_1028_0684 != 0) { + FUN_1018_0103(); + } + puVar1 = (undefined2 *)param_3; + (*(code *)*puVar1)(); + return; +} + + +/* ===== 1018:08f0 FUN_1018_08f0 ===== */ + +void __stdcall16far FUN_1018_08f0(int *param_1,undefined4 param_2) + +{ + char cVar1; + int iVar2; + uint uVar3; + int *piVar4; + int iVar5; + int iVar6; + undefined2 uVar7; + undefined2 uVar8; + int *piVar9; + long lVar10; + int iVar11; + int iVar12; + int local_6; + + iVar12 = 1; + iVar6 = (int)((ulong)param_1 >> 0x10); + piVar4 = (int *)param_1; + uVar8 = 0x1018; + iVar11 = iVar6; + cVar1 = FUN_1018_0673(param_1,1); + iVar5 = (int)param_2; + uVar7 = (undefined2)((ulong)param_2 >> 0x10); + if ((cVar1 != '\0') && (*(int *)(iVar5 + 6) == 0 && *(int *)(iVar5 + 8) == 0)) { + iVar12 = piVar4[2]; + iVar11 = *(int *)(iVar5 + 4); + uVar8 = 0x1228; + iVar2 = GETDLGITEM(0x1018,iVar11); + if (iVar2 != 0) { + uVar8 = 0x1228; + iVar11 = iVar2; + uVar3 = SENDMESSAGE(0x1228,0,0,0,0x87); + if ((uVar3 & 0x30) != 0) { + *(int *)(iVar5 + 6) = iVar2; + *(undefined2 *)(iVar5 + 8) = 0; + } + } + } + if (*(int *)(iVar5 + 6) == 0) { + if (*(uint *)(iVar5 + 4) < 0x6000) { + local_6 = GETFOCUS(uVar8); + piVar9 = (int *)FUN_1018_0097(local_6); + while (((piVar9 == (int *)0x0 && (local_6 != 0)) && (local_6 != piVar4[2]))) { + local_6 = GETPARENT(0x1018,local_6); + piVar9 = (int *)FUN_1018_0097(local_6); + } + if (piVar9 == (int *)0x0) { + piVar9 = param_1; + } + FUN_1018_08c3(0x10,*(int *)(iVar5 + 4) + -0x6000,iVar5,uVar7,piVar9); + } + else { + (*(code *)*(undefined2 *)(*param_1 + 0xc))(uVar8,param_1,iVar5,uVar7,iVar11,iVar12); + } + } + else { + iVar12 = piVar4[2]; + uVar8 = GETDLGITEM(uVar8,*(undefined2 *)(iVar5 + 4)); + lVar10 = FUN_1018_0097(uVar8); + if ((lVar10 == 0) || (0xfff < *(uint *)(iVar5 + 8))) { + if (*(uint *)(iVar5 + 4) < 0x1000) { + FUN_1018_08c3(0x14,*(int *)(iVar5 + 4) + -0x8000,iVar5,uVar7,param_1); + } + else { + (*(code *)*(undefined2 *)(*param_1 + 0x14))(0x1018,param_1,iVar5,uVar7,iVar12); + } + } + else { + FUN_1018_08c3(0x18,*(int *)(iVar5 + 8) + -0x7000,iVar5,uVar7,lVar10); + } + } + return; +} + + +/* ===== 1018:0a85 FUN_1018_0a85 ===== */ + +void __stdcall16far FUN_1018_0a85(int *param_1,undefined4 param_2) + +{ + uint uVar1; + int iVar2; + undefined2 uVar3; + undefined2 uVar4; + long lVar5; + undefined2 uVar6; + + uVar3 = (undefined2)((ulong)param_2 >> 0x10); + iVar2 = (int)param_2; + uVar4 = (undefined2)((ulong)param_1 >> 0x10); + if (*(int *)(iVar2 + 8) == 0) { + (*(code *)*(undefined2 *)(*param_1 + 0xc))(); + } + else { + lVar5 = FUN_1018_0097(*(undefined2 *)(iVar2 + 8)); + if (lVar5 == 0) { + uVar6 = *(undefined2 *)(iVar2 + 8); + uVar1 = GETWINDOWWORD(0x1018,0xfff4); + if (uVar1 < 0x1000) { + FUN_1018_08c3(0x14,uVar1 + 0x8000,iVar2,uVar3,(int *)param_1,uVar4); + } + else { + (*(code *)*(undefined2 *)(*param_1 + 0x14))(0x1228,(int *)param_1,uVar4,iVar2,uVar3,uVar6); + } + } + else { + FUN_1018_08c3(0x18,*(int *)(iVar2 + 4) + -0x7000,iVar2,uVar3,lVar5); + } + } + return; +} + + +/* ===== 1018:0b25 FUN_1018_0b25 ===== */ + +void __stdcall16far FUN_1018_0b25(int *param_1,undefined4 param_2) + +{ + uint extraout_DX; + int unaff_BP; + int iVar1; + int *piVar2; + undefined2 uVar3; + undefined2 uVar4; + undefined2 unaff_CS; + int iVar5; + undefined2 uVar6; + + iVar1 = unaff_BP + 1; + uVar6 = 0x1028; + uVar3 = (undefined2)((ulong)param_1 >> 0x10); + piVar2 = (int *)param_1; + iVar5 = piVar2[2]; + GETWINDOWLONG(unaff_CS,0xfff0); + uVar4 = (undefined2)((ulong)param_2 >> 0x10); + if ((extraout_DX & 0x20) == 0) { + (*(code *)*(undefined2 *)(*param_1 + 0x48))(0x1228,piVar2,uVar3,(int)param_2,uVar4); + } + else { + (*(code *)*(undefined2 *)(*param_1 + 0xc)) + (0x1228,piVar2,uVar3,(int)param_2,uVar4,iVar5,uVar6,iVar1); + } + return; +} + + +/* ===== 1018:0b6c FUN_1018_0b6c ===== */ + +void __stdcall16far FUN_1018_0b6c(int *param_1,undefined4 param_2) + +{ + uint extraout_DX; + int unaff_BP; + int iVar1; + int *piVar2; + undefined2 uVar3; + undefined2 uVar4; + undefined2 unaff_CS; + int iVar5; + undefined2 uVar6; + + iVar1 = unaff_BP + 1; + uVar6 = 0x1028; + uVar3 = (undefined2)((ulong)param_1 >> 0x10); + piVar2 = (int *)param_1; + iVar5 = piVar2[2]; + GETWINDOWLONG(unaff_CS,0xfff0); + uVar4 = (undefined2)((ulong)param_2 >> 0x10); + if ((extraout_DX & 0x10) == 0) { + (*(code *)*(undefined2 *)(*param_1 + 0x48))(0x1228,piVar2,uVar3,(int)param_2,uVar4); + } + else { + (*(code *)*(undefined2 *)(*param_1 + 0xc)) + (0x1228,piVar2,uVar3,(int)param_2,uVar4,iVar5,uVar6,iVar1); + } + return; +} + + +/* ===== 1018:0bb3 FUN_1018_0bb3 ===== */ + +void __stdcall16far FUN_1018_0bb3(int *param_1,int *param_2) + +{ + int unaff_BP; + int iVar1; + int *piVar2; + int *piVar3; + undefined2 uVar4; + undefined2 uVar5; + undefined2 unaff_CS; + long lVar6; + undefined2 uVar7; + + iVar1 = unaff_BP + 1; + uVar7 = 0x1028; + uVar4 = (undefined2)((ulong)param_1 >> 0x10); + piVar2 = (int *)param_1; + if (*param_2 == piVar2[2]) { + lVar6 = 0; + } + else if (piVar2[3] == 0 && piVar2[4] == 0) { + unaff_CS = 0x1018; + lVar6 = FUN_1018_0097(*param_2); + } + else { + lVar6 = CONCAT22(piVar2[4],piVar2[3]); + } + piVar3 = (int *)param_2; + uVar5 = (undefined2)((ulong)param_2 >> 0x10); + if (lVar6 == 0) { + (*(code *)*(undefined2 *)(*param_1 + 0xc))(unaff_CS,piVar2,uVar4,piVar3,uVar5,0,0,uVar7,iVar1); + } + else { + FUN_1018_08c3(0x10,piVar3[2] + -0x6000,piVar3,uVar5,lVar6); + } + return; +} + + +/* ===== 1018:0c3d FUN_1018_0c3d ===== */ + +void __stdcall16far FUN_1018_0c3d(int *param_1) + +{ + (*(code *)*(undefined2 *)(*param_1 + 0xc))(); + return; +} + + +/* ===== 1018:0c59 FUN_1018_0c59 ===== */ + +void __stdcall16far FUN_1018_0c59(undefined4 param_1,undefined4 param_2) + +{ + int iVar1; + int iVar2; + undefined2 uVar3; + undefined2 uVar4; + undefined2 unaff_CS; + undefined2 uVar5; + + uVar3 = (undefined2)((ulong)param_1 >> 0x10); + iVar1 = (int)param_1; + if (*(int *)(iVar1 + 6) != 0 || *(int *)(iVar1 + 8) != 0) { + uVar4 = (undefined2)((ulong)param_2 >> 0x10); + iVar2 = (int)param_2; + if (*(int *)(iVar2 + 2) == 0x111) { + FUN_1018_08c3(0x14,*(int *)(iVar2 + 4) + -0x8000,iVar2,uVar4,*(undefined2 *)(iVar1 + 6), + *(undefined2 *)(iVar1 + 8)); + } + else { + uVar5 = *(undefined2 *)(iVar1 + 6); + uVar3 = *(undefined2 *)(iVar1 + 4); + iVar1 = GETWINDOWWORD(unaff_CS,0xfff4); + FUN_1018_08c3(0x14,iVar1 + -0x8000,uVar3,iVar2,uVar4,uVar5); + } + } + return; +} + + +/* ===== 1018:0cc7 FUN_1018_0cc7 ===== */ + +void __stdcall16far FUN_1018_0cc7(undefined2 param_1,undefined4 param_2) + +{ + undefined2 uVar1; + + uVar1 = (undefined2)((ulong)param_2 >> 0x10); + if (*(int *)((int)param_2 + 4) != 0) { + FUN_1018_060d((int)param_2,uVar1); + } + return; +} + + +/* ===== 1018:0ce7 FUN_1018_0ce7 ===== */ + +void __stdcall16far FUN_1018_0ce7(undefined4 param_1) + +{ + int *piVar1; + char cVar2; + int unaff_BP; + int iVar3; + int iVar4; + undefined2 uVar5; + long lVar6; + undefined2 uVar7; + + iVar3 = unaff_BP + 1; + uVar7 = 0x1028; + uVar5 = (undefined2)((ulong)param_1 >> 0x10); + iVar4 = (int)param_1; + if (*(int *)(iVar4 + 4) != 0) { + FUN_1018_085a(iVar4,uVar5,0xcc7,0x1018); + cVar2 = FUN_1018_0673(iVar4,uVar5,8); + if (cVar2 != '\0') { + piVar1 = (int *)*(undefined4 *)(iVar4 + 6); + lVar6 = (*(code *)*(undefined2 *)(*piVar1 + 0x30)) + (0x1018,(int *)piVar1,(int)((ulong)piVar1 >> 0x10),uVar7,iVar3); + if (lVar6 != 0) { + piVar1 = (int *)*(undefined4 *)(iVar4 + 6); + (*(code *)*(undefined2 *)(*piVar1 + 0x30)) + (0x1018,(int *)piVar1,(int)((ulong)piVar1 >> 0x10)); + SENDMESSAGE(0x1018,0,0,*(undefined2 *)(iVar4 + 4),0x221); + return; + } + } + DESTROYWINDOW(0x1018,*(undefined2 *)(iVar4 + 4)); + } + return; +} + + +/* ===== 1018:0d6a FUN_1018_0d6a ===== */ + +char * __stdcall16far FUN_1018_0d6a(void) + +{ + return s_TurboWindow_1028_068c; +} + + +/* ===== 1018:0d8a FUN_1018_0d8a ===== */ + +void __stdcall16far FUN_1018_0d8a(void) + +{ + int unaff_BP; + + FUN_1008_2d87(0x1028,unaff_BP + 1); + return; +} + + +/* ===== 1018:0d9b FUN_1018_0d9b ===== */ + +void __stdcall16far FUN_1018_0d9b(int *param_1) + +{ + char cVar1; + int unaff_BP; + int iVar2; + int *piVar3; + undefined2 uVar4; + undefined2 uVar5; + + iVar2 = unaff_BP + 1; + uVar5 = 0x1028; + uVar4 = (undefined2)((ulong)param_1 >> 0x10); + piVar3 = (int *)param_1; + cVar1 = FUN_1018_055c(piVar3,uVar4); + if (cVar1 == '\0') { + piVar3[1] = -4; + } + else { + (*(code *)*(undefined2 *)(*param_1 + 0x44))(0x1018,piVar3,uVar4,2,uVar5,iVar2); + } + return; +} + + +/* ===== 1018:0dcd FUN_1018_0dcd ===== */ + +void __stdcall16far FUN_1018_0dcd(int param_1,int *param_2) + +{ + char cVar1; + int unaff_BP; + int iVar2; + undefined2 uVar3; + undefined2 unaff_SS; + undefined2 uVar4; + + iVar2 = unaff_BP + 1; + uVar4 = 0x1028; + uVar3 = (undefined2)((ulong)param_2 >> 0x10); + cVar1 = FUN_1018_0673((int *)param_2,uVar3,0x10); + if (cVar1 != '\0') { + iVar2 = (*(code *)*(undefined2 *)(*param_2 + 0x40)) + (0x1018,(int *)param_2,uVar3,*(undefined2 *)(param_1 + 10), + *(undefined2 *)(param_1 + -6),*(undefined2 *)(param_1 + -4),uVar4,iVar2); + *(int *)(param_1 + -6) = *(int *)(param_1 + -6) + iVar2; + } + return; +} + + +/* ===== 1018:0e0a FUN_1018_0e0a ===== */ + +void __stdcall16far FUN_1018_0e0a(undefined4 param_1) + +{ + int iVar1; + undefined2 uVar2; + + uVar2 = (undefined2)((ulong)param_1 >> 0x10); + iVar1 = (int)param_1; + if (*(int *)(iVar1 + 0xe) != 0 || *(int *)(iVar1 + 0x10) != 0) { + FUN_1018_085a(iVar1,uVar2,0xdcd,0x1018); + } + return; +} + + +/* ===== 1018:0e46 FUN_1018_0e46 ===== */ + +undefined1 __stdcall16far FUN_1018_0e46(int *param_1) + +{ + int iVar1; + int unaff_BP; + undefined2 unaff_CS; + undefined2 unaff_SS; + undefined4 uVar2; + undefined1 local_20 [27]; + undefined1 local_5; + undefined2 uStack_4; + int iStack_2; + + iStack_2 = unaff_BP + 1; + uStack_4 = 0x1028; + local_5 = 1; + uVar2 = (*(code *)*(undefined2 *)(*param_1 + 0x2c))(); + iVar1 = GETCLASSINFO(unaff_CS,local_20,unaff_SS,uVar2); + if (iVar1 == 0) { + (*(code *)*(undefined2 *)(*param_1 + 0x34)) + (0x1228,(int *)param_1,(int)((ulong)param_1 >> 0x10),local_20); + iVar1 = REGISTERCLASS(0x1228,local_20); + local_5 = iVar1 != 0; + } + return local_5; +} + + +/* ===== 1018:0e9e FUN_1018_0e9e ===== */ + +void __stdcall16far FUN_1018_0e9e(undefined4 param_1,undefined2 param_2) + +{ + undefined2 unaff_CS; + + if (*(int *)((int)param_1 + 4) != 0) { + SHOWWINDOW(unaff_CS,param_2); + } + return; +} + + +/* ===== 1018:0ec0 FUN_1018_0ec0 ===== */ + +undefined1 __stdcall16far FUN_1018_0ec0(undefined2 param_1,int *param_2) + +{ + char cVar1; + + if ((((int *)param_2)[2] != 0) && + (cVar1 = (*(code *)*(undefined2 *)(*param_2 + 0x3c))(), cVar1 == '\0')) { + return 1; + } + return 0; +} + + +/* ===== 1018:0ef4 FUN_1018_0ef4 ===== */ + +uint __stdcall16far FUN_1018_0ef4(undefined4 param_1) + +{ + uint uVar1; + uint uVar2; + undefined4 uVar3; + + uVar3 = FUN_1018_080d((int)param_1,(int)((ulong)param_1 >> 0x10),0xec0,0x1018); + uVar1 = (uint)uVar3 | (uint)((ulong)uVar3 >> 0x10); + uVar2 = uVar1 & 0xff00; + if (uVar1 == 0) { + uVar2 = 1; + } + return uVar2; +} + + +/* ===== 1018:0f22 FUN_1018_0f22 ===== */ + +void __stdcall16far FUN_1018_0f22(undefined4 param_1) + +{ + FUN_1018_0f38((int)param_1,(int)((ulong)param_1 >> 0x10)); + return; +} + + +/* ===== 1018:0f38 FUN_1018_0f38 ===== */ + +void __stdcall16far FUN_1018_0f38(int *param_1) + +{ + int iVar1; + undefined2 uVar2; + char local_5; + + iVar1 = (int)((ulong)param_1 >> 0x10); + uVar2 = (undefined2)((ulong)DAT_1028_064e >> 0x10); + if ((iVar1 == ((int *)DAT_1028_064e)[5]) && ((int *)param_1 == (int *)((int *)DAT_1028_064e)[4])) + { + local_5 = (*(code *)*(undefined2 *)(*DAT_1028_064e + 0x44))(); + } + else { + local_5 = (*(code *)*(undefined2 *)(*param_1 + 0x3c))(); + } + if (local_5 != '\0') { + FUN_1008_2db3((int *)param_1,iVar1); + } + return; +} + + +/* ===== 1018:0f8d FUN_1018_0f8d ===== */ + +void __stdcall16far FUN_1018_0f8d(int *param_1,undefined4 param_2) + +{ + int iVar1; + undefined2 uVar2; + undefined2 unaff_CS; + + iVar1 = (int)((ulong)param_1 >> 0x10); + uVar2 = (undefined2)((ulong)DAT_1028_064e >> 0x10); + if ((iVar1 == *(int *)((int)DAT_1028_064e + 10)) && + ((int *)param_1 == (int *)*(int *)((int)DAT_1028_064e + 8))) { + unaff_CS = 0x1228; + POSTQUITMESSAGE(); + } + (*(code *)*(undefined2 *)(*param_1 + 0xc)) + (unaff_CS,(int *)param_1,iVar1,(int)param_2,(int)((ulong)param_2 >> 0x10)); + return; +} + + +/* ===== 1018:0fcc FUN_1018_0fcc ===== */ + +void __stdcall16far FUN_1018_0fcc(int *param_1,undefined4 param_2) + +{ + int unaff_BP; + int iVar1; + int *piVar2; + undefined2 uVar3; + undefined2 uVar4; + + iVar1 = unaff_BP + 1; + uVar4 = 0x1028; + uVar3 = (undefined2)((ulong)param_1 >> 0x10); + piVar2 = (int *)param_1; + FUN_1018_0071(piVar2[2]); + (*(code *)*(undefined2 *)(*param_1 + 0xc)) + (0x1018,piVar2,uVar3,(int)param_2,(int)((ulong)param_2 >> 0x10),uVar4,iVar1); + piVar2[2] = 0; + return; +} + + +/* ===== 1018:0ffd FUN_1018_0ffd ===== */ + +void __stdcall16far FUN_1018_0ffd(int *param_1,undefined4 param_2) + +{ + char cVar1; + undefined2 uVar2; + undefined2 uVar3; + + uVar2 = (undefined2)((ulong)param_1 >> 0x10); + (*(code *)*(undefined2 *)(*param_1 + 0xc))(); + if (*(int *)((int)param_2 + 4) != 0) { + cVar1 = FUN_1018_0673((int *)param_1,uVar2,1); + uVar3 = (undefined2)((ulong)DAT_1028_064e >> 0x10); + if (cVar1 == '\0') { + FUN_1018_1bdf((int)DAT_1028_064e,uVar3,0,0); + } + else { + FUN_1018_1bdf((int)DAT_1028_064e,uVar3,(int *)param_1,uVar2); + } + } + return; +} + + +/* ===== 1018:1054 FUN_1018_1054 ===== */ + +void __stdcall16far FUN_1018_1054(int *param_1,undefined4 param_2) + +{ + char cVar1; + int iVar2; + undefined2 uVar3; + undefined2 uVar4; + + uVar3 = (undefined2)((ulong)DAT_1028_064e >> 0x10); + iVar2 = (int)param_2; + uVar4 = (undefined2)((ulong)param_2 >> 0x10); + if (((int)((ulong)param_1 >> 0x10) == ((int *)DAT_1028_064e)[5]) && + ((int *)param_1 == (int *)((int *)DAT_1028_064e)[4])) { + cVar1 = (*(code *)*(undefined2 *)(*DAT_1028_064e + 0x44))(); + *(int *)(iVar2 + 10) = (int)cVar1; + *(int *)(iVar2 + 0xc) = (int)cVar1 >> 0xf; + } + else { + cVar1 = (*(code *)*(undefined2 *)(*param_1 + 0x3c))(); + *(int *)(iVar2 + 10) = (int)cVar1; + *(int *)(iVar2 + 0xc) = (int)cVar1 >> 0xf; + } + return; +} + + +/* ===== 1018:10aa FUN_1018_10aa ===== */ + +void __stdcall16far FUN_1018_10aa(int *param_1) + +{ + int iVar1; + undefined2 uVar2; + + iVar1 = (int)((ulong)param_1 >> 0x10); + uVar2 = (undefined2)((ulong)DAT_1028_064e >> 0x10); + if ((iVar1 == *(int *)((int)DAT_1028_064e + 10)) && + ((int *)param_1 == (int *)*(int *)((int)DAT_1028_064e + 8))) { + FUN_1018_0f38((int *)param_1,iVar1); + } + else { + (*(code *)*(undefined2 *)(*param_1 + 0x10))(); + } + return; +} + + +/* ===== 1018:10e9 FUN_1018_10e9 ===== */ + +undefined4 __stdcall16far FUN_1018_10e9(void) + +{ + return 0; +} + + +/* ===== 1018:1106 FUN_1018_1106 ===== */ + +undefined4 __stdcall16far +FUN_1018_1106(undefined4 param_1,undefined2 param_2,undefined2 param_3,undefined2 param_4, + int *param_5) + +{ + int unaff_BP; + int iVar1; + int iVar2; + undefined2 *puVar3; + undefined2 uVar4; + undefined2 uVar5; + bool bVar6; + undefined4 uVar7; + long lVar8; + undefined2 *puVar9; + undefined2 uVar10; + + iVar1 = unaff_BP + 1; + uVar10 = 0x1028; + bVar6 = true; + FUN_1020_03ef(); + if (!bVar6) { + uVar4 = (undefined2)((ulong)param_1 >> 0x10); + iVar2 = (int)param_1; + FUN_1018_0341(iVar2,uVar4,0,(int *)param_5,param_5._2_2_); + puVar9 = (undefined2 *)CONCAT22(uVar4,(undefined2 *)(iVar2 + 0x1d)); + uVar7 = FUN_1008_302c(param_3,param_4); + uVar5 = (undefined2)((ulong)puVar9 >> 0x10); + puVar3 = (undefined2 *)puVar9; + *puVar9 = (int)uVar7; + puVar3[1] = (int)((ulong)uVar7 >> 0x10); + *(undefined2 *)(iVar2 + 0x37) = 0x22c; + *(undefined2 *)(iVar2 + 0x39) = 0x1228; + if ((int *)param_5 == (int *)0x0 && param_5._2_2_ == 0) { + puVar3[2] = 0; + puVar3[3] = 0xcf; + } + else { + lVar8 = (*(code *)*(undefined2 *)(*param_5 + 0x30)) + (0x1008,(int *)param_5,param_5._2_2_,puVar9,uVar10,iVar1); + if (lVar8 == 0) { + uVar10 = (undefined2)((ulong)puVar9 >> 0x10); + ((undefined2 *)puVar9)[2] = 0; + ((undefined2 *)puVar9)[3] = 0x1000; + } + else { + FUN_1018_0641(iVar2,uVar4,1,8); + *(undefined2 *)(iVar2 + 0x37) = 0x2b0; + *(undefined2 *)(iVar2 + 0x39) = 0x1228; + uVar10 = (undefined2)((ulong)puVar9 >> 0x10); + ((undefined2 *)puVar9)[2] = 0; + ((undefined2 *)puVar9)[3] = 0x400; + } + } + uVar10 = (undefined2)((ulong)puVar9 >> 0x10); + puVar3 = (undefined2 *)puVar9; + puVar3[4] = 0; + puVar3[5] = 0; + puVar3[6] = 0x8000; + puVar3[7] = 0; + puVar3[8] = 0x8000; + puVar3[9] = 0; + puVar3[10] = 0; + puVar3[0xb] = 0; + puVar3[0xc] = 0; + *(undefined2 *)(iVar2 + 0x3b) = 0; + *(undefined2 *)(iVar2 + 0x3d) = 0; + *(undefined2 *)(iVar2 + 0x3f) = 0; + } + return param_1; +} + + +/* ===== 1018:121b FUN_1018_121b ===== */ + +void __stdcall16far FUN_1018_121b(undefined4 param_1) + +{ + int *piVar1; + uint uVar2; + int unaff_BP; + int iVar3; + int iVar4; + undefined2 uVar5; + undefined2 uVar6; + + iVar3 = unaff_BP + 1; + uVar6 = 0x1028; + uVar5 = (undefined2)((ulong)param_1 >> 0x10); + iVar4 = (int)param_1; + FUN_1008_3099(*(undefined2 *)(iVar4 + 0x1d),*(undefined2 *)(iVar4 + 0x1f)); + uVar2 = *(uint *)(iVar4 + 0x3b) | *(uint *)(iVar4 + 0x3d); + if (uVar2 != 0) { + piVar1 = (int *)*(undefined4 *)(iVar4 + 0x3b); + (*(code *)*(undefined2 *)(*piVar1 + 8)) + (0x1008,(int *)piVar1,(int)((ulong)piVar1 >> 0x10),CONCAT11((char)(uVar2 >> 8),1), + uVar6,iVar3); + *(undefined2 *)(iVar4 + 0x3b) = 0; + *(undefined2 *)(iVar4 + 0x3d) = 0; + } + FUN_1018_03ff(iVar4,uVar5,0); + FUN_1020_0439(); + return; +} + + +/* ===== 1018:1274 FUN_1018_1274 ===== */ + +void __stdcall16far FUN_1018_1274(int *param_1,undefined2 *param_2) + +{ + undefined2 uVar1; + int unaff_BP; + int iVar2; + undefined2 *puVar3; + undefined2 uVar4; + undefined2 unaff_CS; + undefined4 uVar5; + undefined2 uVar6; + undefined2 uVar7; + undefined2 uVar8; + + iVar2 = unaff_BP + 1; + uVar8 = 0x1028; + uVar4 = (undefined2)((ulong)param_2 >> 0x10); + puVar3 = (undefined2 *)param_2; + puVar3[3] = 0; + puVar3[4] = 0; + puVar3[5] = DAT_1028_06fe; + uVar7 = 0; + uVar1 = LOADICON(unaff_CS,0x7f00,0); + puVar3[6] = uVar1; + uVar6 = 0; + uVar1 = LOADCURSOR(0x1228,0x7f00,0); + puVar3[7] = uVar1; + puVar3[8] = 6; + puVar3[9] = 0; + puVar3[10] = 0; + uVar5 = (*(code *)*(undefined2 *)(*param_1 + 0x2c)) + (0x1228,(int *)param_1,(int)((ulong)param_1 >> 0x10),uVar6,uVar7,uVar8,iVar2); + puVar3[0xb] = (int)uVar5; + puVar3[0xc] = (int)((ulong)uVar5 >> 0x10); + *param_2 = 3; + puVar3[1] = 0x18b; + puVar3[2] = 0x1018; + return; +} + + +/* ===== 1018:12f5 FUN_1018_12f5 ===== */ + +undefined2 __stdcall16far FUN_1018_12f5(undefined4 param_1) + +{ + return *(undefined2 *)((int)param_1 + 0x35); +} + + +/* ===== 1018:1311 FUN_1018_1311 ===== */ + +void __stdcall16far FUN_1018_1311(undefined4 param_1,undefined4 param_2) + +{ + int iVar1; + undefined2 uVar2; + undefined2 uVar3; + undefined2 unaff_CS; + undefined4 uVar4; + + uVar2 = (undefined2)((ulong)param_1 >> 0x10); + uVar3 = (undefined2)((ulong)param_2 >> 0x10); + iVar1 = (int)param_2; + uVar4 = CALLWINDOWPROC(unaff_CS,*(undefined2 *)(iVar1 + 6),*(undefined2 *)(iVar1 + 8), + *(undefined2 *)(iVar1 + 4),*(undefined2 *)(iVar1 + 2), + *(undefined2 *)((int)param_1 + 4),*(undefined2 *)((int)param_1 + 0x37)); + *(undefined2 *)(iVar1 + 10) = (int)uVar4; + *(undefined2 *)(iVar1 + 0xc) = (int)((ulong)uVar4 >> 0x10); + return; +} + + +/* ===== 1018:134f FUN_1018_134f ===== */ + +uint __stdcall16far FUN_1018_134f(int *param_1) + +{ + int *piVar1; + char cVar2; + uint in_AX; + uint uVar3; + int unaff_BP; + int *piVar4; + undefined2 uVar5; + undefined2 unaff_SS; + undefined4 uVar6; + undefined2 uVar7; + int iVar8; + undefined4 local_2a; + undefined4 local_26; + undefined2 local_22; + undefined2 local_20; + undefined2 local_1e; + undefined2 local_1c; + undefined2 local_1a; + undefined2 local_18; + undefined2 local_16; + undefined2 local_14; + undefined2 local_12; + long local_c; + undefined2 local_8; + undefined2 uStack_4; + int iStack_2; + + iStack_2 = unaff_BP + 1; + uStack_4 = 0x1028; + uVar5 = (undefined2)((ulong)param_1 >> 0x10); + piVar4 = (int *)param_1; + if (piVar4[1] == 0) { + FUN_1018_0627(piVar4,uVar5); + if (piVar4[3] == 0 && piVar4[4] == 0) { + local_8 = 0; + } + else { + local_8 = *(undefined2 *)((int)*(undefined4 *)(piVar4 + 3) + 4); + } + cVar2 = FUN_1018_0673(piVar4,uVar5,2); + if (cVar2 == '\0') { + in_AX = (*(code *)*(undefined2 *)(*param_1 + 0x1c))(0x1018,piVar4,uVar5); + if ((char)in_AX != '\0') { + DAT_1028_0676 = piVar4; + DAT_1028_0678 = uVar5; + cVar2 = FUN_1018_0673(piVar4,uVar5,8); + if (cVar2 == '\0') { + local_2a = (undefined2 *)CONCAT22(uVar5,(undefined2 *)((int)piVar4 + 0x1d)); + uVar7 = *(undefined2 *)((int)piVar4 + 0x27); + uVar6 = (*(code *)*(undefined2 *)(*param_1 + 0x2c)) + (0x1018,piVar4,uVar5,*(undefined2 *)((int)piVar4 + 0x25),uVar7); + in_AX = CREATEWINDOWEX(0x1018,*(undefined2 *)((int)piVar4 + 0x31), + *(undefined2 *)((int)piVar4 + 0x33),DAT_1028_06fe, + *(undefined2 *)((int)piVar4 + 0x35),local_8, + *(undefined2 *)((int)piVar4 + 0x2f), + *(undefined2 *)((int)piVar4 + 0x2d), + *(undefined2 *)((int)piVar4 + 0x2b), + *(undefined2 *)((int)piVar4 + 0x29), + *(undefined2 *)((int)piVar4 + 0x21), + *(undefined2 *)((int)piVar4 + 0x23),*local_2a, + *(undefined2 *)((int)piVar4 + 0x1f),uVar6,uVar7); + piVar4[2] = in_AX; + } + else { + local_26 = (*(code *)*(undefined2 *)(*param_1 + 0x2c))(0x1018,piVar4,uVar5); + local_22 = *(undefined2 *)((int)piVar4 + 0x1d); + local_20 = *(undefined2 *)((int)piVar4 + 0x1f); + local_1e = DAT_1028_06fe; + local_1c = *(undefined2 *)((int)piVar4 + 0x29); + local_1a = *(undefined2 *)((int)piVar4 + 0x2b); + local_18 = *(undefined2 *)((int)piVar4 + 0x2d); + local_16 = *(undefined2 *)((int)piVar4 + 0x2f); + local_14 = *(undefined2 *)((int)piVar4 + 0x21); + local_12 = *(undefined2 *)((int)piVar4 + 0x23); + piVar1 = *(int **)(piVar4 + 3); + local_c = (*(code *)*(undefined2 *)(*piVar1 + 0x30)) + (0x1018,(int *)piVar1,(int)((ulong)piVar1 >> 0x10)); + in_AX = 0; + if (local_c != 0) { + in_AX = SENDMESSAGE(0x1018,&local_26,unaff_SS,0,0x220); + piVar4[2] = in_AX; + } + } + } + } + else { + in_AX = GETDLGITEM(0x1018,*(undefined2 *)((int)piVar4 + 0x35)); + piVar4[2] = in_AX; + } + if (piVar4[2] == 0) { + piVar4[1] = -1; + } + else { + uVar6 = FUN_1018_0097(piVar4[2]); + in_AX = (uint)uVar6 | (uint)((ulong)uVar6 >> 0x10); + if (in_AX == 0) { + FUN_1018_0045(piVar4,uVar5,piVar4[2]); + iVar8 = piVar4[2]; + uVar6 = SETWINDOWLONG(0x1018,piVar4[9],piVar4[10],0xfffc); + *(undefined2 *)((int)piVar4 + 0x37) = (int)uVar6; + *(undefined2 *)((int)piVar4 + 0x39) = (int)((ulong)uVar6 >> 0x10); + in_AX = (*(code *)*(undefined2 *)(*param_1 + 0x38))(0x1228,piVar4,uVar5,iVar8); + } + } + } + uVar3 = in_AX & 0xff00; + if (piVar4[1] == 0) { + uVar3 = uVar3 + 1; + } + return uVar3; +} + + +/* ===== 1018:1547 FUN_1018_1547 ===== */ + +void __stdcall16far FUN_1018_1547(undefined4 param_1) + +{ + int iVar1; + int iVar2; + undefined2 uVar3; + + uVar3 = (undefined2)((ulong)param_1 >> 0x10); + iVar2 = (int)param_1; + if (*(int *)(iVar2 + 0x3f) != 0) { + iVar1 = ISWINDOW(); + if (iVar1 != 0) { + iVar1 = ISICONIC(0x1228,*(undefined2 *)(iVar2 + 4)); + if (iVar1 == 0) { + SETFOCUS(0x1228,*(undefined2 *)(iVar2 + 0x3f)); + } + } + } + return; +} + + +/* ===== 1018:1586 FUN_1018_1586 ===== */ + +void __stdcall16far FUN_1018_1586(undefined4 param_1) + +{ + int iVar1; + int iVar2; + undefined2 uVar3; + + iVar1 = GETFOCUS(); + if (iVar1 != 0) { + uVar3 = (undefined2)((ulong)param_1 >> 0x10); + iVar2 = ISCHILD(0x1228,iVar1,*(undefined2 *)((int)param_1 + 4)); + if (iVar2 != 0) { + *(int *)((int)param_1 + 0x3f) = iVar1; + } + } + return; +} + + +/* ===== 1018:15c0 FUN_1018_15c0 ===== */ + +void __stdcall16far FUN_1018_15c0(undefined4 param_1) + +{ + int *piVar1; + char cVar2; + int iVar3; + int unaff_BP; + int iVar4; + undefined2 uVar5; + undefined2 uVar6; + undefined2 unaff_SS; + long lVar7; + undefined2 uVar8; + int local_c; + int local_a; + int local_8; + int local_6; + undefined2 uStack_4; + int iStack_2; + + iStack_2 = unaff_BP + 1; + uStack_4 = 0x1028; + uVar5 = (undefined2)((ulong)param_1 >> 0x10); + iVar4 = (int)param_1; + iVar3 = ISICONIC(); + if (iVar3 != 0) { + return; + } + iVar3 = ISZOOMED(0x1228,*(undefined2 *)(iVar4 + 4)); + if (iVar3 != 0) { + return; + } + uVar8 = *(undefined2 *)(iVar4 + 4); + uVar6 = 0x1228; + GETWINDOWRECT(0x1228,&local_c,unaff_SS); + *(int *)(iVar4 + 0x2d) = local_8 - local_c; + *(int *)(iVar4 + 0x2f) = local_6 - local_a; + if (*(int *)(iVar4 + 6) != 0 || *(int *)(iVar4 + 8) != 0) { + piVar1 = (int *)*(undefined4 *)(iVar4 + 6); + lVar7 = (*(code *)*(undefined2 *)(*piVar1 + 0x30)) + (0x1228,(int *)piVar1,(int)((ulong)piVar1 >> 0x10),uVar8); + if (lVar7 != 0) { + uVar6 = 0x1018; + cVar2 = FUN_1018_0673(iVar4,uVar5,8); + if (cVar2 != '\0') { + SCREENTOCLIENT(0x1018,&local_c,unaff_SS); + goto LAB_1018_1685; + } + } + if ((*(uint *)(iVar4 + 0x23) & 0x4000) != 0) { + SCREENTOCLIENT(uVar6,&local_c,unaff_SS); + } + } +LAB_1018_1685: + *(int *)(iVar4 + 0x29) = local_c; + *(int *)(iVar4 + 0x2b) = local_a; + return; +} + + +/* ===== 1018:169d FUN_1018_169d ===== */ + +void __stdcall16far FUN_1018_169d(undefined4 param_1,undefined4 param_2) + +{ + char cVar1; + undefined2 uVar2; + undefined2 uVar3; + undefined2 uVar4; + + uVar3 = (undefined2)((ulong)param_2 >> 0x10); + uVar4 = (undefined2)((ulong)param_1 >> 0x10); + uVar2 = (undefined2)param_1; + FUN_1018_0ffd(uVar2,uVar4,(int)param_2,uVar3); + cVar1 = FUN_1018_0673(uVar2,uVar4,1); + if (cVar1 != '\0') { + if (*(int *)((int)param_2 + 4) == 0) { + FUN_1018_1586(uVar2,uVar4); + } + else { + FUN_1018_1547(uVar2,uVar4); + } + } + return; +} + + +/* ===== 1018:16eb FUN_1018_16eb ===== */ + +void __stdcall16far FUN_1018_16eb(void) + +{ + FUN_1020_16e1(); + return; +} + + +/* ===== 1018:170c FUN_1018_170c ===== */ + +void __stdcall16far FUN_1018_170c(undefined4 param_1) + +{ + int *piVar1; + char cVar2; + int unaff_BP; + int iVar3; + int iVar4; + undefined2 uVar5; + undefined2 uVar6; + undefined2 uVar7; + + iVar3 = unaff_BP + 1; + uVar7 = 0x1028; + uVar5 = (undefined2)((ulong)param_1 >> 0x10); + iVar4 = (int)param_1; + FUN_1018_0d9b(iVar4,uVar5); + uVar6 = 0x1018; + cVar2 = FUN_1018_0673(iVar4,uVar5,8); + if (cVar2 != '\0') { + uVar6 = 0x1228; + SETFOCUS(0x1018,*(undefined2 *)(iVar4 + 4),uVar7,iVar3); + } + if (*(int *)(iVar4 + 0x3b) != 0 || *(int *)(iVar4 + 0x3d) != 0) { + piVar1 = (int *)*(undefined4 *)(iVar4 + 0x3b); + (*(code *)*(undefined2 *)(*piVar1 + 0x10))(uVar6,(int *)piVar1,(int)((ulong)piVar1 >> 0x10)); + } + FUN_1018_15c0(iVar4,uVar5); + return; +} + + +/* ===== 1018:1761 FUN_1018_1761 ===== */ + +void __stdcall16far FUN_1018_1761(int *param_1) + +{ + (*(code *)*(undefined2 *)(*param_1 + 0x38))(); + (*(code *)*(undefined2 *)(*param_1 + 0xc))(); + return; +} + + +/* ===== 1018:1788 FUN_1018_1788 ===== */ + +void __stdcall16far FUN_1018_1788(int *param_1,undefined4 param_2) + +{ + int *piVar1; + uint extraout_DX; + int unaff_BP; + int iVar2; + int *piVar3; + int iVar4; + undefined2 uVar5; + undefined2 uVar6; + undefined2 unaff_CS; + int iVar7; + undefined2 uVar8; + + iVar2 = unaff_BP + 1; + uVar8 = 0x1028; + uVar5 = (undefined2)((ulong)param_1 >> 0x10); + piVar3 = (int *)param_1; + iVar7 = piVar3[2]; + GETWINDOWLONG(unaff_CS,0xfff0); + iVar4 = (int)param_2; + uVar6 = (undefined2)((ulong)param_2 >> 0x10); + if ((extraout_DX & 0x10) == 0) { + (*(code *)*(undefined2 *)(*param_1 + 0x48))(0x1228,piVar3,uVar5,iVar4,uVar6); + } + else if (*(int *)((int)piVar3 + 0x3b) == 0 && *(int *)((int)piVar3 + 0x3d) == 0) { + (*(code *)*(undefined2 *)(*param_1 + 0xc))(0x1228,piVar3,uVar5,iVar4,uVar6,iVar7,uVar8,iVar2); + } + else { + piVar1 = (int *)*(undefined4 *)((int)piVar3 + 0x3b); + (*(code *)*(undefined2 *)(*piVar1 + 0x20)) + (0x1228,(int *)piVar1,(int)((ulong)piVar1 >> 0x10),*(undefined2 *)(iVar4 + 6), + *(undefined2 *)(iVar4 + 4)); + } + return; +} + + +/* ===== 1018:17f8 FUN_1018_17f8 ===== */ + +void __stdcall16far FUN_1018_17f8(int *param_1,undefined4 param_2) + +{ + int *piVar1; + uint extraout_DX; + int unaff_BP; + int iVar2; + int *piVar3; + int iVar4; + undefined2 uVar5; + undefined2 uVar6; + undefined2 unaff_CS; + int iVar7; + undefined2 uVar8; + + iVar2 = unaff_BP + 1; + uVar8 = 0x1028; + uVar5 = (undefined2)((ulong)param_1 >> 0x10); + piVar3 = (int *)param_1; + iVar7 = piVar3[2]; + GETWINDOWLONG(unaff_CS,0xfff0); + iVar4 = (int)param_2; + uVar6 = (undefined2)((ulong)param_2 >> 0x10); + if ((extraout_DX & 0x20) == 0) { + (*(code *)*(undefined2 *)(*param_1 + 0x48))(0x1228,piVar3,uVar5,iVar4,uVar6); + } + else if (*(int *)((int)piVar3 + 0x3b) == 0 && *(int *)((int)piVar3 + 0x3d) == 0) { + (*(code *)*(undefined2 *)(*param_1 + 0xc))(0x1228,piVar3,uVar5,iVar4,uVar6,iVar7,uVar8,iVar2); + } + else { + piVar1 = (int *)*(undefined4 *)((int)piVar3 + 0x3b); + (*(code *)*(undefined2 *)(*piVar1 + 0x1c)) + (0x1228,(int *)piVar1,(int)((ulong)piVar1 >> 0x10),*(undefined2 *)(iVar4 + 6), + *(undefined2 *)(iVar4 + 4)); + } + return; +} + + +/* ===== 1018:1868 FUN_1018_1868 ===== */ + +void __stdcall16far FUN_1018_1868(int *param_1) + +{ + int *piVar1; + int unaff_BP; + int *piVar2; + undefined2 uVar3; + undefined2 unaff_CS; + undefined2 unaff_SS; + undefined1 local_24 [32]; + undefined2 uStack_4; + int iStack_2; + + iStack_2 = unaff_BP + 1; + uStack_4 = 0x1028; + uVar3 = (undefined2)((ulong)param_1 >> 0x10); + piVar2 = (int *)param_1; + BEGINPAINT(unaff_CS,local_24,unaff_SS,piVar2[2]); + if (*(int *)((int)piVar2 + 0x3b) != 0 || *(int *)((int)piVar2 + 0x3d) != 0) { + piVar1 = (int *)*(undefined4 *)((int)piVar2 + 0x3b); + (*(code *)*(undefined2 *)(*piVar1 + 0x14)) + (0x1228,(int *)piVar1,(int)((ulong)piVar1 >> 0x10),local_24); + } + (*(code *)*(undefined2 *)(*param_1 + 0x4c))(0x1228,piVar2,uVar3,local_24); + if (*(int *)((int)piVar2 + 0x3b) != 0 || *(int *)((int)piVar2 + 0x3d) != 0) { + piVar1 = (int *)*(undefined4 *)((int)piVar2 + 0x3b); + (*(code *)*(undefined2 *)(*piVar1 + 0x18))(0x1228,(int *)piVar1,(int)((ulong)piVar1 >> 0x10)); + } + ENDPAINT(0x1228,local_24,unaff_SS); + return; +} + + +/* ===== 1018:18e9 FUN_1018_18e9 ===== */ + +void __stdcall16far FUN_1018_18e9(int *param_1,undefined4 param_2) + +{ + undefined2 *puVar1; + int unaff_BP; + int *piVar2; + int iVar3; + undefined2 uVar4; + undefined2 uVar5; + undefined2 unaff_CS; + undefined2 uVar6; + undefined2 unaff_SS; + int local_c; + int local_a; + int local_8; + int local_6; + undefined2 uStack_4; + int iStack_2; + + iStack_2 = unaff_BP + 1; + uStack_4 = 0x1028; + uVar4 = (undefined2)((ulong)param_1 >> 0x10); + piVar2 = (int *)param_1; + iVar3 = (int)param_2; + uVar5 = (undefined2)((ulong)param_2 >> 0x10); + if ((*(int *)((int)piVar2 + 0x3b) != 0 || *(int *)((int)piVar2 + 0x3d) != 0) && + (*(int *)(iVar3 + 4) != 1)) { + puVar1 = (undefined2 *)(*(int *)*(undefined4 *)((int)piVar2 + 0x3b) + 0xc); + (*(code *)*puVar1)(); + } + uVar6 = unaff_CS; + if (*(int *)(iVar3 + 4) == 0) { + uVar6 = 0x1228; + GETWINDOWRECT(unaff_CS,&local_c,unaff_SS); + *(int *)((int)piVar2 + 0x2f) = local_6 - local_a; + *(int *)((int)piVar2 + 0x2d) = local_8 - local_c; + } + (*(code *)*(undefined2 *)(*param_1 + 0xc))(uVar6,piVar2,uVar4,iVar3,uVar5); + return; +} + + +/* ===== 1018:1960 FUN_1018_1960 ===== */ + +void __stdcall16far FUN_1018_1960(int *param_1,undefined4 param_2) + +{ + int unaff_BP; + int iVar1; + undefined2 uVar2; + undefined2 uVar3; + + iVar1 = unaff_BP + 1; + uVar3 = 0x1028; + uVar2 = (undefined2)((ulong)param_1 >> 0x10); + FUN_1018_15c0((int *)param_1,uVar2); + (*(code *)*(undefined2 *)(*param_1 + 0xc)) + (0x1018,(int *)param_1,uVar2,(int)param_2,(int)((ulong)param_2 >> 0x10),uVar3,iVar1); + return; +} + + +/* ===== 1018:1986 FUN_1018_1986 ===== */ + +void __stdcall16far FUN_1018_1986(int *param_1,undefined4 param_2) + +{ + int *piVar1; + int iVar2; + int unaff_BP; + int *piVar3; + undefined2 uVar4; + undefined2 unaff_CS; + undefined2 unaff_SS; + int iVar5; + undefined1 local_16 [2]; + int local_14; + undefined2 uStack_4; + int iStack_2; + + iStack_2 = unaff_BP + 1; + uStack_4 = 0x1028; + uVar4 = (undefined2)((ulong)param_1 >> 0x10); + piVar3 = (int *)param_1; + if ((*(int *)((int)piVar3 + 0x3b) != 0 || *(int *)((int)piVar3 + 0x3d) != 0) && + (*(char *)((int)*(undefined4 *)((int)piVar3 + 0x3b) + 0x22) != '\0')) { + iVar5 = piVar3[2]; + SETCAPTURE(); + do { + iVar2 = PEEKMESSAGE(0x1228,1,0,0,0,local_16,unaff_SS); + if (iVar2 != 0) { + TRANSLATEMESSAGE(0x1228,local_16); + DISPATCHMESSAGE(0x1228,local_16); + } + piVar1 = (int *)*(undefined4 *)((int)piVar3 + 0x3b); + (*(code *)*(undefined2 *)(*piVar1 + 0x24)) + (0x1228,(int *)piVar1,(int)((ulong)piVar1 >> 0x10),iVar5); + } while (local_14 != 0x202); + unaff_CS = 0x1228; + RELEASECAPTURE(0x1228); + } + (*(code *)*(undefined2 *)(*param_1 + 0xc)) + (unaff_CS,piVar3,uVar4,(int)param_2,(int)((ulong)param_2 >> 0x10)); + return; +} + + +/* ===== 1018:1a0e FUN_1018_1a0e ===== */ + +void __stdcall16far FUN_1018_1a0e(int *param_1,undefined4 param_2) + +{ + int iVar1; + char cVar2; + int unaff_BP; + int iVar3; + int *piVar4; + undefined2 uVar5; + undefined2 uVar6; + undefined2 uVar7; + + iVar3 = unaff_BP + 1; + uVar7 = 0x1028; + uVar5 = (undefined2)((ulong)param_1 >> 0x10); + piVar4 = (int *)param_1; + cVar2 = FUN_1018_0673(piVar4,uVar5,1); + uVar6 = (undefined2)((ulong)param_2 >> 0x10); + if (cVar2 != '\0') { + iVar1 = *(int *)((int)param_2 + 4); + if (iVar1 == -0xfe0) { + FUN_1018_1586(piVar4,uVar5); + } + else if (iVar1 == -0xee0) { + FUN_1018_1547(piVar4,uVar5); + } + } + (*(code *)*(undefined2 *)(*param_1 + 0xc))(0x1018,piVar4,uVar5,(int)param_2,uVar6,uVar7,iVar3); + return; +} + + +/* ===== 1018:1a61 FUN_1018_1a61 ===== */ + +int * __stdcall16far FUN_1018_1a61(int *param_1,undefined2 param_2,int param_3,int param_4) + +{ + int unaff_BP; + int *piVar1; + undefined2 uVar2; + bool bVar3; + undefined4 uVar4; + undefined2 uVar5; + + bVar3 = true; + FUN_1020_03ef(0x1028,unaff_BP + 1); + if (!bVar3) { + uVar2 = (undefined2)((ulong)param_1 >> 0x10); + piVar1 = (int *)param_1; + FUN_1008_2d99(piVar1,uVar2,0); + piVar1[2] = param_3; + piVar1[3] = param_4; + DAT_1028_064e._0_2_ = piVar1; + DAT_1028_064e._2_2_ = uVar2; + piVar1[6] = 0; + piVar1[1] = 0; + piVar1[4] = 0; + piVar1[5] = 0; + piVar1[7] = 0; + piVar1[8] = 0; + uVar5 = 0x1018; + uVar4 = MAKEPROCINSTANCE(0x1008,DAT_1028_06fe,0x133); + DAT_1028_0674 = (undefined2)((ulong)uVar4 >> 0x10); + DAT_1028_0672 = (undefined2)uVar4; + FUN_1008_2e76(uVar5); + if (DAT_1028_06fc == 0) { + (*(code *)*(undefined2 *)(*param_1 + 0x10))(0x1008,piVar1,uVar2); + } + if (piVar1[1] == 0) { + (*(code *)*(undefined2 *)(*param_1 + 0x14))(0x1008,piVar1,uVar2); + } + } + return param_1; +} + + +/* ===== 1018:1b08 FUN_1018_1b08 ===== */ + +void __stdcall16far FUN_1018_1b08(undefined4 param_1) + +{ + int unaff_BP; + int iVar1; + undefined2 unaff_CS; + undefined2 uVar2; + undefined2 uVar3; + + iVar1 = unaff_BP + 1; + uVar3 = 0x1028; + uVar2 = DAT_1028_0674; + FREEPROCINSTANCE(unaff_CS,DAT_1028_0672); + FUN_1008_2dcd((int)param_1,(int)((ulong)param_1 >> 0x10),0); + FUN_1020_0439(uVar2,uVar3,iVar1); + return; +} + + +/* ===== 1018:1b35 FUN_1018_1b35 ===== */ + +undefined1 __stdcall16far FUN_1018_1b35(void) + +{ + return 0; +} + + +/* ===== 1018:1b4b FUN_1018_1b4b ===== */ + +void __stdcall16far FUN_1018_1b4b(void) + +{ + return; +} + + +/* ===== 1018:1b57 FUN_1018_1b57 ===== */ + +void __stdcall16far FUN_1018_1b57(int *param_1) + +{ + int *piVar1; + undefined2 uVar2; + undefined4 uVar3; + + uVar2 = (undefined2)((ulong)param_1 >> 0x10); + piVar1 = (int *)param_1; + (*(code *)*(undefined2 *)(*param_1 + 0x18))(); + uVar3 = (*(code *)*(undefined2 *)(*param_1 + 0x34))(); + piVar1[4] = (int)uVar3; + piVar1[5] = (int)((ulong)uVar3 >> 0x10); + if (piVar1[4] == 0 && piVar1[5] == 0) { + piVar1[1] = -5; + } + else { + FUN_1018_0e9e((int)*(undefined4 *)(piVar1 + 4),(int)((ulong)*(undefined4 *)(piVar1 + 4) >> 0x10) + ,DAT_1028_0700); + } + return; +} + + +/* ===== 1018:1bb0 FUN_1018_1bb0 ===== */ + +void __stdcall16far FUN_1018_1bb0(int *param_1) + +{ + if (((int *)param_1)[1] == 0) { + (*(code *)*(undefined2 *)(*param_1 + 0x20))(); + } + else { + (*(code *)*(undefined2 *)(*param_1 + 0x40))(); + } + return; +} + + +/* ===== 1018:1bdf FUN_1018_1bdf ===== */ + +void __stdcall16far FUN_1018_1bdf(undefined4 param_1,undefined2 param_2,undefined2 param_3) + +{ + undefined2 uVar1; + + uVar1 = (undefined2)((ulong)param_1 >> 0x10); + *(undefined2 *)((int)param_1 + 0xe) = param_2; + *(undefined2 *)((int)param_1 + 0x10) = param_3; + return; +} + + +/* ===== 1018:1bfc FUN_1018_1bfc ===== */ + +void __stdcall16far FUN_1018_1bfc(int *param_1) + +{ + char cVar1; + char cVar2; + int iVar3; + int unaff_BP; + int *piVar4; + undefined2 uVar5; + undefined2 unaff_CS; + undefined2 unaff_SS; + undefined1 local_16 [2]; + int local_14; + int local_12; + undefined2 uStack_4; + int iStack_2; + + iStack_2 = unaff_BP + 1; + uStack_4 = 0x1028; + cVar1 = '\0'; + do { + iVar3 = PEEKMESSAGE(unaff_CS,1,0,0,0,local_16,unaff_SS); + piVar4 = (int *)param_1; + uVar5 = (undefined2)((ulong)param_1 >> 0x10); + if (iVar3 == 0) { + cVar2 = (*(code *)*(undefined2 *)(*param_1 + 0xc))(0x1228,piVar4,uVar5); + if (cVar2 == '\0') { + cVar1 = '\x12'; + WAITMESSAGE(); + } + } + else if (local_14 == 0x12) { + cVar1 = '\x01'; + } + else { + cVar2 = (*(code *)*(undefined2 *)(*param_1 + 0x24))(0x1228,piVar4,uVar5,local_16); + if (cVar2 == '\0') { + TRANSLATEMESSAGE(0x1228,local_16); + DISPATCHMESSAGE(0x1228,local_16); + } + } + unaff_CS = 0x1228; + } while (cVar1 == '\0'); + piVar4[1] = local_12; + return; +} + + +/* ===== 1018:1c7f FUN_1018_1c7f ===== */ + +undefined1 __stdcall16far FUN_1018_1c7f(int *param_1) + +{ + char cVar1; + + cVar1 = (*(code *)*(undefined2 *)(*param_1 + 0x28))(); + if (((cVar1 == '\0') && (cVar1 = (*(code *)*(undefined2 *)(*param_1 + 0x30))(), cVar1 == '\0')) && + (cVar1 = (*(code *)*(undefined2 *)(*param_1 + 0x2c))(), cVar1 == '\0')) { + return 0; + } + return 1; +} + + +/* ===== 1018:1cd6 FUN_1018_1cd6 ===== */ + +undefined2 __stdcall16far FUN_1018_1cd6(undefined4 param_1,undefined4 param_2) + +{ + uint uVar1; + int iVar2; + undefined2 uVar3; + undefined2 unaff_CS; + undefined1 local_5; + + local_5 = false; + uVar3 = (undefined2)((ulong)param_1 >> 0x10); + iVar2 = (int)param_1; + uVar1 = *(uint *)(iVar2 + 0xe) | *(uint *)(iVar2 + 0x10); + if ((uVar1 != 0) && (*(int *)((int)*(undefined4 *)(iVar2 + 0xe) + 4) != 0)) { + iVar2 = ISDIALOGMESSAGE(unaff_CS,(int)param_2,(int)((ulong)param_2 >> 0x10)); + local_5 = iVar2 != 0; + uVar1 = CONCAT11((char)((uint)-iVar2 >> 8),local_5); + } + return CONCAT11((char)(uVar1 >> 8),local_5); +} + + +/* ===== 1018:1d22 FUN_1018_1d22 ===== */ + +undefined2 __stdcall16far FUN_1018_1d22(undefined4 param_1,undefined4 param_2) + +{ + int iVar1; + undefined2 uVar2; + undefined2 unaff_CS; + + uVar2 = (undefined2)((ulong)param_1 >> 0x10); + if (*(int *)((int)param_1 + 0xc) != 0) { + iVar1 = TRANSLATEACCELERATOR + (unaff_CS,(int)param_2,(int)((ulong)param_2 >> 0x10), + *(undefined2 *)((int)param_1 + 0xc)); + if (iVar1 != 0) { + return 1; + } + } + return 0; +} + + +/* ===== 1018:1d64 FUN_1018_1d64 ===== */ + +undefined2 __stdcall16far FUN_1018_1d64(undefined4 param_1,undefined4 param_2) + +{ + undefined2 *puVar1; + int iVar2; + undefined2 unaff_CS; + long lVar3; + + puVar1 = (undefined2 *)(*(int *)*(undefined4 *)((int)param_1 + 8) + 0x30); + lVar3 = (*(code *)*puVar1)(); + if ((lVar3 != 0) && + (iVar2 = TRANSLATEMDISYSACCEL(unaff_CS,(int)param_2,(int)((ulong)param_2 >> 0x10)), iVar2 != 0) + ) { + return 1; + } + return 0; +} + + +/* ===== 1018:1db1 FUN_1018_1db1 ===== */ + +int * __stdcall16far FUN_1018_1db1(int *param_1,int *param_2) + +{ + char cVar1; + undefined1 extraout_AH; + undefined1 extraout_AH_00; + int unaff_BP; + undefined2 uVar2; + int *piVar3; + int *piVar4; + int iVar5; + int iVar6; + + piVar3 = (int *)0x0; + iVar5 = 0; + piVar4 = piVar3; + iVar6 = iVar5; + if ((int *)param_2 != (int *)0x0 || param_2._2_2_ != 0) { + cVar1 = FUN_1008_2de0(0,0,0x1028,unaff_BP + 1); + uVar2 = (undefined2)((ulong)param_1 >> 0x10); + if (cVar1 == '\0') { + piVar4 = (int *)param_2; + iVar6 = param_2._2_2_; + if (((int *)param_2)[1] != 0) { + (*(code *)*(undefined2 *)(*param_1 + 0x40))(0x1008,(int *)param_1,uVar2,((int *)param_2)[1]) + ; + (*(code *)*(undefined2 *)(*param_2 + 8)) + (0x1008,(int *)param_2,param_2._2_2_,CONCAT11(extraout_AH_00,1)); + piVar4 = piVar3; + iVar6 = iVar5; + } + } + else { + (*(code *)*(undefined2 *)(*param_1 + 0x40))(0x1008,(int *)param_1,uVar2,0xfffe); + (*(code *)*(undefined2 *)(*param_2 + 8)) + (0x1008,(int *)param_2,param_2._2_2_,CONCAT11(extraout_AH,1)); + FUN_1008_2dff(); + piVar4 = piVar3; + iVar6 = iVar5; + } + } + return (int *)CONCAT22(iVar6,piVar4); +} + + +/* ===== 1018:1e39 FUN_1018_1e39 ===== */ + +int * __stdcall16far FUN_1018_1e39(int *param_1,int *param_2) + +{ + char cVar1; + long lVar2; + int *local_8; + int local_6; + + local_8 = (int *)0x0; + local_6 = 0; + if ((int *)param_2 != (int *)0x0 || param_2._2_2_ != 0) { + lVar2 = (*(code *)*(undefined2 *)(*param_1 + 0x3c))(); + if (lVar2 != 0) { + cVar1 = (*(code *)*(undefined2 *)(*param_2 + 0x20))(); + if (cVar1 == '\0') { + (*(code *)*(undefined2 *)(*param_1 + 0x40))(); + (*(code *)*(undefined2 *)(*param_2 + 8))(); + } + else { + local_8 = (int *)param_2; + local_6 = param_2._2_2_; + } + } + } + return (int *)CONCAT22(local_6,local_8); +} + + +/* ===== 1018:1eb0 FUN_1018_1eb0 ===== */ + +int __stdcall16far FUN_1018_1eb0(int *param_1,int *param_2) + +{ + int iVar1; + long lVar2; + int local_6; + + local_6 = 2; + lVar2 = (*(code *)*(undefined2 *)(*param_1 + 0x3c))(); + if (lVar2 != 0) { + iVar1 = (*(code *)*(undefined2 *)(*param_2 + 0x4c))(); + if (iVar1 < 0) { + (*(code *)*(undefined2 *)(*param_1 + 0x40))(); + iVar1 = local_6; + } + local_6 = iVar1; + (*(code *)*(undefined2 *)(*param_2 + 8))(); + } + return local_6; +} + + +/* ===== 1018:1f14 FUN_1018_1f14 ===== */ + +void __stdcall16far FUN_1018_1f14(void) + +{ + int iVar1; + int unaff_BP; + undefined2 unaff_CS; + undefined2 unaff_SS; + undefined1 local_24 [32]; + undefined2 uStack_4; + int iStack_2; + + iStack_2 = unaff_BP + 1; + uStack_4 = 0x1028; + WVSPRINTF(unaff_CS,&stack0x0008,unaff_SS,0x698,0x1028,local_24); + iVar1 = (*DAT_1028_0666)(0x1228,0x14,0x6b3,0x1028,local_24); + if (iVar1 == 7) { + FUN_1020_0061(0x1228); + } + return; +} + + +/* ===== 1018:1f56 FUN_1018_1f56 ===== */ + +undefined1 __stdcall16far FUN_1018_1f56(undefined4 param_1) + +{ + undefined2 *puVar1; + undefined1 uVar2; + + puVar1 = (undefined2 *)(*(int *)*(undefined4 *)((int)param_1 + 8) + 0x3c); + uVar2 = (*(code *)*puVar1)(); + return uVar2; +} + + +/* ===== 1020:0002 FUN_1020_0002 ===== */ + +/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */ + +void __cdecl16far FUN_1020_0002(void) + +{ + code *pcVar1; + int in_AX; + int iVar2; + uint uVar3; + undefined2 in_DX; + undefined2 in_BX; + int unaff_BP; + int iVar4; + undefined2 unaff_SI; + undefined2 unaff_DI; + int unaff_ES; + undefined2 unaff_CS; + undefined2 uVar5; + int iVar6; + + iVar4 = unaff_BP + 1; + iVar6 = 0x1028; + if (in_AX != 0) { + uVar5 = 0; + DAT_1028_06fc = unaff_SI; + DAT_1028_06fe = unaff_DI; + DAT_1028_0700 = in_DX; + DAT_1028_0702._0_2_ = in_BX; + DAT_1028_0702._2_2_ = unaff_ES; + DAT_1028_071c = unaff_ES; + WAITEVENT(); + unaff_CS = 0x1228; + iVar2 = INITAPP(0x1228,DAT_1028_06fe,uVar5); + if (iVar2 != 0) { + uVar3 = GETWINFLAGS(0x1228); + DAT_1028_0726 = 0; + if (((uVar3 & 0xc0) == 0) && (DAT_1028_0726 = 1, (uVar3 & 2) == 0)) { + DAT_1028_0726 = 2; + } + DAT_1028_0724 = 0x6c; + return; + } + } + pcVar1 = (code *)swi(0x21); + _DAT_1028_0716 = (*pcVar1)(); + DAT_1028_0718 = iVar6; + if ((DAT_1028_0718 != 0 || iVar4 != 0) && (iVar4 != -1)) { + iVar4 = *(int *)0x0; + } + DAT_1028_071a = iVar4; + if (DAT_1028_071c != 0) { + FUN_1020_00d2(); + } + if (DAT_1028_0718 != 0 || DAT_1028_071a != 0) { + FUN_1020_00f0(); + FUN_1020_00f0(); + FUN_1020_00f0(); + MESSAGEBOX(unaff_CS,0x1010,0,0,0x728,0x1028); + } + pcVar1 = (code *)swi(0x21); + (*pcVar1)(); + if ((int)((ulong)_DAT_1028_0712 >> 0x10) != 0 || (int)_DAT_1028_0712 != 0) { + _DAT_1028_0712 = 0; + DAT_1028_071e = 0; + return; + } + return; +} + + +/* ===== 1020:005d FUN_1020_005d ===== */ + +/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */ + +void FUN_1020_005d(int param_1) + +{ + code *pcVar1; + undefined2 in_AX; + undefined2 unaff_CS; + int in_stack_00000000; + + if ((in_stack_00000000 != 0 || param_1 != 0) && (param_1 != -1)) { + param_1 = *(int *)0x0; + } + _DAT_1028_0716 = in_AX; + DAT_1028_0718 = in_stack_00000000; + DAT_1028_071a = param_1; + if (DAT_1028_071c != 0) { + FUN_1020_00d2(); + } + if (DAT_1028_0718 != 0 || DAT_1028_071a != 0) { + FUN_1020_00f0(); + FUN_1020_00f0(); + FUN_1020_00f0(); + MESSAGEBOX(unaff_CS,0x1010,0,0,0x728); + } + pcVar1 = (code *)swi(0x21); + (*pcVar1)(); + if ((int)((ulong)_DAT_1028_0712 >> 0x10) != 0 || (int)_DAT_1028_0712 != 0) { + _DAT_1028_0712 = 0; + DAT_1028_071e = 0; + return; + } + return; +} + + +/* ===== 1020:0061 FUN_1020_0061 ===== */ + +/* WARNING: Removing unreachable block (ram,0x1020006e) */ +/* WARNING: Removing unreachable block (ram,0x10200073) */ +/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */ + +void FUN_1020_0061(void) + +{ + code *pcVar1; + undefined2 in_AX; + undefined2 unaff_CS; + + DAT_1028_0718 = 0; + DAT_1028_071a = 0; + _DAT_1028_0716 = in_AX; + if (DAT_1028_071c != 0) { + FUN_1020_00d2(); + } + if (DAT_1028_0718 != 0 || DAT_1028_071a != 0) { + FUN_1020_00f0(); + FUN_1020_00f0(); + FUN_1020_00f0(); + MESSAGEBOX(unaff_CS,0x1010,0,0,0x728,0x1028); + } + pcVar1 = (code *)swi(0x21); + (*pcVar1)(); + if ((int)((ulong)_DAT_1028_0712 >> 0x10) == 0 && (int)_DAT_1028_0712 == 0) { + return; + } + _DAT_1028_0712 = 0; + DAT_1028_071e = 0; + return; +} + + +/* ===== 1020:00d2 FUN_1020_00d2 ===== */ + +/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */ + +void __cdecl16near FUN_1020_00d2(void) + +{ + if ((int)((ulong)_DAT_1028_0712 >> 0x10) != 0 || (int)_DAT_1028_0712 != 0) { + _DAT_1028_0712 = 0; + DAT_1028_071e = 0; + return; + } + return; +} + + +/* ===== 1020:00f0 FUN_1020_00f0 ===== */ + +void __cdecl16near FUN_1020_00f0(void) + +{ + uint in_AX; + uint uVar1; + uint in_CX; + byte bVar2; + byte *in_BX; + char cVar3; + + do { + uVar1 = in_AX / in_CX; + cVar3 = (char)(in_AX % in_CX); + bVar2 = cVar3 + 0x30; + if (0x39 < bVar2) { + bVar2 = cVar3 + 0x37; + } + in_BX = in_BX + -1; + *in_BX = bVar2; + in_AX = uVar1; + } while (uVar1 != 0); + return; +} + + +/* ===== 1020:012d FUN_1020_012d ===== */ + +void __stdcall16far FUN_1020_012d(void) + +{ + int unaff_BP; + undefined1 in_CF; + + FUN_1020_01ca(0x1028,unaff_BP + 1); + if (!(bool)in_CF) { + return; + } + FUN_1020_005d(); + return; +} + + +/* ===== 1020:0147 FUN_1020_0147 ===== */ + +void __stdcall16far FUN_1020_0147(void) + +{ + int unaff_BP; + undefined1 in_CF; + + FUN_1020_02d7(0x1028,unaff_BP + 1); + if (!(bool)in_CF) { + return; + } + FUN_1020_005d(); + return; +} + + +/* ===== 1020:0167 FUN_1020_0167 ===== */ + +int __cdecl16far FUN_1020_0167(void) + +{ + int iVar1; + int iVar2; + + iVar1 = GETFREESPACE(); + iVar2 = DAT_1028_0706; + if (DAT_1028_0706 != 0) { + do { + iVar1 = iVar1 + *(int *)0x8; + iVar2 = *(int *)0xa; + } while (iVar2 != DAT_1028_0706); + } + return iVar1; +} + + +/* ===== 1020:01ca FUN_1020_01ca ===== */ + +void __cdecl16near FUN_1020_01ca(void) + +{ + uint uVar1; + uint in_AX; + uint uVar2; + undefined1 uVar3; + + uVar1 = in_AX; + if (in_AX != 0) { + do { + DAT_1028_4d38 = uVar1; + uVar3 = DAT_1028_4d38 < DAT_1028_0708; + if ((bool)uVar3) { + FUN_1020_023c(); + if (!(bool)uVar3) { + return; + } + FUN_1020_0222(); +LAB_1020_0201: + if (!(bool)uVar3) { + return; + } + } + else { + FUN_1020_0222(); + if (!(bool)uVar3) { + return; + } + if ((DAT_1028_0708 != 0) && + (uVar3 = DAT_1028_4d38 < DAT_1028_070a - 0xcU, DAT_1028_4d38 <= DAT_1028_070a - 0xcU)) { + FUN_1020_023c(); + goto LAB_1020_0201; + } + } + uVar2 = 0; + if (DAT_1028_070e != (code *)0x0 || DAT_1028_0710 != 0) { + uVar2 = (*DAT_1028_070e)(); + } + uVar1 = DAT_1028_4d38; + } while (1 < uVar2); + } + return; +} + + +/* ===== 1020:0222 FUN_1020_0222 ===== */ + +void __cdecl16near FUN_1020_0222(void) + +{ + undefined2 in_AX; + int iVar1; + undefined2 unaff_CS; + undefined2 uVar2; + + uVar2 = DAT_1028_070c; + iVar1 = GLOBALALLOC(unaff_CS,in_AX,0); + if (iVar1 != 0) { + GLOBALLOCK(0x1228,iVar1,uVar2); + } + return; +} + + +/* ===== 1020:023c FUN_1020_023c ===== */ + +undefined2 __cdecl16near FUN_1020_023c(void) + +{ + uint uVar1; + undefined2 uVar2; + undefined2 in_BX; + uint unaff_ES; + bool bVar3; + + bVar3 = false; + uVar1 = DAT_1028_0706; + if (DAT_1028_0706 != 0) { + do { + unaff_ES = uVar1; + FUN_1020_02a6(); + if (!bVar3) { + DAT_1028_0706 = unaff_ES; + return in_BX; + } + uVar1 = *(uint *)0xa; + bVar3 = uVar1 < DAT_1028_0706; + } while (uVar1 != DAT_1028_0706); + } + uVar2 = FUN_1020_026a(); + if (!bVar3) { + uVar2 = in_BX; + FUN_1020_02a6(); + DAT_1028_0706 = unaff_ES; + } + return uVar2; +} + + +/* ===== 1020:026a FUN_1020_026a ===== */ + +undefined2 __cdecl16near FUN_1020_026a(void) + +{ + undefined2 in_AX; + int iVar1; + undefined2 uVar2; + undefined2 extraout_DX; + undefined1 in_CF; + + FUN_1020_0222(); + if (!(bool)in_CF) { + *(undefined2 *)0x0 = 0x5054; + *(undefined2 *)0x2 = 0; + *(undefined2 *)0x4 = 0xc; + *(undefined2 *)0x6 = 0; + iVar1 = DAT_1028_070a + -0xc; + *(int *)0x8 = iVar1; + uVar2 = extraout_DX; + if (DAT_1028_0706 != 0) { + LOCK(); + uVar2 = *(undefined2 *)0xa; + *(undefined2 *)0xa = extraout_DX; + UNLOCK(); + } + *(undefined2 *)0xa = uVar2; + *(undefined2 *)0xc = 0; + *(int *)0xe = iVar1; + } + return in_AX; +} + + +/* ===== 1020:02a6 FUN_1020_02a6 ===== */ + +void __cdecl16near FUN_1020_02a6(void) + +{ + int *piVar1; + uint in_AX; + int iVar2; + int *piVar3; + int *piVar4; + undefined2 unaff_ES; + + piVar1 = (int *)0x4; + do { + piVar3 = piVar1; + piVar1 = (int *)*piVar3; + if (piVar1 == (int *)0x0) { + return; + } + iVar2 = piVar1[1] - in_AX; + } while ((uint)piVar1[1] < in_AX); + piVar4 = (int *)*piVar1; + if (iVar2 != 0) { + piVar4 = (int *)((int)piVar1 + in_AX); + *piVar4 = *piVar1; + piVar4[1] = iVar2; + } + *piVar3 = (int)piVar4; + *(int *)0x8 = *(int *)0x8 - in_AX; + return; +} + + +/* ===== 1020:02d7 FUN_1020_02d7 ===== */ + +void __cdecl16near FUN_1020_02d7(void) + +{ + int in_AX; + uint uVar1; + int iVar2; + uint *in_CX; + int in_BX; + uint *puVar3; + uint *puVar4; + + if (in_AX == 0) { + return; + } + if (in_CX != (uint *)0x0) { + uVar1 = in_AX + 3U & 0xfffc; + if (*(int *)0x0 != 0x5054) { + return; + } + if (((uint)in_CX & 3) != 0) { + return; + } + puVar4 = (uint *)0x4; + do { + puVar3 = puVar4; + puVar4 = (uint *)*puVar3; + if (puVar4 == (uint *)0x0) goto LAB_1020_0306; + } while (puVar4 <= in_CX && in_CX != puVar4); + if (in_CX == puVar4) { + return; + } +LAB_1020_0306: + *in_CX = (uint)puVar4; + in_CX[1] = uVar1; + iVar2 = uVar1 + *(int *)0x8; + *(int *)0x8 = iVar2; + if (iVar2 + 0xc != DAT_1028_070a) { + FUN_1020_0327(); + *puVar3 = (uint)in_CX; + puVar4 = (uint *)((int)puVar3 + puVar3[1]); + if (puVar4 != (uint *)*puVar3) { + return; + } + *puVar3 = *puVar4; + puVar3[1] = puVar3[1] + puVar4[1]; + return; + } + iVar2 = DAT_1028_0706; + DAT_1028_0706 = 0; + if (in_BX != *(int *)0xa) { + do { + DAT_1028_0706 = iVar2; + iVar2 = *(int *)0xa; + } while (*(int *)0xa != in_BX); + *(int *)0xa = *(int *)0xa; + } + } + if ((in_BX != 0x1028) && (iVar2 = GLOBALHANDLE(), iVar2 != 0)) { + GLOBALUNLOCK(0x1228,iVar2,iVar2); + GLOBALFREE(0x1228); + return; + } + return; +} + + +/* ===== 1020:0327 FUN_1020_0327 ===== */ + +void __cdecl16near FUN_1020_0327(void) + +{ + int *in_BX; + int *piVar1; + undefined2 unaff_ES; + + piVar1 = (int *)((int)in_BX + in_BX[1]); + if (piVar1 == (int *)*in_BX) { + *in_BX = *piVar1; + in_BX[1] = in_BX[1] + piVar1[1]; + } + return; +} + + +/* ===== 1020:0388 FUN_1020_0388 ===== */ + +undefined2 __cdecl16far FUN_1020_0388(void) + +{ + undefined2 uVar1; + + uVar1 = DAT_1028_071e; + LOCK(); + DAT_1028_071e = 0; + UNLOCK(); + return uVar1; +} + + +/* ===== 1020:038f FUN_1020_038f ===== */ + +void __cdecl16far FUN_1020_038f(void) + +{ + if (DAT_1028_071e == 0) { + return; + } + FUN_1020_005d(); + return; +} + + +/* ===== 1020:039d FUN_1020_039d ===== */ + +void __cdecl16far FUN_1020_039d(void) + +{ + uint in_AX; + int in_DX; + uint *unaff_DI; + undefined2 in_stack_00000002; + + if ((((int)unaff_DI[1] < in_DX) || (((int)unaff_DI[1] <= in_DX && (*unaff_DI <= in_AX)))) && + ((in_DX < (int)unaff_DI[3] || ((in_DX <= (int)unaff_DI[3] && (in_AX <= unaff_DI[2])))))) { + return; + } + FUN_1020_005d(); + return; +} + + +/* ===== 1020:03cb FUN_1020_03cb ===== */ + +void __cdecl16far FUN_1020_03cb(void) + +{ + uint in_AX; + uint uVar1; + undefined2 unaff_SS; + + if (((in_AX < 0xfc00) && ((undefined1 *)(in_AX + 0x400) < &stack0x0000)) && + (uVar1 = -((int)(in_AX + 0x400) - (int)&stack0x0000), *(uint *)0xa <= uVar1)) { + if (uVar1 < *(uint *)0xe) { + *(uint *)0xe = uVar1; + } + return; + } + FUN_1020_005d(); + return; +} + + +/* ===== 1020:03ef FUN_1020_03ef ===== */ + +/* WARNING: Unable to track spacebase fully for stack */ + +void __cdecl16far FUN_1020_03ef(void) + +{ + int iVar1; + int unaff_BP; + int unaff_DI; + undefined2 unaff_SS; + bool bVar2; + long lVar3; + + iVar1 = *(int *)(unaff_BP + 10); + if (iVar1 != 0) { + lVar3 = *(long *)(unaff_BP + 6); + bVar2 = false; + if (lVar3 == 0) { + lVar3 = FUN_1020_01ca(); + if (bVar2) { + FUN_1020_005d(); + return; + } + if (lVar3 == 0) { + return; + } + *(undefined2 *)(unaff_BP + 6) = (int)lVar3; + *(undefined2 *)(unaff_BP + 8) = (int)((ulong)lVar3 >> 0x10); + } + else { + *(undefined2 *)(unaff_BP + 10) = 0; + } + *(int *)((int)lVar3 + unaff_DI) = iVar1; + } + return; +} + + +/* ===== 1020:0439 FUN_1020_0439 ===== */ + +/* WARNING: Unable to track spacebase fully for stack */ + +void __cdecl16far FUN_1020_0439(void) + +{ + int unaff_BP; + undefined2 unaff_SS; + bool bVar1; + + bVar1 = false; + if (*(int *)(unaff_BP + 10) != 0) { + FUN_1020_02d7(0x1028); + if (bVar1) { + FUN_1020_005d(); + return; + } + } + *(undefined2 *)(unaff_BP + 6) = 0; + *(undefined2 *)(unaff_BP + 8) = 0; + return; +} + + +/* ===== 1020:0527 FUN_1020_0527 ===== */ + +void FUN_1020_0527(void) + +{ + FUN_1020_0534(); + return; +} + + +/* ===== 1020:052c FUN_1020_052c ===== */ + +void FUN_1020_052c(void) + +{ + FUN_1020_0534(); + return; +} + + +/* ===== 1020:0534 FUN_1020_0534 ===== */ + +void __stdcall16far FUN_1020_0534(undefined4 param_1) + +{ + int iVar1; + undefined2 in_DX; + int unaff_BP; + int iVar2; + int iVar3; + undefined2 uVar4; + bool bVar5; + undefined2 uVar6; + + iVar2 = unaff_BP + 1; + uVar6 = 0x1028; + uVar4 = (undefined2)((ulong)param_1 >> 0x10); + iVar3 = (int)param_1; + iVar1 = *(int *)(iVar3 + 2); + if ((iVar1 == -0x284f) || (iVar1 == -0x284e)) { + FUN_1020_0586(iVar3,uVar4); + } + else if (iVar1 != -0x2850) { + DAT_1028_071e = 0x66; + return; + } + bVar5 = true; + *(undefined2 *)(iVar3 + 2) = in_DX; + *(undefined2 *)(iVar3 + 8) = 0; + *(undefined2 *)(iVar3 + 10) = 0; + FUN_1020_05c7(uVar6,iVar2); + if (!bVar5) { + *(undefined2 *)(iVar3 + 2) = 0xd7b0; + } + return; +} + + +/* ===== 1020:0586 FUN_1020_0586 ===== */ + +void __stdcall16far FUN_1020_0586(undefined4 param_1) + +{ + char cVar1; + int unaff_BP; + int iVar2; + undefined2 uVar3; + + cVar1 = '\x01'; + uVar3 = (undefined2)((ulong)param_1 >> 0x10); + iVar2 = (int)param_1; + if (*(int *)(iVar2 + 2) != -0x284f) { + if (*(int *)(iVar2 + 2) != -0x284e) { + DAT_1028_071e = 0x67; + return; + } + cVar1 = '\x01'; + FUN_1020_05c7(1,0x1028,unaff_BP + 1); + } + if (cVar1 != '\0') { + FUN_1020_05c7(); + *(undefined2 *)(iVar2 + 2) = 0xd7b0; + } + return; +} + + +/* ===== 1020:05c7 FUN_1020_05c7 ===== */ + +void __cdecl16near FUN_1020_05c7(void) + +{ + int iVar1; + int in_BX; + int unaff_DI; + + iVar1 = (*(code *)*(undefined2 *)(in_BX + unaff_DI))(); + if (iVar1 != 0) { + DAT_1028_071e = iVar1; + } + return; +} + + +/* ===== 1020:05d8 FUN_1020_05d8 ===== */ + +undefined2 __stdcall16far FUN_1020_05d8(undefined4 param_1) + +{ + code *pcVar1; + undefined2 uVar2; + int iVar3; + undefined2 uVar4; + undefined1 in_CF; + + uVar4 = (undefined2)((ulong)param_1 >> 0x10); + iVar3 = (int)param_1; + pcVar1 = (code *)swi(0x21); + uVar2 = (*pcVar1)(); + if ((bool)in_CF) { + *(undefined2 *)(iVar3 + 10) = 0; + } + else { + *(undefined2 *)(iVar3 + 10) = uVar2; + uVar2 = 0; + } + *(undefined2 *)(iVar3 + 8) = 0; + return uVar2; +} + + +/* ===== 1020:0608 FUN_1020_0608 ===== */ + +int __stdcall16far FUN_1020_0608(undefined4 param_1) + +{ + int *piVar1; + code *pcVar2; + int iVar3; + int iVar4; + bool bVar5; + + bVar5 = false; + LOCK(); + piVar1 = (int *)((int)param_1 + 8); + iVar4 = *piVar1; + *piVar1 = 0; + UNLOCK(); + pcVar2 = (code *)swi(0x21); + iVar3 = (*pcVar2)(); + if ((!bVar5) && (bVar5 = iVar3 != iVar4, iVar3 = 0, bVar5)) { + iVar3 = 0x65; + } + return iVar3; +} + + +/* ===== 1020:062d FUN_1020_062d ===== */ + +undefined2 __stdcall16far FUN_1020_062d(undefined4 param_1) + +{ + code *pcVar1; + undefined2 uVar2; + bool bVar3; + + bVar3 = false; + LOCK(); + *(undefined2 *)((int)param_1 + 8) = 0; + UNLOCK(); + pcVar1 = (code *)swi(0x21); + uVar2 = (*pcVar1)(); + if (!bVar3) { + uVar2 = 0; + } + return uVar2; +} + + +/* ===== 1020:064d FUN_1020_064d ===== */ + +undefined2 __stdcall16far FUN_1020_064d(uint *param_1) + +{ + code *pcVar1; + undefined2 uVar2; + bool bVar3; + + bVar3 = *param_1 < 4; + if (4 < *param_1) { + pcVar1 = (code *)swi(0x21); + uVar2 = (*pcVar1)(); + if (bVar3) { + return uVar2; + } + } + return 0; +} + + +/* ===== 1020:0667 FUN_1020_0667 ===== */ + +void __stdcall16far FUN_1020_0667(byte *param_1,undefined2 *param_2) + +{ + byte *pbVar1; + byte *pbVar2; + int iVar3; + uint uVar4; + byte *pbVar5; + byte *pbVar6; + undefined2 uVar7; + + uVar7 = (undefined2)((ulong)param_2 >> 0x10); + pbVar6 = (byte *)((undefined2 *)param_2 + 1); + *param_2 = 0; + pbVar6[0] = 0xb0; + pbVar6[1] = 0xd7; + for (iVar3 = 0x16; pbVar6 = pbVar6 + 2, iVar3 != 0; iVar3 = iVar3 + -1) { + pbVar6[0] = 0; + pbVar6[1] = 0; + } + uVar4 = 0x4f; + pbVar5 = (byte *)param_1 + 1; + if (0x4e < *param_1) goto LAB_1020_0697; + for (uVar4 = (uint)*param_1; uVar4 != 0; uVar4 = uVar4 - 1) { +LAB_1020_0697: + pbVar1 = pbVar5; + pbVar5 = pbVar5 + 1; + if (*pbVar1 == 0) break; + pbVar2 = pbVar6; + pbVar6 = pbVar6 + 1; + *pbVar2 = *pbVar1; + } + *pbVar6 = 0; + Ordinal_5(); + return; +} + + +/* ===== 1020:06ab FUN_1020_06ab ===== */ + +void __stdcall16far FUN_1020_06ab(undefined2 param_1,undefined2 *param_2) + +{ + code *pcVar1; + undefined2 uVar2; + undefined2 *puVar3; + undefined2 uVar4; + bool bVar5; + undefined2 in_stack_00000000; + + uVar4 = (undefined2)((ulong)param_2 >> 0x10); + puVar3 = (undefined2 *)param_2; + if (puVar3[1] != -0x2850) { + if (puVar3[1] != -0x284d) { + DAT_1028_071e = 0x66; + return; + } + FUN_1020_072c(puVar3,uVar4); + } + uVar2 = 0; + if (*(char *)(puVar3 + 0x18) != '\0') { + bVar5 = false; + pcVar1 = (code *)swi(0x21); + uVar2 = (*pcVar1)(); + if (bVar5) { + *(undefined2 *)&DAT_1028_071e = uVar2; + return; + } + } + puVar3[1] = 0xd7b3; + *param_2 = uVar2; + puVar3[2] = param_1; + return; +} + + +/* ===== 1020:072c FUN_1020_072c ===== */ + +void __stdcall16far FUN_1020_072c(uint *param_1) + +{ + code *pcVar1; + undefined2 uVar2; + bool bVar3; + undefined1 in_ZF; + + FUN_1020_0751(); + if ((bool)in_ZF) { + bVar3 = *param_1 < 4; + if (4 < *param_1) { + pcVar1 = (code *)swi(0x21); + uVar2 = (*pcVar1)(); + if (bVar3) { + DAT_1028_071e = uVar2; + } + } + ((uint *)param_1)[1] = 0xd7b0; + } + return; +} + + +/* ===== 1020:0751 FUN_1020_0751 ===== */ + +void __cdecl16near FUN_1020_0751(void) + +{ + int unaff_DI; + undefined2 unaff_ES; + + if (*(int *)(unaff_DI + 2) != -0x284d) { + DAT_1028_071e = 0x67; + } + return; +} + + +/* ===== 1020:07fe FUN_1020_07fe ===== */ + +void __stdcall16far FUN_1020_07fe(uint param_1,int param_2,undefined4 param_3) + +{ + code *pcVar1; + undefined2 uVar2; + bool bVar3; + undefined1 in_ZF; + + uVar2 = (undefined2)((ulong)param_3 >> 0x10); + FUN_1020_0751(); + if ((bool)in_ZF) { + bVar3 = CARRY2(param_2 * *(int *)((int)param_3 + 4), + (uint)((ulong)param_1 * (ulong)*(uint *)((int)param_3 + 4) >> 0x10)); + pcVar1 = (code *)swi(0x21); + uVar2 = (*pcVar1)(); + if (bVar3) { + DAT_1028_071e = uVar2; + } + } + return; +} + + +/* ===== 1020:082e FUN_1020_082e ===== */ + +int __stdcall16far FUN_1020_082e(int param_1,undefined1 *param_2) + +{ + undefined1 *puVar1; + int iVar2; + undefined1 *in_BX; + int unaff_BP; + undefined1 *puVar3; + undefined2 uVar4; + undefined2 unaff_CS; + + puVar3 = (undefined1 *)param_2; + uVar4 = (undefined2)((ulong)param_2 >> 0x10); + if (param_1 == 0) { + param_1 = GETMODULEFILENAME(unaff_CS,0xff,puVar3 + 1,uVar4); + *param_2 = (char)param_1; + } + else { + iVar2 = FUN_1020_0871(0x1028,0x1028,unaff_BP + 1); + *param_2 = (char)iVar2; + for (; puVar3 = puVar3 + 1, iVar2 != 0; iVar2 = iVar2 + -1) { + puVar1 = in_BX; + in_BX = in_BX + 1; + *puVar3 = *puVar1; + } + } + return param_1; +} + + +/* ===== 1020:0871 FUN_1020_0871 ===== */ + +void __cdecl16near FUN_1020_0871(void) + +{ + byte *pbVar1; + int in_CX; + byte *pbVar2; + byte *pbVar3; + undefined2 uVar4; + + uVar4 = (undefined2)((ulong)DAT_1028_0702 >> 0x10); + pbVar3 = (byte *)DAT_1028_0702; +LAB_1020_0876: + do { + pbVar2 = pbVar3; + pbVar1 = pbVar2; + if (*pbVar2 != 0) { + pbVar3 = pbVar2 + 1; + if (*pbVar2 < 0x21) goto LAB_1020_0876; + } + do { + pbVar3 = pbVar1; + pbVar1 = pbVar3 + 1; + } while (0x20 < *pbVar3); + if ((pbVar3 == pbVar2) || (in_CX = in_CX + -1, in_CX == 0)) { + return; + } + } while( true ); +} + + +/* ===== 1020:0891 FUN_1020_0891 ===== */ + +void __stdcall16far FUN_1020_0891(int param_1,undefined1 *param_2,undefined1 *param_3) + +{ + undefined1 *puVar1; + undefined1 *puVar2; + undefined1 *puVar3; + undefined1 *puVar4; + + puVar3 = (undefined1 *)param_3; + puVar4 = (undefined1 *)param_2; + for (; param_1 != 0; param_1 = param_1 + -1) { + puVar2 = puVar4; + puVar4 = puVar4 + 1; + puVar1 = puVar3; + puVar3 = puVar3 + 1; + *puVar2 = *puVar1; + } + return; +} + + +/* ===== 1020:08a9 FUN_1020_08a9 ===== */ + +int __cdecl16far FUN_1020_08a9(void) + +{ + int in_AX; + int in_CX; + + if (1 < DAT_1028_0726) { + return in_AX * in_CX; + } + return in_AX * in_CX; +} + + +/* ===== 1020:08e6 FUN_1020_08e6 ===== */ + +int __cdecl16far FUN_1020_08e6(void) + +{ + uint uVar1; + uint in_AX; + int iVar2; + int iVar3; + uint in_CX; + uint uVar4; + uint in_DX; + uint in_BX; + int iVar5; + uint uVar6; + uint uVar7; + int iVar8; + bool bVar9; + bool bVar10; + + if (1 < DAT_1028_0726) { + if (CONCAT22(in_BX,in_CX) != 0) { + return (int)(CONCAT22(in_DX,in_AX) / CONCAT22(in_BX,in_CX)); + } +LAB_1020_095f: + iVar3 = FUN_1020_005d(); + return iVar3; + } + bVar10 = (int)in_DX < 0; + if (bVar10) { + bVar9 = in_AX != 0; + in_AX = -in_AX; + in_DX = -(in_DX + bVar9); + } + uVar7 = (uint)bVar10; + if (in_BX == 0) { + if (in_CX == 0) goto LAB_1020_095f; +LAB_1020_0967: + iVar3 = (int)(((ulong)in_DX % (ulong)in_CX << 0x10 | (ulong)in_AX) / (ulong)in_CX); + } + else { + if ((int)in_BX < 0) { + uVar7 = uVar7 + 2; + bVar9 = in_CX != 0; + in_CX = -in_CX; + in_BX = -(in_BX + bVar9); + if (in_BX == 0) goto LAB_1020_0967; + } + iVar5 = 0; + iVar3 = 0; + iVar8 = 0x10; + do { + iVar2 = iVar3 * 2; + bVar9 = (int)in_AX < 0; + in_AX = in_AX << 1 | (uint)(iVar3 < 0); + uVar4 = in_DX << 1 | (uint)bVar9; + uVar6 = iVar5 << 1 | (uint)((int)in_DX < 0); + in_DX = uVar4 - in_CX; + uVar4 = (uint)(uVar4 < in_CX); + uVar1 = uVar6 - in_BX; + iVar5 = uVar1 - uVar4; + iVar3 = iVar2 + 1; + if (uVar6 < in_BX || uVar1 < uVar4) { + bVar9 = CARRY2(in_DX,in_CX); + in_DX = in_DX + in_CX; + iVar5 = iVar5 + in_BX + (uint)bVar9; + iVar3 = iVar2; + } + iVar8 = iVar8 + -1; + } while (iVar8 != 0); + } + uVar7 = uVar7 >> 1; + if (bVar10) { + uVar7 = uVar7 + 1; + } + if (uVar7 == 1) { + iVar3 = -iVar3; + } + return iVar3; +} + + +/* ===== 1020:09ec FUN_1020_09ec ===== */ + +void __stdcall16far FUN_1020_09ec(byte param_1,byte *param_2,byte *param_3) + +{ + byte bVar1; + uint uVar2; + byte *pbVar3; + byte *pbVar4; + + pbVar3 = (byte *)param_3; + pbVar4 = (byte *)param_2; + bVar1 = *param_3; + if (param_1 < *param_3) { + bVar1 = param_1; + } + *param_2 = bVar1; + uVar2 = (uint)bVar1; + while( true ) { + pbVar4 = pbVar4 + 1; + pbVar3 = pbVar3 + 1; + if (uVar2 == 0) break; + uVar2 = uVar2 - 1; + *pbVar4 = *pbVar3; + } + return; +} + + +/* ===== 1020:0a10 FUN_1020_0a10 ===== */ + +void __stdcall16far FUN_1020_0a10(uint param_1,uint param_2,byte *param_3,byte *param_4) + +{ + byte *pbVar1; + uint uVar2; + byte *pbVar3; + byte *pbVar4; + + pbVar4 = (byte *)param_4; + if ((int)param_2 < 1) { + param_2 = 1; + } + pbVar3 = (byte *)param_3 + param_2; + if (*param_3 < param_2) { + uVar2 = 0; + } + else { + uVar2 = (*param_3 - param_2) + 1; + if ((int)param_1 < 0) { + param_1 = 0; + } + if (param_1 < uVar2) { + uVar2 = param_1; + } + } + *param_4 = (byte)uVar2; + for (; pbVar4 = pbVar4 + 1, uVar2 != 0; uVar2 = uVar2 - 1) { + pbVar1 = pbVar3; + pbVar3 = pbVar3 + 1; + *pbVar4 = *pbVar1; + } + return; +} + + +/* ===== 1020:0a51 FUN_1020_0a51 ===== */ + +void __stdcall16far FUN_1020_0a51(byte *param_1,byte *param_2) + +{ + byte bVar1; + byte bVar2; + byte bVar3; + uint uVar4; + byte *pbVar5; + byte *pbVar6; + + pbVar5 = (byte *)param_1; + bVar2 = *param_2; + bVar3 = *param_1; + bVar1 = *param_2; + *param_2 = *param_2 + bVar3; + if (CARRY1(bVar1,bVar3)) { + *param_2 = 0xff; + bVar3 = ~bVar2; + } + pbVar6 = (byte *)param_2 + bVar2; + uVar4 = (uint)bVar3; + while( true ) { + pbVar6 = pbVar6 + 1; + pbVar5 = pbVar5 + 1; + if (uVar4 == 0) break; + uVar4 = uVar4 - 1; + *pbVar6 = *pbVar5; + } + return; +} + + +/* ===== 1020:0a7d FUN_1020_0a7d ===== */ + +byte * __stdcall16far FUN_1020_0a7d(byte *param_1,byte *param_2) + +{ + byte *pbVar1; + int iVar2; + int iVar3; + uint uVar4; + byte *pbVar5; + byte *pbVar6; + byte *pbVar7; + undefined2 uVar8; + undefined2 uVar9; + bool bVar10; + + uVar9 = (undefined2)((ulong)param_2 >> 0x10); + if (*param_2 != 0) { + uVar4 = (uint)*param_2; + uVar8 = (undefined2)((ulong)param_1 >> 0x10); + if (uVar4 <= *param_1) { + iVar2 = (*param_1 - uVar4) + 1; + pbVar7 = (byte *)param_1 + 1; + pbVar6 = pbVar7; + do { + pbVar5 = (byte *)param_2 + 1; + bVar10 = pbVar6 == (byte *)0x0; + do { + if (iVar2 == 0) break; + iVar2 = iVar2 + -1; + pbVar1 = pbVar7; + pbVar7 = pbVar7 + 1; + bVar10 = *pbVar5 == *pbVar1; + } while (!bVar10); + if (!bVar10) { + return (byte *)0x0; + } + iVar3 = uVar4 - 1; + bVar10 = iVar3 == 0; + pbVar6 = pbVar7; + do { + pbVar5 = pbVar5 + 1; + if (iVar3 == 0) break; + iVar3 = iVar3 + -1; + pbVar1 = pbVar6; + pbVar6 = pbVar6 + 1; + bVar10 = *pbVar5 == *pbVar1; + } while (bVar10); + if (bVar10) { + return pbVar7 + (-1 - (int)(byte *)param_1); + } + pbVar6 = (byte *)param_2 + 1; + } while( true ); + } + } + return (byte *)0x0; +} + + +/* ===== 1020:0ac3 FUN_1020_0ac3 ===== */ + +void __stdcall16far FUN_1020_0ac3(byte *param_1,byte *param_2) + +{ + byte bVar1; + uint uVar2; + byte *pbVar3; + byte *pbVar4; + + pbVar3 = (byte *)param_2; + pbVar4 = (byte *)param_1; + bVar1 = *param_2; + if (*param_1 < *param_2) { + bVar1 = *param_1; + } + if (bVar1 != 0) { + uVar2 = (uint)bVar1; + do { + pbVar4 = pbVar4 + 1; + pbVar3 = pbVar3 + 1; + if (uVar2 == 0) { + return; + } + uVar2 = uVar2 - 1; + } while (*pbVar3 == *pbVar4); + } + return; +} + + +/* ===== 1020:0b00 FUN_1020_0b00 ===== */ + +void __stdcall16far FUN_1020_0b00(int param_1,undefined1 *param_2,undefined1 *param_3) + +{ + undefined1 *puVar1; + undefined1 *puVar2; + undefined1 *puVar3; + + puVar3 = (undefined1 *)param_3; + puVar2 = (undefined1 *)param_2; + *param_3 = (char)param_1; + for (; puVar3 = puVar3 + 1, param_1 != 0; param_1 = param_1 + -1) { + puVar1 = puVar2; + puVar2 = puVar2 + 1; + *puVar3 = *puVar1; + } + return; +} + + +/* ===== 1020:0b1b FUN_1020_0b1b ===== */ + +void __stdcall16far +FUN_1020_0b1b(int param_1,undefined2 param_2,undefined4 param_3,undefined4 param_4) + +{ + undefined2 uVar1; + undefined2 uVar2; + undefined2 unaff_SS; + undefined1 *puVar3; + undefined1 *puVar4; + undefined2 uVar5; + undefined1 local_202 [256]; + undefined1 local_102 [256]; + + if (param_1 < 1) { + param_1 = 1; + } + puVar4 = local_102; + uVar2 = (undefined2)((ulong)param_3 >> 0x10); + uVar1 = (undefined2)param_3; + uVar5 = unaff_SS; + FUN_1020_0a10(param_1 + -1,1,uVar1,uVar2); + FUN_1020_0a51((int)param_4,(int)((ulong)param_4 >> 0x10)); + puVar3 = local_202; + FUN_1020_0a10(0xff,param_1,uVar1,uVar2); + FUN_1020_0a51(puVar3,unaff_SS); + FUN_1020_09ec(param_2,uVar1,uVar2,puVar4,uVar5); + return; +} + + +/* ===== 1020:0b7a FUN_1020_0b7a ===== */ + +void __stdcall16far FUN_1020_0b7a(int param_1,int param_2,undefined4 param_3) + +{ + undefined2 uVar1; + undefined2 uVar2; + undefined2 unaff_SS; + undefined1 *puVar3; + undefined1 *puVar4; + undefined2 uVar5; + undefined1 local_202 [256]; + undefined1 local_102 [256]; + + if (((0 < param_1) && (0 < param_2)) && (param_2 < 0x100)) { + if (0xff < param_1) { + param_1 = 0xff; + } + puVar4 = local_102; + uVar2 = (undefined2)((ulong)param_3 >> 0x10); + uVar1 = (undefined2)param_3; + uVar5 = unaff_SS; + FUN_1020_0a10(param_2 + -1,1,uVar1,uVar2); + puVar3 = local_202; + FUN_1020_0a10(0xff,param_2 + param_1,uVar1,uVar2); + FUN_1020_0a51(puVar3,unaff_SS); + FUN_1020_09ec(0xff,uVar1,uVar2,puVar4,uVar5); + } + return; +} + + +/* ===== 1020:0be9 FUN_1020_0be9 ===== */ + +int __stdcall16far FUN_1020_0be9(int *param_1) + +{ + code *pcVar1; + int iVar2; + int iVar3; + uint extraout_DX; + int iVar4; + int *piVar5; + undefined2 uVar6; + bool bVar7; + + uVar6 = (undefined2)((ulong)param_1 >> 0x10); + piVar5 = (int *)param_1; + *param_1 = 0; + if (piVar5[1] != -0x284f) { + *param_1 = *param_1 + 1; + } + bVar7 = false; + if ((char)piVar5[0x18] != '\0') { + pcVar1 = (code *)swi(0x21); + iVar2 = (*pcVar1)(); + if (bVar7) { + return iVar2; + } + *param_1 = iVar2; + } + iVar2 = 0x5d8; + iVar3 = 0; + iVar4 = 0; + if (piVar5[1] != -0x284f) { + pcVar1 = (code *)swi(0x21); + (*pcVar1)(); + iVar2 = 0x62d; + iVar3 = 0x62d; + iVar4 = 0x1020; + if ((extraout_DX & 0x80) == 0) { + if (piVar5[1] == -0x284d) { + FUN_1020_0c76(); + } + iVar2 = 0x608; + iVar3 = 0; + iVar4 = 0; + } + piVar5[1] = -0x284e; + } + piVar5[10] = iVar2; + piVar5[0xb] = 0x1020; + piVar5[0xc] = iVar3; + piVar5[0xd] = iVar4; + piVar5[0xe] = 0x64d; + piVar5[0xf] = 0x1020; + return 0; +} + + +/* ===== 1020:0c76 FUN_1020_0c76 ===== */ + +void __cdecl16near FUN_1020_0c76(void) + +{ + bool bVar1; + code *pcVar2; + int iVar3; + int iVar4; + int unaff_DI; + undefined1 uVar5; + undefined4 uVar6; + + pcVar2 = (code *)swi(0x21); + uVar6 = (*pcVar2)(); + bVar1 = (uint)((ulong)uVar6 >> 0x10) < (uint)((uint)uVar6 < 0x80); + uVar5 = !bVar1 && bVar1; + pcVar2 = (code *)swi(0x21); + (*pcVar2)(); + pcVar2 = (code *)swi(0x21); + iVar3 = (*pcVar2)(); + if ((bool)uVar5) { + iVar3 = 0; + } + iVar4 = 0; + while( true ) { + if (iVar4 == iVar3) { + return; + } + if (*(char *)(iVar4 + unaff_DI + 0x80) == '\x1a') break; + iVar4 = iVar4 + 1; + } + pcVar2 = (code *)swi(0x21); + (*pcVar2)(); + pcVar2 = (code *)swi(0x21); + (*pcVar2)(); + return; +} + + +/* ===== 1020:0cd0 FUN_1020_0cd0 ===== */ + +undefined4 FUN_1020_0cd0(void) + +{ + uint uVar1; + byte bVar2; + uint in_AX; + uint uVar3; + uint uVar4; + char cVar5; + uint in_CX; + uint uVar6; + uint in_DX; + uint uVar7; + uint in_BX; + uint uVar8; + uint uVar9; + uint unaff_SI; + uint unaff_DI; + uint uVar10; + uint uVar11; + bool bVar12; + bool bVar13; + undefined4 uVar14; + + uVar10 = unaff_DI ^ 0x8000; + if ((byte)in_CX != 0) { + if ((byte)in_AX == 0) { +LAB_1020_0d54: + return CONCAT22(uVar10,in_CX); + } + uVar4 = in_AX; + uVar7 = in_DX; + uVar8 = in_BX; + if ((byte)in_CX < (byte)in_AX) { + uVar4 = in_CX; + in_CX = in_AX; + uVar7 = uVar10; + uVar8 = unaff_SI; + unaff_SI = in_BX; + uVar10 = in_DX; + } + bVar2 = -((char)uVar4 - (char)in_CX); + if (0x28 < bVar2) goto LAB_1020_0d54; + uVar3 = CONCAT11((char)(uVar7 >> 8),(char)in_CX) & 0x80ff; + uVar4 = uVar4 & 0xff00; + uVar7 = uVar7 | 0x8000; + uVar11 = uVar10 | 0x8000; + for (; 7 < bVar2; bVar2 = bVar2 - 8) { + uVar4 = CONCAT11((char)uVar8,(char)(uVar4 >> 8)); + uVar8 = CONCAT11((char)uVar7,(char)(uVar8 >> 8)); + uVar7 = uVar7 >> 8; + } + uVar6 = CONCAT11((char)(in_CX >> 8),bVar2); + while (bVar2 != 0) { + uVar1 = uVar7 & 1; + uVar7 = uVar7 >> 1; + uVar9 = uVar8 & 1; + uVar8 = uVar8 >> 1 | (uint)(uVar1 != 0) << 0xf; + uVar4 = uVar4 >> 1 | (uint)(uVar9 != 0) << 0xf; + bVar2 = (char)uVar6 - 1; + uVar6 = CONCAT11((char)(uVar6 >> 8),bVar2); + } + if ((int)(uVar3 ^ uVar10) < 0) { + in_AX = uVar4 - uVar6; + uVar9 = (uVar8 - unaff_SI) - (uint)(uVar4 < uVar6); + uVar10 = (uint)(uVar8 < unaff_SI || uVar8 - unaff_SI < (uint)(uVar4 < uVar6)); + in_DX = (uVar7 - uVar11) - uVar10; + if (uVar7 < uVar11 || uVar7 - uVar11 < uVar10) { + uVar10 = ~uVar9; + bVar12 = in_AX == 0; + in_AX = -in_AX; + uVar9 = uVar10 + bVar12; + in_DX = ~in_DX + (uint)CARRY2(uVar10,(uint)bVar12); + uVar3 = uVar3 ^ 0x8000; + } + if ((in_DX == 0 && uVar9 == 0) && in_AX == 0) goto LAB_1020_0d53; + while (-1 < (int)in_DX) { + bVar12 = (int)in_AX < 0; + in_AX = in_AX << 1; + bVar13 = (int)uVar9 < 0; + uVar9 = uVar9 << 1 | (uint)bVar12; + in_DX = in_DX << 1 | (uint)bVar13; + cVar5 = (char)uVar3 + -1; + uVar3 = CONCAT11((char)(uVar3 >> 8),cVar5); + if (cVar5 == '\0') { + uVar14 = FUN_1020_0e93(); + return uVar14; + } + } + } + else { + in_AX = uVar4 + uVar6; + uVar9 = uVar8 + unaff_SI + (uint)CARRY2(uVar4,uVar6); + uVar10 = (uint)(CARRY2(uVar8,unaff_SI) || CARRY2(uVar8 + unaff_SI,(uint)CARRY2(uVar4,uVar6))); + uVar4 = uVar7 + uVar11; + in_DX = uVar4 + uVar10; + if (CARRY2(uVar7,uVar11) || CARRY2(uVar4,uVar10)) { + uVar8 = in_DX & 1; + in_DX = in_DX >> 1 | (uint)(CARRY2(uVar7,uVar11) || CARRY2(uVar4,uVar10)) << 0xf; + uVar10 = uVar9 & 1; + uVar9 = uVar9 >> 1 | (uint)(uVar8 != 0) << 0xf; + in_AX = in_AX >> 1 | (uint)(uVar10 != 0) << 0xf; + cVar5 = (char)uVar3 + '\x01'; + uVar3 = CONCAT11((char)(uVar3 >> 8),cVar5); + if (cVar5 == '\0') goto LAB_1020_0d61; + } + } + bVar12 = 0xff7f < in_AX; + in_AX = in_AX + 0x80; + uVar10 = (uint)CARRY2(uVar9,(uint)bVar12); + bVar12 = CARRY2(in_DX,uVar10); + in_DX = in_DX + uVar10; + if (bVar12) { + in_DX = in_DX >> 1 | 0x8000; + cVar5 = (char)uVar3 + '\x01'; + uVar3 = CONCAT11((char)(uVar3 >> 8),cVar5); + if (cVar5 == '\0') { +LAB_1020_0d61: + return CONCAT22(in_DX,in_AX); + } + } + in_AX = CONCAT11((char)(in_AX >> 8),(char)uVar3); + in_DX = CONCAT11((byte)((in_DX & 0x7fff) >> 8) | (byte)(uVar3 >> 8),(char)(in_DX & 0x7fff)); + } +LAB_1020_0d53: + return CONCAT22(in_DX,in_AX); +} + + +/* ===== 1020:0cd4 FUN_1020_0cd4 ===== */ + +undefined4 __cdecl16near FUN_1020_0cd4(void) + +{ + uint uVar1; + byte bVar2; + uint in_AX; + uint uVar3; + uint uVar4; + char cVar5; + uint in_CX; + uint uVar6; + uint in_DX; + uint uVar7; + uint in_BX; + uint uVar8; + uint uVar9; + uint unaff_SI; + uint unaff_DI; + uint uVar10; + bool bVar11; + bool bVar12; + undefined4 uVar13; + + if ((byte)in_CX != 0) { + if ((byte)in_AX == 0) { +LAB_1020_0d54: + return CONCAT22(unaff_DI,in_CX); + } + uVar4 = in_AX; + uVar7 = in_DX; + uVar8 = in_BX; + if ((byte)in_CX < (byte)in_AX) { + uVar4 = in_CX; + in_CX = in_AX; + uVar7 = unaff_DI; + uVar8 = unaff_SI; + unaff_SI = in_BX; + unaff_DI = in_DX; + } + bVar2 = -((char)uVar4 - (char)in_CX); + if (0x28 < bVar2) goto LAB_1020_0d54; + uVar3 = CONCAT11((char)(uVar7 >> 8),(char)in_CX) & 0x80ff; + uVar4 = uVar4 & 0xff00; + uVar7 = uVar7 | 0x8000; + uVar10 = unaff_DI | 0x8000; + for (; 7 < bVar2; bVar2 = bVar2 - 8) { + uVar4 = CONCAT11((char)uVar8,(char)(uVar4 >> 8)); + uVar8 = CONCAT11((char)uVar7,(char)(uVar8 >> 8)); + uVar7 = uVar7 >> 8; + } + uVar6 = CONCAT11((char)(in_CX >> 8),bVar2); + while (bVar2 != 0) { + uVar1 = uVar7 & 1; + uVar7 = uVar7 >> 1; + uVar9 = uVar8 & 1; + uVar8 = uVar8 >> 1 | (uint)(uVar1 != 0) << 0xf; + uVar4 = uVar4 >> 1 | (uint)(uVar9 != 0) << 0xf; + bVar2 = (char)uVar6 - 1; + uVar6 = CONCAT11((char)(uVar6 >> 8),bVar2); + } + if ((int)(uVar3 ^ unaff_DI) < 0) { + in_AX = uVar4 - uVar6; + uVar9 = (uVar8 - unaff_SI) - (uint)(uVar4 < uVar6); + uVar4 = (uint)(uVar8 < unaff_SI || uVar8 - unaff_SI < (uint)(uVar4 < uVar6)); + in_DX = (uVar7 - uVar10) - uVar4; + if (uVar7 < uVar10 || uVar7 - uVar10 < uVar4) { + uVar7 = ~uVar9; + bVar11 = in_AX == 0; + in_AX = -in_AX; + uVar9 = uVar7 + bVar11; + in_DX = ~in_DX + (uint)CARRY2(uVar7,(uint)bVar11); + uVar3 = uVar3 ^ 0x8000; + } + if ((in_DX == 0 && uVar9 == 0) && in_AX == 0) goto LAB_1020_0d53; + while (-1 < (int)in_DX) { + bVar11 = (int)in_AX < 0; + in_AX = in_AX << 1; + bVar12 = (int)uVar9 < 0; + uVar9 = uVar9 << 1 | (uint)bVar11; + in_DX = in_DX << 1 | (uint)bVar12; + cVar5 = (char)uVar3 + -1; + uVar3 = CONCAT11((char)(uVar3 >> 8),cVar5); + if (cVar5 == '\0') { + uVar13 = FUN_1020_0e93(); + return uVar13; + } + } + } + else { + in_AX = uVar4 + uVar6; + uVar9 = uVar8 + unaff_SI + (uint)CARRY2(uVar4,uVar6); + uVar4 = (uint)(CARRY2(uVar8,unaff_SI) || CARRY2(uVar8 + unaff_SI,(uint)CARRY2(uVar4,uVar6))); + uVar8 = uVar7 + uVar10; + in_DX = uVar8 + uVar4; + if (CARRY2(uVar7,uVar10) || CARRY2(uVar8,uVar4)) { + uVar6 = in_DX & 1; + in_DX = in_DX >> 1 | (uint)(CARRY2(uVar7,uVar10) || CARRY2(uVar8,uVar4)) << 0xf; + uVar7 = uVar9 & 1; + uVar9 = uVar9 >> 1 | (uint)(uVar6 != 0) << 0xf; + in_AX = in_AX >> 1 | (uint)(uVar7 != 0) << 0xf; + cVar5 = (char)uVar3 + '\x01'; + uVar3 = CONCAT11((char)(uVar3 >> 8),cVar5); + if (cVar5 == '\0') goto LAB_1020_0d61; + } + } + bVar11 = 0xff7f < in_AX; + in_AX = in_AX + 0x80; + uVar7 = (uint)CARRY2(uVar9,(uint)bVar11); + bVar11 = CARRY2(in_DX,uVar7); + in_DX = in_DX + uVar7; + if (bVar11) { + in_DX = in_DX >> 1 | 0x8000; + cVar5 = (char)uVar3 + '\x01'; + uVar3 = CONCAT11((char)(uVar3 >> 8),cVar5); + if (cVar5 == '\0') { +LAB_1020_0d61: + return CONCAT22(in_DX,in_AX); + } + } + in_AX = CONCAT11((char)(in_AX >> 8),(char)uVar3); + in_DX = CONCAT11((byte)((in_DX & 0x7fff) >> 8) | (byte)(uVar3 >> 8),(char)(in_DX & 0x7fff)); + } +LAB_1020_0d53: + return CONCAT22(in_DX,in_AX); +} + + +/* ===== 1020:0d97 FUN_1020_0d97 ===== */ + +undefined4 __cdecl16near FUN_1020_0d97(void) + +{ + long lVar1; + long lVar2; + ulong uVar3; + long lVar4; + byte bVar5; + undefined2 in_AX; + byte bVar7; + uint uVar6; + byte bVar8; + uint in_CX; + int iVar9; + uint in_DX; + uint uVar10; + uint uVar11; + uint uVar12; + uint uVar13; + uint uVar14; + uint in_BX; + uint uVar15; + uint uVar16; + uint uVar17; + uint uVar18; + uint uVar19; + uint uVar20; + uint unaff_SI; + uint unaff_DI; + uint uVar21; + uint uVar22; + uint uVar23; + bool bVar24; + undefined4 uVar25; + + bVar5 = (byte)in_AX; + bVar7 = (byte)((uint)in_AX >> 8); + if ((bVar5 == 0) || (bVar8 = (byte)in_CX, bVar8 == 0)) { + uVar25 = FUN_1020_0e93(); + return uVar25; + } + iVar9 = CONCAT11((((byte)(in_DX >> 8) ^ (byte)(unaff_DI >> 8)) & 0x80) + CARRY1(bVar5,bVar8), + bVar5 + bVar8); + bVar5 = (byte)(in_CX >> 8); + uVar20 = in_DX | 0x8000; + uVar21 = unaff_DI | 0x8000; + if (((bVar7 == 0) && + (uVar6 = in_CX & 0xff00, uVar14 = uVar20, uVar10 = unaff_SI, uVar22 = uVar21, in_BX == 0)) || + ((bVar5 == 0 && + (uVar6 = (uint)bVar7 << 8, uVar14 = uVar21, uVar10 = in_BX, uVar22 = uVar20, unaff_SI == 0)))) + { + uVar3 = (ulong)uVar10 * (ulong)uVar14 + ((ulong)uVar6 * (ulong)uVar14 >> 0x10); + uVar15 = (uint)uVar3; + lVar1 = (ulong)uVar22 * (ulong)uVar14 + (uVar3 >> 0x10); + } + else { + lVar1 = (ulong)bVar7 * 0x100 * (ulong)unaff_SI; + lVar4 = lVar1 + (ulong)((uint)bVar7 * (uint)bVar5); + uVar22 = (uint)((ulong)lVar4 >> 0x10); + lVar2 = (ulong)in_BX * (ulong)bVar5 * 0x100; + uVar10 = (uint)((ulong)lVar2 >> 0x10); + uVar6 = (uint)CARRY2((uint)lVar4,(uint)lVar2); + uVar14 = uVar22 + uVar10; + uVar15 = uVar14 + uVar6; + uVar16 = (uint)CARRY2((uint)((ulong)lVar1 >> 0x10), + (uint)CARRY2((uint)bVar7 * (uint)bVar5,(uint)lVar1)) + + (uint)(CARRY2(uVar22,uVar10) || CARRY2(uVar14,uVar6)); + lVar1 = (ulong)bVar7 * 0x100 * (ulong)uVar21; + uVar11 = (uint)((ulong)lVar1 >> 0x10); + uVar6 = (uint)lVar1; + uVar23 = uVar15 + uVar6; + uVar6 = (uint)CARRY2(uVar15,uVar6); + uVar22 = uVar16 + uVar11; + uVar17 = uVar22 + uVar6; + uVar12 = (uint)((ulong)in_BX * (ulong)unaff_SI >> 0x10); + uVar10 = (uint)((ulong)in_BX * (ulong)unaff_SI); + uVar14 = (uint)CARRY2(uVar23,uVar10); + uVar15 = uVar17 + uVar12; + uVar18 = uVar15 + uVar14; + lVar1 = (ulong)uVar20 * (ulong)bVar5 * 0x100; + uVar13 = (uint)((ulong)lVar1 >> 0x10); + uVar10 = (uint)CARRY2(uVar23 + uVar10,(uint)lVar1); + uVar23 = uVar18 + uVar13; + uVar19 = uVar23 + uVar10; + uVar12 = (uint)(CARRY2(uVar16,uVar11) || CARRY2(uVar22,uVar6)) + + (uint)(CARRY2(uVar17,uVar12) || CARRY2(uVar15,uVar14)) + + (uint)(CARRY2(uVar18,uVar13) || CARRY2(uVar23,uVar10)); + uVar23 = (uint)((ulong)in_BX * (ulong)uVar21 >> 0x10); + uVar6 = (uint)((ulong)in_BX * (ulong)uVar21); + uVar22 = uVar19 + uVar6; + uVar6 = (uint)CARRY2(uVar19,uVar6); + uVar10 = uVar12 + uVar23; + uVar13 = uVar10 + uVar6; + uVar11 = (uint)((ulong)uVar20 * (ulong)unaff_SI >> 0x10); + uVar14 = (uint)((ulong)uVar20 * (ulong)unaff_SI); + uVar15 = uVar22 + uVar14; + uVar14 = (uint)CARRY2(uVar22,uVar14); + uVar22 = uVar13 + uVar11; + lVar1 = (ulong)uVar20 * (ulong)uVar21 + + CONCAT22((uint)(CARRY2(uVar12,uVar23) || CARRY2(uVar10,uVar6)) + + (uint)(CARRY2(uVar13,uVar11) || CARRY2(uVar22,uVar14)),uVar22 + uVar14); + } + if (-1 < lVar1) { + bVar24 = (int)uVar15 < 0; + uVar15 = uVar15 << 1; + lVar1 = CONCAT22((int)((ulong)lVar1 >> 0x10) << 1 | (uint)((int)lVar1 < 0), + (int)lVar1 << 1 | (uint)bVar24); + iVar9 = iVar9 + -1; + } + uVar6 = (uint)((ulong)lVar1 >> 0x10); + uVar21 = iVar9 + 0x7f7f; + uVar20 = (uint)CARRY2((uint)lVar1,(uint)(0xff7f < uVar15)); + uVar14 = uVar6 + uVar20; + if (CARRY2(uVar6,uVar20)) { + uVar14 = uVar14 >> 1 | 0x8000; + uVar21 = iVar9 + 0x7f80; + } + if ((uVar21 & 0x4000) != 0) { + return 0; + } + return CONCAT22(CONCAT11((byte)(uVar14 >> 8) ^ (byte)(uVar21 + 1 >> 8),(char)uVar14), + CONCAT11((char)(uVar15 + 0x80 >> 8),(char)(uVar21 + 1))); +} + + +/* ===== 1020:0e93 FUN_1020_0e93 ===== */ + +void __cdecl16near FUN_1020_0e93(void) + +{ + return; +} + + +/* ===== 1020:0e9a FUN_1020_0e9a ===== */ + +undefined4 __cdecl16near FUN_1020_0e9a(void) + +{ + byte bVar1; + undefined1 uVar2; + char cVar3; + undefined2 in_AX; + int iVar4; + byte bVar5; + undefined2 in_CX; + byte bVar7; + uint uVar6; + uint in_DX; + char cVar9; + uint uVar8; + uint in_BX; + uint uVar10; + uint unaff_BP; + uint uVar11; + uint unaff_SI; + uint unaff_DI; + uint uVar12; + bool bVar13; + bool bVar14; + int in_stack_00000000; + + bVar1 = (byte)in_AX; + if (bVar1 == 0) { + return 0; + } + uVar12 = unaff_DI | 0x8000; + uVar11 = in_DX | 0x8000; + cVar9 = (((byte)(in_DX >> 8) ^ (byte)(unaff_DI >> 8)) & 0x80) - (bVar1 < (byte)in_CX); + iVar4 = CONCAT11((char)((uint)in_AX >> 8),2); + uVar8 = 1; + do { + bVar13 = uVar11 < uVar12; + bVar7 = (byte)((uint)in_CX >> 8); + bVar5 = (byte)((uint)iVar4 >> 8); + if ((uVar11 == uVar12) && (bVar13 = in_BX < unaff_SI, in_BX == unaff_SI)) { + bVar13 = bVar5 < bVar7; + } + if (!bVar13) { + iVar4 = CONCAT11(bVar5 - bVar7,(char)iVar4); + bVar13 = in_BX < unaff_SI; + uVar10 = in_BX - unaff_SI; + in_BX = uVar10 - (bVar5 < bVar7); + uVar10 = (uint)(bVar13 || uVar10 < (bVar5 < bVar7)); + bVar13 = uVar11 < uVar12 || uVar11 - uVar12 < uVar10; + uVar11 = (uVar11 - uVar12) - uVar10; + } + while( true ) { + bVar14 = (int)uVar8 < 0; + uVar8 = uVar8 << 1 | (uint)bVar13; + if (bVar14) { + cVar3 = (char)iVar4 + -1; + iVar4 = CONCAT11((char)((uint)iVar4 >> 8),cVar3); + if (cVar3 < '\0') { + uVar11 = ~(uVar8 << 6); + uVar10 = ~CONCAT11(cVar9,bVar1 - (byte)in_CX); + uVar12 = unaff_BP ^ 0xffff; + if (-1 < (int)uVar12) { + uVar11 = uVar11 << 1; + uVar10 = uVar10 << 1 | (uint)(-1 < (int)(uVar8 << 6)); + uVar12 = uVar12 << 1 | (uint)(-1 < cVar9); + in_stack_00000000 = in_stack_00000000 + -1; + } + uVar6 = in_stack_00000000 + 0x8080; + uVar8 = (uint)CARRY2(uVar10,(uint)(0xff7f < uVar11)); + uVar10 = uVar12 + uVar8; + if (CARRY2(uVar12,uVar8)) { + uVar10 = uVar10 >> 1 | 0x8000; + uVar6 = in_stack_00000000 + 0x8081; + } + if ((uVar6 & 0x4000) != 0) { + return 0; + } + return CONCAT22(CONCAT11((byte)(uVar10 >> 8) ^ (byte)(uVar6 + 1 >> 8),(char)uVar10), + CONCAT11((char)(uVar11 + 0x80 >> 8),(char)(uVar6 + 1))); + } + uVar8 = 1; + if (cVar3 == '\0') { + uVar8 = 0x40; + } + } + bVar13 = iVar4 < 0; + uVar2 = (undefined1)iVar4; + bVar5 = (char)((uint)iVar4 >> 8) * '\x02'; + iVar4 = CONCAT11(bVar5,uVar2); + bVar14 = (int)in_BX < 0; + in_BX = in_BX << 1 | (uint)bVar13; + bVar13 = -1 < (int)uVar11; + uVar11 = uVar11 << 1 | (uint)bVar14; + if (bVar13) break; + iVar4 = CONCAT11(bVar5 - bVar7,uVar2); + bVar13 = in_BX < unaff_SI; + uVar10 = in_BX - unaff_SI; + in_BX = uVar10 - (bVar5 < bVar7); + uVar11 = (uVar11 - uVar12) - (uint)(bVar13 || uVar10 < (bVar5 < bVar7)); + bVar13 = false; + } + } while( true ); +} + + +/* ===== 1020:0f11 FUN_1020_0f11 ===== */ + +void __cdecl16near FUN_1020_0f11(void) + +{ + uint in_DX; + uint unaff_DI; + bool bVar1; + + if ((int)(in_DX ^ unaff_DI) < 0) { + return; + } + bVar1 = (in_DX & 0x8000) == 0; + if ((!bVar1) && (FUN_1020_0f28(), !bVar1)) { + return; + } + return; +} + + +/* ===== 1020:0f28 FUN_1020_0f28 ===== */ + +void __cdecl16near FUN_1020_0f28(void) + +{ + return; +} + + +/* ===== 1020:0f3b FUN_1020_0f3b ===== */ + +void __cdecl16near FUN_1020_0f3b(void) + +{ + uint uVar1; + uint in_AX; + uint in_DX; + bool bVar2; + + if (in_AX != 0 || in_DX != 0) { + if ((int)in_DX < 0) { + bVar2 = in_AX != 0; + in_AX = -in_AX; + in_DX = -(uint)bVar2 - in_DX; + } + uVar1 = in_AX; + if ((in_DX == 0) && (uVar1 = 0, in_DX = in_AX, (char)(in_AX >> 8) == '\0')) { + in_DX = in_AX << 8; + } + while (-1 < (int)in_DX) { + in_DX = in_DX * 2 + (uint)CARRY2(uVar1,uVar1); + uVar1 = uVar1 * 2; + } + } + return; +} + + +/* ===== 1020:0f77 FUN_1020_0f77 ===== */ + +void __cdecl16near FUN_1020_0f77(void) + +{ + byte in_AL; + byte bVar1; + + bVar1 = -in_AL + 0xa0; + if (in_AL < 0xa1) { + if (bVar1 < 0x20) { + if (0xf < bVar1) { + bVar1 = -in_AL + 0x90; + } + if (7 < bVar1) { + bVar1 = bVar1 - 8; + } + for (; bVar1 != 0; bVar1 = bVar1 - 1) { + } + } + else if (bVar1 != 0x20) { + return; + } + } + return; +} + + +/* ===== 1020:0fe5 FUN_1020_0fe5 ===== */ + +void __cdecl16far FUN_1020_0fe5(void) + +{ + undefined1 in_CF; + + FUN_1020_0cd4(); + if (!(bool)in_CF) { + return; + } + FUN_1020_005d(); + return; +} + + +/* ===== 1020:0feb FUN_1020_0feb ===== */ + +void __cdecl16far FUN_1020_0feb(void) + +{ + undefined1 in_CF; + + FUN_1020_0cd0(); + if (!(bool)in_CF) { + return; + } + FUN_1020_005d(); + return; +} + + +/* ===== 1020:0ff1 FUN_1020_0ff1 ===== */ + +void FUN_1020_0ff1(void) + +{ + undefined1 in_CF; + + FUN_1020_0d97(); + if (!(bool)in_CF) { + return; + } + FUN_1020_005d(); + return; +} + + +/* ===== 1020:0ff7 FUN_1020_0ff7 ===== */ + +void __cdecl16far FUN_1020_0ff7(void) + +{ + undefined1 in_CF; + + FUN_1020_0d97(); + if (!(bool)in_CF) { + return; + } + FUN_1020_005d(); + return; +} + + +/* ===== 1020:0ffd FUN_1020_0ffd ===== */ + +void __cdecl16far FUN_1020_0ffd(void) + +{ + char in_CL; + bool bVar1; + + bVar1 = false; + if (in_CL == '\0') { + FUN_1020_005d(); + return; + } + FUN_1020_0e9a(); + if (!bVar1) { + return; + } + FUN_1020_005d(); + return; +} + + +/* ===== 1020:1007 FUN_1020_1007 ===== */ + +void __cdecl16far FUN_1020_1007(void) + +{ + FUN_1020_0f11(); + return; +} + + +/* ===== 1020:100b FUN_1020_100b ===== */ + +void __cdecl16far FUN_1020_100b(void) + +{ + FUN_1020_0f3b(); + return; +} + + +/* ===== 1020:1017 FUN_1020_1017 ===== */ + +void __cdecl16far FUN_1020_1017(void) + +{ + undefined1 in_CF; + + FUN_1020_0f77(); + if (!(bool)in_CF) { + return; + } + FUN_1020_005d(); + return; +} + + +/* ===== 1020:1031 FUN_1020_1031 ===== */ + +void __cdecl16near FUN_1020_1031(void) + +{ + FUN_1020_0cd4(); + return; +} + + +/* ===== 1020:104f FUN_1020_104f ===== */ + +void __cdecl16near FUN_1020_104f(void) + +{ + FUN_1020_0e9a(); + return; +} + + +/* ===== 1020:10be FUN_1020_10be ===== */ + +uint __cdecl16far FUN_1020_10be(void) + +{ + char cVar1; + byte bVar2; + uint in_AX; + uint uVar3; + uint in_DX; + undefined2 in_BX; + undefined2 uVar4; + undefined4 uVar5; + + cVar1 = (char)in_AX; + if (cVar1 != '\0') { + if ((in_DX & 0x8000) != 0) { + uVar3 = FUN_1020_005d(); + return uVar3; + } + do { + uVar4 = in_BX; + FUN_1020_104f(); + uVar5 = FUN_1020_1031(); + in_AX = (uint)(byte)((char)uVar5 - 1); + bVar2 = FUN_1020_0cd0(in_AX,uVar4,(int)((ulong)uVar5 >> 0x10)); + } while ((byte)(((char)(cVar1 + -0x80) >> 1) + 0x6cU) <= bVar2); + } + return in_AX; +} + + +/* ===== 1020:14a4 FUN_1020_14a4 ===== */ + +int __stdcall16far FUN_1020_14a4(uint param_1) + +{ + long lVar1; + ulong uVar2; + + uVar2 = FUN_1020_1501(); + lVar1 = (uVar2 >> 0x10) * (ulong)param_1; + return (int)((ulong)lVar1 >> 0x10) + + (uint)CARRY2((uint)lVar1,(uint)((uVar2 & 0xffff) * (ulong)param_1 >> 0x10)); +} + + +/* ===== 1020:14c1 FUN_1020_14c1 ===== */ + +char __cdecl16far FUN_1020_14c1(void) + +{ + char cVar1; + int iVar2; + ulong uVar3; + + uVar3 = FUN_1020_1501(); + cVar1 = -0x80; + iVar2 = 0x20; + do { + if ((uVar3 & 0x80000000) != 0) { + return cVar1; + } + uVar3 = CONCAT22((int)(uVar3 >> 0x10) << 1 | (uint)((int)uVar3 < 0),(int)uVar3 << 1); + cVar1 = cVar1 + -1; + iVar2 = iVar2 + -1; + } while (iVar2 != 0); + return '\0'; +} + + +/* ===== 1020:1501 FUN_1020_1501 ===== */ + +void __cdecl16near FUN_1020_1501(void) + +{ + uint uVar1; + char cVar2; + int iVar3; + + uVar1 = (uint)((ulong)DAT_1028_0720 * (ulong)DAT_1020_1537); + cVar2 = (char)(DAT_1028_0720 << 3); + iVar3 = (int)((ulong)DAT_1028_0720 * (ulong)DAT_1020_1537 >> 0x10) + + CONCAT11((char)((DAT_1028_0720 << 3) >> 8) + cVar2,cVar2) + DAT_1028_0722 * 5; + DAT_1028_0720 = uVar1 + 1; + DAT_1028_0722 = + CONCAT11((char)((uint)iVar3 >> 8) + (char)DAT_1028_0722 * '\x04' + (char)(DAT_1028_0722 << 7) + ,(char)iVar3) + (uint)(0xfffe < uVar1); + return; +} + + +/* ===== 1020:1546 FUN_1020_1546 ===== */ + +void __cdecl16near FUN_1020_1546(void) + +{ + ulong uVar1; + uint in_AX; + byte bVar2; + uint in_DX; + byte *unaff_DI; + undefined2 unaff_ES; + char cVar3; + + if ((int)in_DX < 0) { + FUN_1020_1562(); + unaff_DI[-1] = 0x2d; + return; + } + do { + uVar1 = (ulong)in_DX; + in_DX = in_DX / 10; + uVar1 = uVar1 % 10 << 0x10 | (ulong)in_AX; + in_AX = (uint)(uVar1 / 10); + cVar3 = (char)(uVar1 % 10); + bVar2 = cVar3 + 0x30; + if (0x39 < bVar2) { + bVar2 = cVar3 + 0x37; + } + unaff_DI = unaff_DI + -1; + *unaff_DI = bVar2; + } while (in_AX != 0 || in_DX != 0); + return; +} + + +/* ===== 1020:1562 FUN_1020_1562 ===== */ + +void __cdecl16near FUN_1020_1562(void) + +{ + ulong uVar1; + uint in_AX; + byte bVar2; + uint in_BX; + uint unaff_SI; + byte *unaff_DI; + undefined2 unaff_ES; + char cVar3; + + do { + uVar1 = (ulong)in_BX; + in_BX = in_BX / unaff_SI; + uVar1 = uVar1 % (ulong)unaff_SI << 0x10 | (ulong)in_AX; + in_AX = (uint)(uVar1 / unaff_SI); + cVar3 = (char)(uVar1 % (ulong)unaff_SI); + bVar2 = cVar3 + 0x30; + if (0x39 < bVar2) { + bVar2 = cVar3 + 0x37; + } + unaff_DI = unaff_DI + -1; + *unaff_DI = bVar2; + } while (in_AX != 0 || in_BX != 0); + return; +} + + +/* ===== 1020:1582 FUN_1020_1582 ===== */ + +undefined4 __cdecl16near FUN_1020_1582(void) + +{ + int iVar1; + uint uVar2; + int iVar3; + uint uVar4; + int in_CX; + uint uVar5; + uint uVar6; + byte bVar7; + byte bVar8; + uint uVar9; + char cVar10; + uint uVar11; + byte *unaff_DI; + undefined2 unaff_ES; + bool bVar12; + bool bVar13; + + iVar1 = 0; + uVar5 = 0; + uVar11 = 0; + if (in_CX == 0) goto LAB_1020_15e7; + if (*unaff_DI == 0x2b) { +LAB_1020_1597: + unaff_DI = unaff_DI + 1; + in_CX = in_CX + -1; + if (in_CX == 0) goto LAB_1020_15e7; + } + else if (*unaff_DI == 0x2d) { + uVar11 = 0xffff; + goto LAB_1020_1597; + } + if (*unaff_DI != 0x24) { + do { + uVar9 = (uint)(byte)(*unaff_DI - 0x30); + if ((byte)(*unaff_DI - 0x3a) < 0xf6) break; + if ((uVar5 & 0xf000) != 0) goto LAB_1020_15e7; + uVar2 = iVar1 * 2; + uVar6 = uVar5 << 1 | (uint)(iVar1 < 0); + iVar3 = iVar1 << 2; + uVar4 = iVar1 * 8; + uVar5 = iVar1 * 10; + iVar1 = uVar5 + uVar9; + uVar5 = ((uVar6 << 1 | (uint)((int)uVar2 < 0)) << 1 | (uint)(iVar3 < 0)) + uVar6 + + (uint)CARRY2(uVar4,uVar2) + (uint)CARRY2(uVar5,uVar9); + unaff_DI = unaff_DI + 1; + in_CX = in_CX + -1; + } while (in_CX != 0); +LAB_1020_15d1: + if (iVar1 != 0 || uVar5 != 0) { + if ((int)uVar11 < 0) { + bVar12 = iVar1 != 0; + iVar1 = -iVar1; + uVar5 = -(uint)bVar12 - uVar5; + } + if ((int)(uVar11 ^ uVar5) < 0) goto LAB_1020_15e7; + } + return CONCAT22(uVar5,iVar1); + } + iVar3 = in_CX + -1; + if (iVar3 != 0) { + do { + unaff_DI = unaff_DI + 1; + bVar7 = *unaff_DI; + if (0x60 < bVar7) { + bVar7 = bVar7 - 0x20; + } + bVar8 = bVar7 - 0x30; + if ((byte)(bVar7 - 0x3a) < 0xf6) { + if ((byte)(bVar7 + 0xb9) < 0xfa) goto LAB_1020_15d1; + bVar8 = bVar7 - 0x37; + } + cVar10 = '\x04'; + do { + bVar12 = iVar1 < 0; + iVar1 = iVar1 << 1; + bVar13 = (int)uVar5 < 0; + uVar5 = uVar5 << 1 | (uint)bVar12; + if (bVar13) goto LAB_1020_15e7; + cVar10 = cVar10 + -1; + } while (cVar10 != '\0'); + iVar1 = CONCAT11((char)((uint)iVar1 >> 8),(byte)iVar1 | bVar8); + iVar3 = iVar3 + -1; + if (iVar3 == 0) { + if ((int)uVar11 < 0) { + bVar12 = iVar1 != 0; + iVar1 = -iVar1; + uVar5 = -(uint)bVar12 - uVar5; + } + return CONCAT22(uVar5,iVar1); + } + } while( true ); + } +LAB_1020_15e7: + return CONCAT22(uVar5,iVar1); +} + + +/* ===== 1020:1629 FUN_1020_1629 ===== */ + +void __stdcall16far FUN_1020_1629(int param_1,undefined1 *param_2,int param_3) + +{ + undefined1 *puVar1; + int in_CX; + undefined1 *puVar2; + undefined1 *puVar3; + undefined2 uVar4; + undefined2 unaff_SS; + + FUN_1020_1546(); + uVar4 = (undefined2)((ulong)param_2 >> 0x10); + if (param_1 < param_3) { + param_3 = param_1; + } + if (param_1 < in_CX) { + in_CX = param_1; + } + if (param_3 < in_CX) { + param_3 = in_CX; + } + puVar3 = (undefined1 *)param_2 + 1; + *param_2 = (char)param_3; + param_3 = param_3 - in_CX; + puVar2 = &stack0xfffe; + if (param_3 != 0) { + for (; puVar2 = &stack0xfffe, param_3 != 0; param_3 = param_3 + -1) { + puVar1 = puVar3; + puVar3 = puVar3 + 1; + *puVar1 = 0x20; + } + } + for (; in_CX != 0; in_CX = in_CX + -1) { + puVar1 = puVar3; + puVar3 = puVar3 + 1; + *puVar1 = *puVar2; + puVar2 = puVar2 + 1; + } + return; +} + + +/* ===== 1020:1674 FUN_1020_1674 ===== */ + +undefined2 __stdcall16far FUN_1020_1674(int *param_1,byte *param_2) + +{ + undefined2 uVar1; + uint uVar2; + int iVar3; + byte *pbVar4; + bool bVar5; + + bVar5 = false; + uVar2 = (uint)*param_2; + pbVar4 = (byte *)param_2; + while ((pbVar4 = pbVar4 + 1, uVar2 != 0 && (bVar5 = *pbVar4 < 0x20, *pbVar4 == 0x20))) { + uVar2 = uVar2 - 1; + } + uVar1 = FUN_1020_1582(); + if ((bVar5) || (iVar3 = 0, uVar2 != 0)) { + iVar3 = (int)pbVar4 - (int)(byte *)param_2; + uVar1 = 0; + } + *param_1 = iVar3; + return uVar1; +} + + +/* ===== 1020:16a5 FUN_1020_16a5 ===== */ + +void __stdcall16far FUN_1020_16a5(int param_1,undefined1 *param_2,undefined1 *param_3) + +{ + undefined1 *puVar1; + undefined1 *puVar2; + undefined1 *puVar3; + undefined1 *puVar4; + byte bVar5; + + puVar3 = (undefined1 *)param_3; + puVar4 = (undefined1 *)param_2; + bVar5 = 0; + if (puVar3 < puVar4) { + puVar3 = puVar3 + param_1 + -1; + puVar4 = puVar4 + param_1 + -1; + bVar5 = 1; + } + for (; param_1 != 0; param_1 = param_1 + -1) { + puVar2 = puVar4; + puVar4 = puVar4 + (uint)bVar5 * -2 + 1; + puVar1 = puVar3; + puVar3 = puVar3 + (uint)bVar5 * -2 + 1; + *puVar2 = *puVar1; + } + return; +} + + +/* ===== 1020:16c9 FUN_1020_16c9 ===== */ + +void __stdcall16far FUN_1020_16c9(undefined1 param_1,int param_2,undefined1 *param_3) + +{ + undefined1 *puVar1; + undefined1 *puVar2; + + puVar2 = (undefined1 *)param_3; + for (; param_2 != 0; param_2 = param_2 + -1) { + puVar1 = puVar2; + puVar2 = puVar2 + 1; + *puVar1 = param_1; + } + return; +} + + +/* ===== 1020:16e1 FUN_1020_16e1 ===== */ + +void FUN_1020_16e1(void) + +{ + uint *unaff_DI; + + FUN_1020_16e6(); + /* WARNING: Could not recover jumptable at 0x102016e4. Too many branches */ + /* WARNING: Treating indirect jump as call */ + (*(code *)(ulong)*unaff_DI)(); + return; +} + + +/* ===== 1020:16e6 FUN_1020_16e6 ===== */ + +void __cdecl16near FUN_1020_16e6(void) + +{ + int *piVar1; + int *piVar2; + int iVar3; + int in_AX; + int iVar4; + int *piVar5; + int unaff_DI; + int *piVar6; + bool bVar7; + + piVar2 = (int *)*(int *)(unaff_DI + 4); + piVar5 = piVar2; + if (in_AX == piVar2[1]) { + return; + } + do { + bVar7 = false; + iVar3 = piVar5[3]; + piVar6 = piVar5 + 4; + iVar4 = iVar3; + do { + if (iVar4 == 0) break; + iVar4 = iVar4 + -1; + piVar1 = piVar6; + piVar6 = piVar6 + 1; + bVar7 = in_AX == *piVar1; + } while (!bVar7); + if (bVar7) { + piVar2[1] = in_AX; + piVar2[2] = (int)(piVar6 + ((iVar3 + -1) * 2 - iVar4)); + return; + } + piVar1 = piVar5; + piVar5 = (int *)*piVar1; + if ((int *)*piVar1 == (int *)0x0) { + FUN_1020_005d(); + return; + } + } while( true ); +} + + +/* SUMMARY: total=655 internal=363 external=292 succeeded=363 failed=0 */ diff --git a/original/assets/README.md b/original/assets/README.md new file mode 100644 index 0000000..681628a --- /dev/null +++ b/original/assets/README.md @@ -0,0 +1,26 @@ +# Extracted TDK Pinball assets + +This directory contains every resource in `TDKPIN.EXE`'s Windows 3.x NE resource table. + +## Layout + +- `raw/`: all 63 resource allocations copied byte-for-byte from the executable. These files + intentionally retain alignment padding and are the lossless source of truth. +- `decoded/images/`: 34 custom 8-bit DIB graphics and three standard bitmap resources converted + to PNG. The standard bitmaps also have BMP wrappers. +- `decoded/palettes/`: the shared 256-color RGB palette as a swatch PNG and GIMP palette. +- `decoded/audio/`: all 16 RIFF/PCM resources trimmed to their declared RIFF lengths. +- `decoded/icons/`: the application icon as ICO and PNG. +- `decoded/dialogs/`: all six packed Win16 dialog templates decoded to JSON, including bounds, + control IDs, classes, captions, styles, and fonts. +- `decoded/metadata/`: printable strings and fixed fields from the version resource. +- `manifest.json`: resource ID, original file offset, flags, allocated and meaningful sizes, + hashes, format metadata, and decoded paths for every entry. + +The custom `DAT` graphics omit an inline color table. They are decoded with the executable's +separate `PAL/999` resource; the raw DAT and PAL bytes remain separate so their original storage +model is preserved. + +Run `python3 tools/extract_ne_resources.py` from the repository root to regenerate the directory, +then `python3 tools/verify_extracted_assets.py` to verify exact raw-byte round trips and decoded +file structure. diff --git a/original/assets/decoded/audio/wav_02001.wav b/original/assets/decoded/audio/wav_02001.wav new file mode 100644 index 0000000..00dd315 Binary files /dev/null and b/original/assets/decoded/audio/wav_02001.wav differ diff --git a/original/assets/decoded/audio/wav_02002.wav b/original/assets/decoded/audio/wav_02002.wav new file mode 100644 index 0000000..e8c63d9 Binary files /dev/null and b/original/assets/decoded/audio/wav_02002.wav differ diff --git a/original/assets/decoded/audio/wav_02004.wav b/original/assets/decoded/audio/wav_02004.wav new file mode 100644 index 0000000..3a551b8 Binary files /dev/null and b/original/assets/decoded/audio/wav_02004.wav differ diff --git a/original/assets/decoded/audio/wav_02006.wav b/original/assets/decoded/audio/wav_02006.wav new file mode 100644 index 0000000..aa6468a Binary files /dev/null and b/original/assets/decoded/audio/wav_02006.wav differ diff --git a/original/assets/decoded/audio/wav_02007.wav b/original/assets/decoded/audio/wav_02007.wav new file mode 100644 index 0000000..b07ba54 Binary files /dev/null and b/original/assets/decoded/audio/wav_02007.wav differ diff --git a/original/assets/decoded/audio/wav_02008.wav b/original/assets/decoded/audio/wav_02008.wav new file mode 100644 index 0000000..4e48d5a Binary files /dev/null and b/original/assets/decoded/audio/wav_02008.wav differ diff --git a/original/assets/decoded/audio/wav_02011.wav b/original/assets/decoded/audio/wav_02011.wav new file mode 100644 index 0000000..ff5b5b9 Binary files /dev/null and b/original/assets/decoded/audio/wav_02011.wav differ diff --git a/original/assets/decoded/audio/wav_02012.wav b/original/assets/decoded/audio/wav_02012.wav new file mode 100644 index 0000000..9dd905f Binary files /dev/null and b/original/assets/decoded/audio/wav_02012.wav differ diff --git a/original/assets/decoded/audio/wav_02013.wav b/original/assets/decoded/audio/wav_02013.wav new file mode 100644 index 0000000..f80c760 Binary files /dev/null and b/original/assets/decoded/audio/wav_02013.wav differ diff --git a/original/assets/decoded/audio/wav_02015.wav b/original/assets/decoded/audio/wav_02015.wav new file mode 100644 index 0000000..b5de7a1 Binary files /dev/null and b/original/assets/decoded/audio/wav_02015.wav differ diff --git a/original/assets/decoded/audio/wav_02016.wav b/original/assets/decoded/audio/wav_02016.wav new file mode 100644 index 0000000..d0c5f7b Binary files /dev/null and b/original/assets/decoded/audio/wav_02016.wav differ diff --git a/original/assets/decoded/audio/wav_02017.wav b/original/assets/decoded/audio/wav_02017.wav new file mode 100644 index 0000000..cf150b7 Binary files /dev/null and b/original/assets/decoded/audio/wav_02017.wav differ diff --git a/original/assets/decoded/audio/wav_02019.wav b/original/assets/decoded/audio/wav_02019.wav new file mode 100644 index 0000000..f3c3c9f Binary files /dev/null and b/original/assets/decoded/audio/wav_02019.wav differ diff --git a/original/assets/decoded/audio/wav_02020.wav b/original/assets/decoded/audio/wav_02020.wav new file mode 100644 index 0000000..5e5d618 Binary files /dev/null and b/original/assets/decoded/audio/wav_02020.wav differ diff --git a/original/assets/decoded/audio/wav_02021.wav b/original/assets/decoded/audio/wav_02021.wav new file mode 100644 index 0000000..e65fd04 Binary files /dev/null and b/original/assets/decoded/audio/wav_02021.wav differ diff --git a/original/assets/decoded/audio/wav_02022.wav b/original/assets/decoded/audio/wav_02022.wav new file mode 100644 index 0000000..6405869 Binary files /dev/null and b/original/assets/decoded/audio/wav_02022.wav differ diff --git a/original/assets/decoded/dialogs/dialog_32512.json b/original/assets/decoded/dialogs/dialog_32512.json new file mode 100644 index 0000000..9751b57 --- /dev/null +++ b/original/assets/decoded/dialogs/dialog_32512.json @@ -0,0 +1,169 @@ +{ + "style": "0x00c800c0", + "bounds": { + "x": 20, + "y": 24, + "width": 202, + "height": 130 + }, + "menu": null, + "class": null, + "caption": "File Open", + "declared_control_count": 10, + "controls": [ + { + "id": 65535, + "bounds": { + "x": 6, + "y": 8, + "width": 36, + "height": 10 + }, + "style": "0x50020000", + "class": { + "class_atom": "STATIC" + }, + "title": "File&name:", + "extra_hex": "" + }, + { + "id": 100, + "bounds": { + "x": 42, + "y": 6, + "width": 98, + "height": 12 + }, + "style": "0x50810080", + "class": { + "class_atom": "EDIT" + }, + "title": null, + "extra_hex": "" + }, + { + "id": 65535, + "bounds": { + "x": 6, + "y": 20, + "width": 36, + "height": 10 + }, + "style": "0x50020000", + "class": { + "class_atom": "STATIC" + }, + "title": "Directory:", + "extra_hex": "" + }, + { + "id": 101, + "bounds": { + "x": 42, + "y": 20, + "width": 98, + "height": 10 + }, + "style": "0x50020000", + "class": { + "class_atom": "STATIC" + }, + "title": null, + "extra_hex": "" + }, + { + "id": 65535, + "bounds": { + "x": 6, + "y": 32, + "width": 64, + "height": 10 + }, + "style": "0x50020000", + "class": { + "class_atom": "STATIC" + }, + "title": "&Files:", + "extra_hex": "" + }, + { + "id": 102, + "bounds": { + "x": 6, + "y": 44, + "width": 64, + "height": 82 + }, + "style": "0x50a10003", + "class": { + "class_atom": "LISTBOX" + }, + "title": null, + "extra_hex": "" + }, + { + "id": 65535, + "bounds": { + "x": 76, + "y": 32, + "width": 64, + "height": 10 + }, + "style": "0x50020000", + "class": { + "class_atom": "STATIC" + }, + "title": "&Directories:", + "extra_hex": "" + }, + { + "id": 103, + "bounds": { + "x": 76, + "y": 44, + "width": 64, + "height": 82 + }, + "style": "0x50a10003", + "class": { + "class_atom": "LISTBOX" + }, + "title": null, + "extra_hex": "" + }, + { + "id": 1, + "bounds": { + "x": 146, + "y": 5, + "width": 50, + "height": 14 + }, + "style": "0x50010001", + "class": { + "class_atom": "BUTTON" + }, + "title": "OK", + "extra_hex": "" + }, + { + "id": 2, + "bounds": { + "x": 146, + "y": 23, + "width": 50, + "height": 14 + }, + "style": "0x50010000", + "class": { + "class_atom": "BUTTON" + }, + "title": "Cancel", + "extra_hex": "" + } + ], + "font": { + "point_size": 8, + "name": "Helv" + } +} diff --git a/original/assets/decoded/dialogs/dialog_32513.json b/original/assets/decoded/dialogs/dialog_32513.json new file mode 100644 index 0000000..f55ea54 --- /dev/null +++ b/original/assets/decoded/dialogs/dialog_32513.json @@ -0,0 +1,139 @@ +{ + "style": "0x00c800c0", + "bounds": { + "x": 20, + "y": 24, + "width": 202, + "height": 130 + }, + "menu": null, + "class": null, + "caption": "File Save As", + "declared_control_count": 8, + "controls": [ + { + "id": 65535, + "bounds": { + "x": 6, + "y": 8, + "width": 36, + "height": 10 + }, + "style": "0x50020000", + "class": { + "class_atom": "STATIC" + }, + "title": "File&name:", + "extra_hex": "" + }, + { + "id": 100, + "bounds": { + "x": 42, + "y": 6, + "width": 98, + "height": 12 + }, + "style": "0x50810080", + "class": { + "class_atom": "EDIT" + }, + "title": null, + "extra_hex": "" + }, + { + "id": 65535, + "bounds": { + "x": 6, + "y": 20, + "width": 36, + "height": 10 + }, + "style": "0x50020000", + "class": { + "class_atom": "STATIC" + }, + "title": "Directory:", + "extra_hex": "" + }, + { + "id": 101, + "bounds": { + "x": 42, + "y": 20, + "width": 98, + "height": 10 + }, + "style": "0x50020000", + "class": { + "class_atom": "STATIC" + }, + "title": null, + "extra_hex": "" + }, + { + "id": 103, + "bounds": { + "x": 6, + "y": 44, + "width": 64, + "height": 82 + }, + "style": "0x50a10003", + "class": { + "class_atom": "LISTBOX" + }, + "title": null, + "extra_hex": "" + }, + { + "id": 65535, + "bounds": { + "x": 6, + "y": 32, + "width": 64, + "height": 10 + }, + "style": "0x50020000", + "class": { + "class_atom": "STATIC" + }, + "title": "&Directories:", + "extra_hex": "" + }, + { + "id": 1, + "bounds": { + "x": 146, + "y": 5, + "width": 50, + "height": 14 + }, + "style": "0x50010001", + "class": { + "class_atom": "BUTTON" + }, + "title": "OK", + "extra_hex": "" + }, + { + "id": 2, + "bounds": { + "x": 146, + "y": 23, + "width": 50, + "height": 14 + }, + "style": "0x50010000", + "class": { + "class_atom": "BUTTON" + }, + "title": "Cancel", + "extra_hex": "" + } + ], + "font": { + "point_size": 8, + "name": "Helv" + } +} diff --git a/original/assets/decoded/dialogs/dialog_32514.json b/original/assets/decoded/dialogs/dialog_32514.json new file mode 100644 index 0000000..1decccd --- /dev/null +++ b/original/assets/decoded/dialogs/dialog_32514.json @@ -0,0 +1,79 @@ +{ + "style": "0x80c00040", + "bounds": { + "x": 20, + "y": 24, + "width": 180, + "height": 64 + }, + "menu": null, + "class": null, + "caption": null, + "declared_control_count": 4, + "controls": [ + { + "id": 101, + "bounds": { + "x": 10, + "y": 20, + "width": 160, + "height": 12 + }, + "style": "0x50810080", + "class": { + "class_atom": "EDIT" + }, + "title": null, + "extra_hex": "" + }, + { + "id": 100, + "bounds": { + "x": 10, + "y": 8, + "width": 160, + "height": 10 + }, + "style": "0x50020000", + "class": { + "class_atom": "STATIC" + }, + "title": null, + "extra_hex": "" + }, + { + "id": 1, + "bounds": { + "x": 47, + "y": 42, + "width": 40, + "height": 14 + }, + "style": "0x50010001", + "class": { + "class_atom": "BUTTON" + }, + "title": "OK", + "extra_hex": "" + }, + { + "id": 2, + "bounds": { + "x": 93, + "y": 42, + "width": 40, + "height": 14 + }, + "style": "0x50010000", + "class": { + "class_atom": "BUTTON" + }, + "title": "Cancel", + "extra_hex": "" + } + ], + "font": { + "point_size": 8, + "name": "Helv" + } +} diff --git a/original/assets/decoded/dialogs/dialog_32515.json b/original/assets/decoded/dialogs/dialog_32515.json new file mode 100644 index 0000000..e2e757c --- /dev/null +++ b/original/assets/decoded/dialogs/dialog_32515.json @@ -0,0 +1,217 @@ +{ + "style": "0x80c800c0", + "bounds": { + "x": 24, + "y": 19, + "width": 199, + "height": 135 + }, + "menu": null, + "class": "BorDlg", + "caption": "File Open", + "declared_control_count": 14, + "controls": [ + { + "id": 65535, + "bounds": { + "x": 8, + "y": 8, + "width": 36, + "height": 10 + }, + "style": "0x50020000", + "class": { + "class_atom": "STATIC" + }, + "title": "File&name:", + "extra_hex": "" + }, + { + "id": 100, + "bounds": { + "x": 44, + "y": 6, + "width": 104, + "height": 12 + }, + "style": "0x50810080", + "class": { + "class_atom": "EDIT" + }, + "title": null, + "extra_hex": "" + }, + { + "id": 65535, + "bounds": { + "x": 8, + "y": 20, + "width": 36, + "height": 10 + }, + "style": "0x50020000", + "class": { + "class_atom": "STATIC" + }, + "title": "Directory:", + "extra_hex": "" + }, + { + "id": 101, + "bounds": { + "x": 44, + "y": 20, + "width": 104, + "height": 10 + }, + "style": "0x50020000", + "class": { + "class_atom": "STATIC" + }, + "title": null, + "extra_hex": "" + }, + { + "id": 65535, + "bounds": { + "x": 8, + "y": 39, + "width": 21, + "height": 8 + }, + "style": "0x50020000", + "class": { + "class_atom": "STATIC" + }, + "title": "&Files:", + "extra_hex": "" + }, + { + "id": 102, + "bounds": { + "x": 8, + "y": 48, + "width": 64, + "height": 82 + }, + "style": "0x50a10003", + "class": { + "class_atom": "LISTBOX" + }, + "title": null, + "extra_hex": "" + }, + { + "id": 65535, + "bounds": { + "x": 84, + "y": 39, + "width": 40, + "height": 8 + }, + "style": "0x50020000", + "class": { + "class_atom": "STATIC" + }, + "title": "&Directories:", + "extra_hex": "" + }, + { + "id": 103, + "bounds": { + "x": 84, + "y": 48, + "width": 64, + "height": 82 + }, + "style": "0x50a10003", + "class": { + "class_atom": "LISTBOX" + }, + "title": null, + "extra_hex": "" + }, + { + "id": 104, + "bounds": { + "x": 4, + "y": 4, + "width": 148, + "height": 28 + }, + "style": "0x50000001", + "class": "BorShade", + "title": null, + "extra_hex": "" + }, + { + "id": 105, + "bounds": { + "x": 4, + "y": 36, + "width": 72, + "height": 96 + }, + "style": "0x50000001", + "class": "BorShade", + "title": null, + "extra_hex": "" + }, + { + "id": 1, + "bounds": { + "x": 160, + "y": 7, + "width": 36, + "height": 24 + }, + "style": "0x50010001", + "class": "BorBtn", + "title": "Button", + "extra_hex": "" + }, + { + "id": 2, + "bounds": { + "x": 160, + "y": 37, + "width": 36, + "height": 24 + }, + "style": "0x50010000", + "class": "BorBtn", + "title": "Button", + "extra_hex": "" + }, + { + "id": 106, + "bounds": { + "x": 156, + "y": -1, + "width": 4, + "height": 136 + }, + "style": "0x50000003", + "class": "BorShade", + "title": null, + "extra_hex": "" + }, + { + "id": 107, + "bounds": { + "x": 80, + "y": 36, + "width": 72, + "height": 96 + }, + "style": "0x50000001", + "class": "BorShade", + "title": null, + "extra_hex": "" + } + ], + "font": { + "point_size": 8, + "name": "Helv" + } +} diff --git a/original/assets/decoded/dialogs/dialog_32516.json b/original/assets/decoded/dialogs/dialog_32516.json new file mode 100644 index 0000000..e562a25 --- /dev/null +++ b/original/assets/decoded/dialogs/dialog_32516.json @@ -0,0 +1,174 @@ +{ + "style": "0x80c800c0", + "bounds": { + "x": 20, + "y": 24, + "width": 202, + "height": 135 + }, + "menu": null, + "class": "BorDlg", + "caption": "File Save As", + "declared_control_count": 11, + "controls": [ + { + "id": 65535, + "bounds": { + "x": 8, + "y": 8, + "width": 36, + "height": 12 + }, + "style": "0x50020000", + "class": { + "class_atom": "STATIC" + }, + "title": "File&name:", + "extra_hex": "" + }, + { + "id": 100, + "bounds": { + "x": 44, + "y": 8, + "width": 96, + "height": 12 + }, + "style": "0x50810080", + "class": { + "class_atom": "EDIT" + }, + "title": null, + "extra_hex": "" + }, + { + "id": 65535, + "bounds": { + "x": 8, + "y": 20, + "width": 36, + "height": 8 + }, + "style": "0x50020000", + "class": { + "class_atom": "STATIC" + }, + "title": "Directory:", + "extra_hex": "" + }, + { + "id": 101, + "bounds": { + "x": 44, + "y": 20, + "width": 98, + "height": 10 + }, + "style": "0x50020000", + "class": { + "class_atom": "STATIC" + }, + "title": null, + "extra_hex": "" + }, + { + "id": 103, + "bounds": { + "x": 8, + "y": 48, + "width": 64, + "height": 82 + }, + "style": "0x50a10003", + "class": { + "class_atom": "LISTBOX" + }, + "title": null, + "extra_hex": "" + }, + { + "id": 65535, + "bounds": { + "x": 8, + "y": 37, + "width": 64, + "height": 8 + }, + "style": "0x50020000", + "class": { + "class_atom": "STATIC" + }, + "title": "&Directories:", + "extra_hex": "" + }, + { + "id": 65535, + "bounds": { + "x": 4, + "y": 4, + "width": 140, + "height": 27 + }, + "style": "0x50000001", + "class": "BorShade", + "title": null, + "extra_hex": "" + }, + { + "id": 65535, + "bounds": { + "x": 4, + "y": 36, + "width": 72, + "height": 96 + }, + "style": "0x50000001", + "class": "BorShade", + "title": null, + "extra_hex": "" + }, + { + "id": 1, + "bounds": { + "x": 164, + "y": 4, + "width": 32, + "height": 20 + }, + "style": "0x50010001", + "class": "BorBtn", + "title": "Button", + "extra_hex": "" + }, + { + "id": 2, + "bounds": { + "x": 164, + "y": 32, + "width": 32, + "height": 20 + }, + "style": "0x50010000", + "class": "BorBtn", + "title": "Button", + "extra_hex": "" + }, + { + "id": 105, + "bounds": { + "x": 160, + "y": 0, + "width": 2, + "height": 136 + }, + "style": "0x50000003", + "class": "BorShade", + "title": null, + "extra_hex": "" + } + ], + "font": { + "point_size": 8, + "name": "Helv" + } +} diff --git a/original/assets/decoded/dialogs/dialog_32517.json b/original/assets/decoded/dialogs/dialog_32517.json new file mode 100644 index 0000000..9b45682 --- /dev/null +++ b/original/assets/decoded/dialogs/dialog_32517.json @@ -0,0 +1,88 @@ +{ + "style": "0x80c800c0", + "bounds": { + "x": 20, + "y": 24, + "width": 180, + "height": 75 + }, + "menu": null, + "class": "BorDlg", + "caption": null, + "declared_control_count": 5, + "controls": [ + { + "id": 101, + "bounds": { + "x": 10, + "y": 20, + "width": 160, + "height": 12 + }, + "style": "0x50810080", + "class": { + "class_atom": "EDIT" + }, + "title": null, + "extra_hex": "" + }, + { + "id": 100, + "bounds": { + "x": 10, + "y": 8, + "width": 160, + "height": 10 + }, + "style": "0x50020000", + "class": { + "class_atom": "STATIC" + }, + "title": null, + "extra_hex": "" + }, + { + "id": 102, + "bounds": { + "x": 6, + "y": 5, + "width": 168, + "height": 32 + }, + "style": "0x50000001", + "class": "BorShade", + "title": null, + "extra_hex": "" + }, + { + "id": 1, + "bounds": { + "x": 42, + "y": 44, + "width": 36, + "height": 24 + }, + "style": "0x50010001", + "class": "BorBtn", + "title": "Button", + "extra_hex": "" + }, + { + "id": 2, + "bounds": { + "x": 102, + "y": 44, + "width": 36, + "height": 24 + }, + "style": "0x50010000", + "class": "BorBtn", + "title": "Button", + "extra_hex": "" + } + ], + "font": { + "point_size": 8, + "name": "Helv" + } +} diff --git a/original/assets/decoded/icons/icon_00001.ico b/original/assets/decoded/icons/icon_00001.ico new file mode 100644 index 0000000..a8b945a Binary files /dev/null and b/original/assets/decoded/icons/icon_00001.ico differ diff --git a/original/assets/decoded/icons/icon_00001.png b/original/assets/decoded/icons/icon_00001.png new file mode 100644 index 0000000..c7602f4 Binary files /dev/null and b/original/assets/decoded/icons/icon_00001.png differ diff --git a/original/assets/decoded/images/bitmap_00101.bmp b/original/assets/decoded/images/bitmap_00101.bmp new file mode 100644 index 0000000..9a7546f Binary files /dev/null and b/original/assets/decoded/images/bitmap_00101.bmp differ diff --git a/original/assets/decoded/images/bitmap_00101.png b/original/assets/decoded/images/bitmap_00101.png new file mode 100644 index 0000000..4c50204 Binary files /dev/null and b/original/assets/decoded/images/bitmap_00101.png differ diff --git a/original/assets/decoded/images/bitmap_00102.bmp b/original/assets/decoded/images/bitmap_00102.bmp new file mode 100644 index 0000000..cfa96d5 Binary files /dev/null and b/original/assets/decoded/images/bitmap_00102.bmp differ diff --git a/original/assets/decoded/images/bitmap_00102.png b/original/assets/decoded/images/bitmap_00102.png new file mode 100644 index 0000000..ea23b8e Binary files /dev/null and b/original/assets/decoded/images/bitmap_00102.png differ diff --git a/original/assets/decoded/images/bitmap_00500.bmp b/original/assets/decoded/images/bitmap_00500.bmp new file mode 100644 index 0000000..e7e8d8c Binary files /dev/null and b/original/assets/decoded/images/bitmap_00500.bmp differ diff --git a/original/assets/decoded/images/bitmap_00500.png b/original/assets/decoded/images/bitmap_00500.png new file mode 100644 index 0000000..c6c2ca0 Binary files /dev/null and b/original/assets/decoded/images/bitmap_00500.png differ diff --git a/original/assets/decoded/images/dat_00400.png b/original/assets/decoded/images/dat_00400.png new file mode 100644 index 0000000..cc787aa Binary files /dev/null and b/original/assets/decoded/images/dat_00400.png differ diff --git a/original/assets/decoded/images/dat_00401.png b/original/assets/decoded/images/dat_00401.png new file mode 100644 index 0000000..043448e Binary files /dev/null and b/original/assets/decoded/images/dat_00401.png differ diff --git a/original/assets/decoded/images/dat_00402.png b/original/assets/decoded/images/dat_00402.png new file mode 100644 index 0000000..65596c0 Binary files /dev/null and b/original/assets/decoded/images/dat_00402.png differ diff --git a/original/assets/decoded/images/dat_00403.png b/original/assets/decoded/images/dat_00403.png new file mode 100644 index 0000000..4856661 Binary files /dev/null and b/original/assets/decoded/images/dat_00403.png differ diff --git a/original/assets/decoded/images/dat_00404.png b/original/assets/decoded/images/dat_00404.png new file mode 100644 index 0000000..278cd02 Binary files /dev/null and b/original/assets/decoded/images/dat_00404.png differ diff --git a/original/assets/decoded/images/dat_00405.png b/original/assets/decoded/images/dat_00405.png new file mode 100644 index 0000000..9205d80 Binary files /dev/null and b/original/assets/decoded/images/dat_00405.png differ diff --git a/original/assets/decoded/images/dat_00406.png b/original/assets/decoded/images/dat_00406.png new file mode 100644 index 0000000..71e3de4 Binary files /dev/null and b/original/assets/decoded/images/dat_00406.png differ diff --git a/original/assets/decoded/images/dat_00407.png b/original/assets/decoded/images/dat_00407.png new file mode 100644 index 0000000..ef885a0 Binary files /dev/null and b/original/assets/decoded/images/dat_00407.png differ diff --git a/original/assets/decoded/images/dat_00600.png b/original/assets/decoded/images/dat_00600.png new file mode 100644 index 0000000..c02b707 Binary files /dev/null and b/original/assets/decoded/images/dat_00600.png differ diff --git a/original/assets/decoded/images/dat_00701.png b/original/assets/decoded/images/dat_00701.png new file mode 100644 index 0000000..982779d Binary files /dev/null and b/original/assets/decoded/images/dat_00701.png differ diff --git a/original/assets/decoded/images/dat_00702.png b/original/assets/decoded/images/dat_00702.png new file mode 100644 index 0000000..8296ac6 Binary files /dev/null and b/original/assets/decoded/images/dat_00702.png differ diff --git a/original/assets/decoded/images/dat_00703.png b/original/assets/decoded/images/dat_00703.png new file mode 100644 index 0000000..fdc82af Binary files /dev/null and b/original/assets/decoded/images/dat_00703.png differ diff --git a/original/assets/decoded/images/dat_00704.png b/original/assets/decoded/images/dat_00704.png new file mode 100644 index 0000000..ce88ab6 Binary files /dev/null and b/original/assets/decoded/images/dat_00704.png differ diff --git a/original/assets/decoded/images/dat_00801.png b/original/assets/decoded/images/dat_00801.png new file mode 100644 index 0000000..d89ef04 Binary files /dev/null and b/original/assets/decoded/images/dat_00801.png differ diff --git a/original/assets/decoded/images/dat_00802.png b/original/assets/decoded/images/dat_00802.png new file mode 100644 index 0000000..8e9df7c Binary files /dev/null and b/original/assets/decoded/images/dat_00802.png differ diff --git a/original/assets/decoded/images/dat_00803.png b/original/assets/decoded/images/dat_00803.png new file mode 100644 index 0000000..454d5cb Binary files /dev/null and b/original/assets/decoded/images/dat_00803.png differ diff --git a/original/assets/decoded/images/dat_00804.png b/original/assets/decoded/images/dat_00804.png new file mode 100644 index 0000000..e635c95 Binary files /dev/null and b/original/assets/decoded/images/dat_00804.png differ diff --git a/original/assets/decoded/images/dat_00805.png b/original/assets/decoded/images/dat_00805.png new file mode 100644 index 0000000..4427216 Binary files /dev/null and b/original/assets/decoded/images/dat_00805.png differ diff --git a/original/assets/decoded/images/dat_00806.png b/original/assets/decoded/images/dat_00806.png new file mode 100644 index 0000000..103e955 Binary files /dev/null and b/original/assets/decoded/images/dat_00806.png differ diff --git a/original/assets/decoded/images/dat_00807.png b/original/assets/decoded/images/dat_00807.png new file mode 100644 index 0000000..a5f2cfa Binary files /dev/null and b/original/assets/decoded/images/dat_00807.png differ diff --git a/original/assets/decoded/images/dat_00808.png b/original/assets/decoded/images/dat_00808.png new file mode 100644 index 0000000..9f70c2c Binary files /dev/null and b/original/assets/decoded/images/dat_00808.png differ diff --git a/original/assets/decoded/images/dat_00809.png b/original/assets/decoded/images/dat_00809.png new file mode 100644 index 0000000..e3318f0 Binary files /dev/null and b/original/assets/decoded/images/dat_00809.png differ diff --git a/original/assets/decoded/images/dat_00900.png b/original/assets/decoded/images/dat_00900.png new file mode 100644 index 0000000..98a8883 Binary files /dev/null and b/original/assets/decoded/images/dat_00900.png differ diff --git a/original/assets/decoded/images/dat_00901.png b/original/assets/decoded/images/dat_00901.png new file mode 100644 index 0000000..cc8e919 Binary files /dev/null and b/original/assets/decoded/images/dat_00901.png differ diff --git a/original/assets/decoded/images/dat_00993.png b/original/assets/decoded/images/dat_00993.png new file mode 100644 index 0000000..377fec4 Binary files /dev/null and b/original/assets/decoded/images/dat_00993.png differ diff --git a/original/assets/decoded/images/dat_00994.png b/original/assets/decoded/images/dat_00994.png new file mode 100644 index 0000000..0139954 Binary files /dev/null and b/original/assets/decoded/images/dat_00994.png differ diff --git a/original/assets/decoded/images/dat_00995.png b/original/assets/decoded/images/dat_00995.png new file mode 100644 index 0000000..494ae75 Binary files /dev/null and b/original/assets/decoded/images/dat_00995.png differ diff --git a/original/assets/decoded/images/dat_00997.png b/original/assets/decoded/images/dat_00997.png new file mode 100644 index 0000000..b99e127 Binary files /dev/null and b/original/assets/decoded/images/dat_00997.png differ diff --git a/original/assets/decoded/images/dat_00998.png b/original/assets/decoded/images/dat_00998.png new file mode 100644 index 0000000..1ae93f5 Binary files /dev/null and b/original/assets/decoded/images/dat_00998.png differ diff --git a/original/assets/decoded/images/dat_01001.png b/original/assets/decoded/images/dat_01001.png new file mode 100644 index 0000000..62dec93 Binary files /dev/null and b/original/assets/decoded/images/dat_01001.png differ diff --git a/original/assets/decoded/images/dat_01002.png b/original/assets/decoded/images/dat_01002.png new file mode 100644 index 0000000..32e2682 Binary files /dev/null and b/original/assets/decoded/images/dat_01002.png differ diff --git a/original/assets/decoded/images/dat_01003.png b/original/assets/decoded/images/dat_01003.png new file mode 100644 index 0000000..790b54d Binary files /dev/null and b/original/assets/decoded/images/dat_01003.png differ diff --git a/original/assets/decoded/images/dat_01004.png b/original/assets/decoded/images/dat_01004.png new file mode 100644 index 0000000..e4bc7f1 Binary files /dev/null and b/original/assets/decoded/images/dat_01004.png differ diff --git a/original/assets/decoded/images/dat_01005.png b/original/assets/decoded/images/dat_01005.png new file mode 100644 index 0000000..fecec15 Binary files /dev/null and b/original/assets/decoded/images/dat_01005.png differ diff --git a/original/assets/decoded/metadata/version_00001.json b/original/assets/decoded/metadata/version_00001.json new file mode 100644 index 0000000..b0f66fc --- /dev/null +++ b/original/assets/decoded/metadata/version_00001.json @@ -0,0 +1,38 @@ +{ + "printable_strings": [ + "VS_VERSION_INFO", + "StringFileInfo", + "040904E4", + "CompanyName", + "Lars Hammer / KIWI Hamburg", + "FileDescription", + "TDK Pinball Machine", + "FileVersion", + "1.00", + "InternalName", + "TDKPIN", + "LegalCopyright", + "Developed 1995 by KIWI Von Wendt Konzept GmbH.", + "ProductName", + "TDK Pinball Machine", + "ProductVersion", + "3.10.0.0", + "VarFileInfo", + "Translation" + ], + "fixed_file_info": { + "signature": "0xfeef04bd", + "structure_version": "0x00010000", + "file_version_ms": "0x00000000", + "file_version_ls": "0x00010006", + "product_version_ms": "0x00030001", + "product_version_ls": "0x00000000", + "file_flags_mask": "0x00000000", + "file_flags": "0x00000000", + "file_os": "0x00000001", + "file_type": "0x00000002", + "file_subtype": "0x00000000", + "file_date_ms": "0x00000000", + "file_date_ls": "0x00000000" + } +} diff --git a/original/assets/decoded/palettes/palette_0999.gpl b/original/assets/decoded/palettes/palette_0999.gpl new file mode 100644 index 0000000..d0fc73c --- /dev/null +++ b/original/assets/decoded/palettes/palette_0999.gpl @@ -0,0 +1,260 @@ +GIMP Palette +Name: TDKPIN resource 999 +Columns: 16 +# + 0 0 0 Index 0 +128 0 0 Index 1 + 0 128 0 Index 2 +128 128 0 Index 3 + 0 0 128 Index 4 +128 0 128 Index 5 + 0 128 128 Index 6 +192 192 192 Index 7 +192 220 192 Index 8 +166 202 240 Index 9 + 32 32 184 Index 10 + 72 32 184 Index 11 +112 32 184 Index 12 +152 32 184 Index 13 +192 32 184 Index 14 +232 32 184 Index 15 + 32 32 240 Index 16 + 72 32 240 Index 17 +112 32 240 Index 18 +152 32 240 Index 19 +192 32 240 Index 20 +232 32 240 Index 21 +124 76 48 Index 22 +140 84 56 Index 23 + 32 72 16 Index 24 + 72 72 16 Index 25 +112 72 16 Index 26 +152 72 16 Index 27 +192 72 16 Index 28 +232 72 16 Index 29 + 32 72 72 Index 30 + 72 72 72 Index 31 +112 72 72 Index 32 +152 72 72 Index 33 +192 72 72 Index 34 +232 72 72 Index 35 + 32 72 128 Index 36 + 72 72 128 Index 37 +112 72 128 Index 38 +152 72 128 Index 39 +192 72 128 Index 40 +232 72 128 Index 41 + 32 72 184 Index 42 + 72 72 184 Index 43 +112 72 184 Index 44 +152 72 184 Index 45 +192 72 184 Index 46 +232 72 184 Index 47 + 32 72 240 Index 48 + 72 72 240 Index 49 +112 72 240 Index 50 +152 72 240 Index 51 +192 72 240 Index 52 +232 72 240 Index 53 +152 92 64 Index 54 +168 100 76 Index 55 + 32 112 16 Index 56 + 72 112 16 Index 57 +112 112 16 Index 58 +152 112 16 Index 59 +192 112 16 Index 60 +232 112 16 Index 61 + 32 112 72 Index 62 + 72 112 72 Index 63 +112 112 72 Index 64 +152 112 72 Index 65 +192 112 72 Index 66 +232 112 72 Index 67 + 32 112 128 Index 68 + 72 112 128 Index 69 +112 112 128 Index 70 +152 112 128 Index 71 +192 112 128 Index 72 +232 112 128 Index 73 + 32 112 184 Index 74 + 72 112 184 Index 75 +112 112 184 Index 76 +152 112 184 Index 77 +192 112 184 Index 78 +232 112 184 Index 79 + 32 112 240 Index 80 + 72 112 240 Index 81 +112 112 240 Index 82 +152 112 240 Index 83 +192 112 240 Index 84 +232 112 240 Index 85 +176 116 96 Index 86 +188 136 104 Index 87 + 32 152 16 Index 88 + 72 152 16 Index 89 +112 152 16 Index 90 +152 152 16 Index 91 +192 152 16 Index 92 +232 152 16 Index 93 + 32 152 72 Index 94 + 72 152 72 Index 95 +112 152 72 Index 96 +152 152 72 Index 97 +192 152 72 Index 98 +232 152 72 Index 99 + 32 152 128 Index 100 + 72 152 128 Index 101 +112 152 128 Index 102 +152 152 128 Index 103 +192 152 128 Index 104 +232 152 128 Index 105 + 32 152 184 Index 106 + 72 152 184 Index 107 +112 152 184 Index 108 +152 152 184 Index 109 +192 152 184 Index 110 +232 152 184 Index 111 + 32 152 240 Index 112 + 72 152 240 Index 113 +112 152 240 Index 114 +152 152 240 Index 115 +192 152 240 Index 116 +232 152 240 Index 117 +200 144 108 Index 118 +208 160 116 Index 119 + 32 192 16 Index 120 + 72 192 16 Index 121 +112 192 16 Index 122 +152 192 16 Index 123 +192 192 16 Index 124 +232 192 16 Index 125 + 32 192 72 Index 126 + 72 192 72 Index 127 +112 192 72 Index 128 +152 192 72 Index 129 +192 192 72 Index 130 +232 192 72 Index 131 + 32 192 128 Index 132 + 72 192 128 Index 133 +112 192 128 Index 134 +152 192 128 Index 135 +192 192 128 Index 136 +232 192 128 Index 137 + 32 192 184 Index 138 + 72 192 184 Index 139 +112 192 184 Index 140 +152 192 184 Index 141 +192 192 184 Index 142 +232 192 184 Index 143 + 32 192 240 Index 144 + 72 192 240 Index 145 +112 192 240 Index 146 +152 192 240 Index 147 +192 192 240 Index 148 +232 192 240 Index 149 +216 168 128 Index 150 +224 176 144 Index 151 + 32 232 16 Index 152 + 72 232 16 Index 153 +112 232 16 Index 154 +152 232 16 Index 155 +192 232 16 Index 156 +232 232 16 Index 157 + 32 232 72 Index 158 + 72 232 72 Index 159 +112 232 72 Index 160 +152 232 72 Index 161 +192 232 72 Index 162 +232 232 72 Index 163 + 32 232 128 Index 164 + 72 232 128 Index 165 +112 232 128 Index 166 +152 232 128 Index 167 +192 232 128 Index 168 +232 232 128 Index 169 + 32 232 184 Index 170 + 72 232 184 Index 171 +112 232 184 Index 172 +152 232 184 Index 173 +192 232 184 Index 174 +232 232 184 Index 175 + 32 232 240 Index 176 + 72 232 240 Index 177 +112 232 240 Index 178 +152 232 240 Index 179 +192 232 240 Index 180 +232 232 240 Index 181 +232 192 156 Index 182 +240 212 184 Index 183 + 0 56 0 Index 184 + 0 96 0 Index 185 + 0 160 0 Index 186 + 0 208 0 Index 187 +208 208 0 Index 188 +160 160 0 Index 189 + 96 96 0 Index 190 + 56 56 0 Index 191 + 56 0 0 Index 192 + 96 0 0 Index 193 +160 0 0 Index 194 +208 0 0 Index 195 +208 0 208 Index 196 +160 0 160 Index 197 + 96 0 96 Index 198 + 56 0 56 Index 199 + 0 0 56 Index 200 + 0 0 96 Index 201 + 0 0 160 Index 202 + 0 0 208 Index 203 + 16 16 16 Index 204 + 32 32 32 Index 205 + 48 48 48 Index 206 + 64 64 64 Index 207 + 80 80 80 Index 208 + 96 96 96 Index 209 +112 112 112 Index 210 +144 144 144 Index 211 +160 160 160 Index 212 +176 176 176 Index 213 +208 208 208 Index 214 +224 224 224 Index 215 +240 240 240 Index 216 + 76 40 28 Index 217 + 76 28 40 Index 218 + 40 76 28 Index 219 + 28 76 40 Index 220 + 40 28 76 Index 221 + 28 40 76 Index 222 +108 88 32 Index 223 +160 124 88 Index 224 +232 168 104 Index 225 + 84 48 16 Index 226 + 92 56 40 Index 227 + 32 32 16 Index 228 + 72 32 16 Index 229 +112 32 16 Index 230 +152 32 16 Index 231 +192 32 16 Index 232 +232 32 16 Index 233 + 32 32 72 Index 234 + 72 32 72 Index 235 +112 32 72 Index 236 +152 32 72 Index 237 +192 32 72 Index 238 +232 32 72 Index 239 + 32 32 128 Index 240 + 72 32 128 Index 241 +112 32 128 Index 242 +152 32 128 Index 243 +192 32 128 Index 244 +232 32 128 Index 245 +255 251 240 Index 246 +160 160 164 Index 247 +128 128 128 Index 248 +255 0 0 Index 249 + 0 255 0 Index 250 +255 255 0 Index 251 + 0 0 255 Index 252 +255 0 255 Index 253 + 0 255 255 Index 254 +255 255 255 Index 255 diff --git a/original/assets/decoded/palettes/palette_0999.png b/original/assets/decoded/palettes/palette_0999.png new file mode 100644 index 0000000..5e0c6ad Binary files /dev/null and b/original/assets/decoded/palettes/palette_0999.png differ diff --git a/original/assets/manifest.json b/original/assets/manifest.json new file mode 100644 index 0000000..e76d5e9 --- /dev/null +++ b/original/assets/manifest.json @@ -0,0 +1,1307 @@ +{ + "source": "TDKPIN.EXE", + "source_sha256": "a9022f1894e3e6e21fc42e8f6c932f7c549ca77f63aaa0c488bb9d55d9d0174c", + "resource_count": 63, + "ne": { + "ne_header_offset": 256, + "resource_table_offset": 368, + "resource_table_end": 1204, + "alignment_shift": 8, + "alignment_bytes": 256 + }, + "resources": [ + { + "type": "DAT", + "id": "400", + "file_offset": 118272, + "allocated_size": 5632, + "flags": "0x0c00", + "raw_sha256": "ae9dbc3c6b2d559a17c5ccd5827d5e7b89bdebb48b3dbbd350696076d518a7da", + "raw_path": "assets/raw/DAT/00400.bin", + "decoded_paths": [ + "assets/decoded/images/dat_00400.png" + ], + "actual_size": 5452, + "image": { + "width": 42, + "height": 123, + "planes": 1, + "bits_per_pixel": 8, + "compression": 0, + "image_size": 5412, + "colors_used": 256 + } + }, + { + "type": "DAT", + "id": "401", + "file_offset": 123904, + "allocated_size": 5632, + "flags": "0x0c00", + "raw_sha256": "599086497dcc01ebc63d007ae3d0599d581b0434eb91333f42a5f099b92efd6e", + "raw_path": "assets/raw/DAT/00401.bin", + "decoded_paths": [ + "assets/decoded/images/dat_00401.png" + ], + "actual_size": 5452, + "image": { + "width": 42, + "height": 123, + "planes": 1, + "bits_per_pixel": 8, + "compression": 0, + "image_size": 5412, + "colors_used": 256 + } + }, + { + "type": "DAT", + "id": "402", + "file_offset": 129536, + "allocated_size": 5632, + "flags": "0x0c00", + "raw_sha256": "4bc9cf746a6c09f8a29a4a77c2e6b9288cd7b0688df81f18aad2b9f7182f1019", + "raw_path": "assets/raw/DAT/00402.bin", + "decoded_paths": [ + "assets/decoded/images/dat_00402.png" + ], + "actual_size": 5452, + "image": { + "width": 42, + "height": 123, + "planes": 1, + "bits_per_pixel": 8, + "compression": 0, + "image_size": 5412, + "colors_used": 256 + } + }, + { + "type": "DAT", + "id": "403", + "file_offset": 135168, + "allocated_size": 5632, + "flags": "0x0c00", + "raw_sha256": "b21eb9ce2c8a27966ff9b762545ca6a468eec31add1fbdab0128ef58b450ede5", + "raw_path": "assets/raw/DAT/00403.bin", + "decoded_paths": [ + "assets/decoded/images/dat_00403.png" + ], + "actual_size": 5452, + "image": { + "width": 42, + "height": 123, + "planes": 1, + "bits_per_pixel": 8, + "compression": 0, + "image_size": 5412, + "colors_used": 256 + } + }, + { + "type": "DAT", + "id": "404", + "file_offset": 140800, + "allocated_size": 5632, + "flags": "0x0c00", + "raw_sha256": "c5edea71429f419f688a49b2e494bb3b82b90912b38d59e0b5d6c15f10b75406", + "raw_path": "assets/raw/DAT/00404.bin", + "decoded_paths": [ + "assets/decoded/images/dat_00404.png" + ], + "actual_size": 5452, + "image": { + "width": 42, + "height": 123, + "planes": 1, + "bits_per_pixel": 8, + "compression": 0, + "image_size": 5412, + "colors_used": 256 + } + }, + { + "type": "DAT", + "id": "405", + "file_offset": 146432, + "allocated_size": 5632, + "flags": "0x0c00", + "raw_sha256": "2302a4e768636fc3165a78e1c65f0f604f8db780d5ff2b4007773593945e5537", + "raw_path": "assets/raw/DAT/00405.bin", + "decoded_paths": [ + "assets/decoded/images/dat_00405.png" + ], + "actual_size": 5452, + "image": { + "width": 42, + "height": 123, + "planes": 1, + "bits_per_pixel": 8, + "compression": 0, + "image_size": 5412, + "colors_used": 256 + } + }, + { + "type": "DAT", + "id": "406", + "file_offset": 152064, + "allocated_size": 5632, + "flags": "0x0c00", + "raw_sha256": "a785985480c2e4839d5a4e7aab24d9de67e7cb6f5c1f6b60539e154fc82100d7", + "raw_path": "assets/raw/DAT/00406.bin", + "decoded_paths": [ + "assets/decoded/images/dat_00406.png" + ], + "actual_size": 5452, + "image": { + "width": 42, + "height": 123, + "planes": 1, + "bits_per_pixel": 8, + "compression": 0, + "image_size": 5412, + "colors_used": 256 + } + }, + { + "type": "DAT", + "id": "407", + "file_offset": 157696, + "allocated_size": 5632, + "flags": "0x0c00", + "raw_sha256": "b9b046bf77ac926cba371f1114693705b8b3b086f48a3d5697f1cd707e7a7735", + "raw_path": "assets/raw/DAT/00407.bin", + "decoded_paths": [ + "assets/decoded/images/dat_00407.png" + ], + "actual_size": 5452, + "image": { + "width": 42, + "height": 123, + "planes": 1, + "bits_per_pixel": 8, + "compression": 0, + "image_size": 5412, + "colors_used": 256 + } + }, + { + "type": "DAT", + "id": "600", + "file_offset": 163328, + "allocated_size": 98048, + "flags": "0x0c00", + "raw_sha256": "b40c7f5cd5431ca29f238ac291f7c9c26d9823450acb77b14fed5d06748f5d3e", + "raw_path": "assets/raw/DAT/00600.bin", + "decoded_paths": [ + "assets/decoded/images/dat_00600.png" + ], + "actual_size": 97960, + "image": { + "width": 544, + "height": 180, + "planes": 1, + "bits_per_pixel": 8, + "compression": 0, + "image_size": 97920, + "colors_used": 256 + } + }, + { + "type": "DAT", + "id": "701", + "file_offset": 261376, + "allocated_size": 21248, + "flags": "0x0c00", + "raw_sha256": "52143c98872d315408ba017aab36985939af1a54d6a2caac770c54b78d450da8", + "raw_path": "assets/raw/DAT/00701.bin", + "decoded_paths": [ + "assets/decoded/images/dat_00701.png" + ], + "actual_size": 21056, + "image": { + "width": 146, + "height": 142, + "planes": 1, + "bits_per_pixel": 8, + "compression": 0, + "image_size": 21016, + "colors_used": 256 + } + }, + { + "type": "DAT", + "id": "702", + "file_offset": 282624, + "allocated_size": 21248, + "flags": "0x0c00", + "raw_sha256": "debd1d66cf09ad330408acaf19010dab75fcf5376ee55edd7e1d05e491bf974f", + "raw_path": "assets/raw/DAT/00702.bin", + "decoded_paths": [ + "assets/decoded/images/dat_00702.png" + ], + "actual_size": 21056, + "image": { + "width": 146, + "height": 142, + "planes": 1, + "bits_per_pixel": 8, + "compression": 0, + "image_size": 21016, + "colors_used": 256 + } + }, + { + "type": "DAT", + "id": "703", + "file_offset": 303872, + "allocated_size": 21248, + "flags": "0x0c00", + "raw_sha256": "b3972c40b7a3758e48ee1e4d24119a5d3cf9be032d83d4890e792aed2b9b9500", + "raw_path": "assets/raw/DAT/00703.bin", + "decoded_paths": [ + "assets/decoded/images/dat_00703.png" + ], + "actual_size": 21056, + "image": { + "width": 146, + "height": 142, + "planes": 1, + "bits_per_pixel": 8, + "compression": 0, + "image_size": 21016, + "colors_used": 256 + } + }, + { + "type": "DAT", + "id": "704", + "file_offset": 325120, + "allocated_size": 21248, + "flags": "0x0c00", + "raw_sha256": "33aca071ff68e5e9a886b206122796c1c9027ef5bce6e7ea71442574597ee45f", + "raw_path": "assets/raw/DAT/00704.bin", + "decoded_paths": [ + "assets/decoded/images/dat_00704.png" + ], + "actual_size": 21056, + "image": { + "width": 146, + "height": 142, + "planes": 1, + "bits_per_pixel": 8, + "compression": 0, + "image_size": 21016, + "colors_used": 256 + } + }, + { + "type": "DAT", + "id": "801", + "file_offset": 346368, + "allocated_size": 4352, + "flags": "0x0c00", + "raw_sha256": "5bd5bd78a5f68b0f271337139a7e8cc8214a9c6ac5229f45fe351f2f33ad311f", + "raw_path": "assets/raw/DAT/00801.bin", + "decoded_paths": [ + "assets/decoded/images/dat_00801.png" + ], + "actual_size": 4188, + "image": { + "width": 68, + "height": 61, + "planes": 1, + "bits_per_pixel": 8, + "compression": 0, + "image_size": 4148, + "colors_used": 256 + } + }, + { + "type": "DAT", + "id": "802", + "file_offset": 350720, + "allocated_size": 4352, + "flags": "0x0c00", + "raw_sha256": "8296a852c3e068ff98697aa97feefbd0ba47909eb8f4b3365525b9948bac8f9c", + "raw_path": "assets/raw/DAT/00802.bin", + "decoded_paths": [ + "assets/decoded/images/dat_00802.png" + ], + "actual_size": 4188, + "image": { + "width": 68, + "height": 61, + "planes": 1, + "bits_per_pixel": 8, + "compression": 0, + "image_size": 4148, + "colors_used": 256 + } + }, + { + "type": "DAT", + "id": "803", + "file_offset": 355072, + "allocated_size": 4352, + "flags": "0x0c00", + "raw_sha256": "326f266c75b125bf9bf6af068efc8e7035ab14abe8da23188ab6765f64f7b47e", + "raw_path": "assets/raw/DAT/00803.bin", + "decoded_paths": [ + "assets/decoded/images/dat_00803.png" + ], + "actual_size": 4188, + "image": { + "width": 68, + "height": 61, + "planes": 1, + "bits_per_pixel": 8, + "compression": 0, + "image_size": 4148, + "colors_used": 256 + } + }, + { + "type": "DAT", + "id": "804", + "file_offset": 359424, + "allocated_size": 4352, + "flags": "0x0c00", + "raw_sha256": "5ff7c04e4e1d0ab63d140ee76997a67e12cfed331fa8c0548bd8bb41bd1a15bd", + "raw_path": "assets/raw/DAT/00804.bin", + "decoded_paths": [ + "assets/decoded/images/dat_00804.png" + ], + "actual_size": 4188, + "image": { + "width": 68, + "height": 61, + "planes": 1, + "bits_per_pixel": 8, + "compression": 0, + "image_size": 4148, + "colors_used": 256 + } + }, + { + "type": "DAT", + "id": "805", + "file_offset": 363776, + "allocated_size": 4352, + "flags": "0x0c00", + "raw_sha256": "a21cbbad25b01174ecce93a93e1a164913b50b926f8cbd2ceb207c99d1a4378f", + "raw_path": "assets/raw/DAT/00805.bin", + "decoded_paths": [ + "assets/decoded/images/dat_00805.png" + ], + "actual_size": 4188, + "image": { + "width": 68, + "height": 61, + "planes": 1, + "bits_per_pixel": 8, + "compression": 0, + "image_size": 4148, + "colors_used": 256 + } + }, + { + "type": "DAT", + "id": "806", + "file_offset": 368128, + "allocated_size": 4352, + "flags": "0x0c00", + "raw_sha256": "e4f340dca8dd79f8059ba75abe89cefd27ff8a14f53a8e3dc430787473f3d86b", + "raw_path": "assets/raw/DAT/00806.bin", + "decoded_paths": [ + "assets/decoded/images/dat_00806.png" + ], + "actual_size": 4188, + "image": { + "width": 68, + "height": 61, + "planes": 1, + "bits_per_pixel": 8, + "compression": 0, + "image_size": 4148, + "colors_used": 256 + } + }, + { + "type": "DAT", + "id": "807", + "file_offset": 372480, + "allocated_size": 4352, + "flags": "0x0c00", + "raw_sha256": "20000cf4ffa7174bbb6868a418ec8d0ea413e091d1d976d44f20e019bb71dd10", + "raw_path": "assets/raw/DAT/00807.bin", + "decoded_paths": [ + "assets/decoded/images/dat_00807.png" + ], + "actual_size": 4188, + "image": { + "width": 68, + "height": 61, + "planes": 1, + "bits_per_pixel": 8, + "compression": 0, + "image_size": 4148, + "colors_used": 256 + } + }, + { + "type": "DAT", + "id": "808", + "file_offset": 376832, + "allocated_size": 4352, + "flags": "0x0c00", + "raw_sha256": "a605eb26f9a6f33d789a546993eb5fcb95109d11a4a6a429a1e03129d00b0243", + "raw_path": "assets/raw/DAT/00808.bin", + "decoded_paths": [ + "assets/decoded/images/dat_00808.png" + ], + "actual_size": 4188, + "image": { + "width": 68, + "height": 61, + "planes": 1, + "bits_per_pixel": 8, + "compression": 0, + "image_size": 4148, + "colors_used": 256 + } + }, + { + "type": "DAT", + "id": "809", + "file_offset": 381184, + "allocated_size": 4352, + "flags": "0x0c00", + "raw_sha256": "f1aa5c93967908af758f23b711bde4026899cc467f13ddaf02249083b3fe007e", + "raw_path": "assets/raw/DAT/00809.bin", + "decoded_paths": [ + "assets/decoded/images/dat_00809.png" + ], + "actual_size": 4188, + "image": { + "width": 68, + "height": 61, + "planes": 1, + "bits_per_pixel": 8, + "compression": 0, + "image_size": 4148, + "colors_used": 256 + } + }, + { + "type": "DAT", + "id": "900", + "file_offset": 385536, + "allocated_size": 266496, + "flags": "0x0c00", + "raw_sha256": "25c31f3d3a628f2b102bbe07f09a91c038328fef19004e599bcc601bdbfd43bc", + "raw_path": "assets/raw/DAT/00900.bin", + "decoded_paths": [ + "assets/decoded/images/dat_00900.png" + ], + "actual_size": 266440, + "image": { + "width": 900, + "height": 296, + "planes": 1, + "bits_per_pixel": 8, + "compression": 0, + "image_size": 266400, + "colors_used": 256 + } + }, + { + "type": "DAT", + "id": "901", + "file_offset": 652032, + "allocated_size": 4096, + "flags": "0x0c00", + "raw_sha256": "7b4a732ef13e24c395209841aabcc16c4431096322627fa9beb95d945913b30d", + "raw_path": "assets/raw/DAT/00901.bin", + "decoded_paths": [ + "assets/decoded/images/dat_00901.png" + ], + "actual_size": 3984, + "image": { + "width": 230, + "height": 17, + "planes": 1, + "bits_per_pixel": 8, + "compression": 0, + "image_size": 3944, + "colors_used": 256 + } + }, + { + "type": "DAT", + "id": "993", + "file_offset": 656128, + "allocated_size": 108288, + "flags": "0x0c00", + "raw_sha256": "d8fa546a48c16750bb40715babc6b310a9e8012598fc4448fb4c622894b6afe2", + "raw_path": "assets/raw/DAT/00993.bin", + "decoded_paths": [ + "assets/decoded/images/dat_00993.png" + ], + "actual_size": 108040, + "image": { + "width": 360, + "height": 300, + "planes": 1, + "bits_per_pixel": 8, + "compression": 0, + "image_size": 108000, + "colors_used": 256 + } + }, + { + "type": "DAT", + "id": "994", + "file_offset": 764416, + "allocated_size": 3328, + "flags": "0x0c00", + "raw_sha256": "add4499d6497e08a41d2621a9edc5a9207db55ca7269344b186699023a058085", + "raw_path": "assets/raw/DAT/00994.bin", + "decoded_paths": [ + "assets/decoded/images/dat_00994.png" + ], + "actual_size": 3160, + "image": { + "width": 237, + "height": 13, + "planes": 1, + "bits_per_pixel": 8, + "compression": 0, + "image_size": 3120, + "colors_used": 256 + } + }, + { + "type": "DAT", + "id": "995", + "file_offset": 767744, + "allocated_size": 294656, + "flags": "0x0c00", + "raw_sha256": "28d528340d536b7085c06be9da4d094450463b5b5bed5a6fc04a6e3ef8bae0af", + "raw_path": "assets/raw/DAT/00995.bin", + "decoded_paths": [ + "assets/decoded/images/dat_00995.png" + ], + "actual_size": 294440, + "image": { + "width": 640, + "height": 460, + "planes": 1, + "bits_per_pixel": 8, + "compression": 0, + "image_size": 294400, + "colors_used": 256 + } + }, + { + "type": "DAT", + "id": "997", + "file_offset": 1062400, + "allocated_size": 294656, + "flags": "0x0c00", + "raw_sha256": "8f353daefc21cd5dc13caff892d45bf8f119abe5570ec02cb5e65c5fac471417", + "raw_path": "assets/raw/DAT/00997.bin", + "decoded_paths": [ + "assets/decoded/images/dat_00997.png" + ], + "actual_size": 294440, + "image": { + "width": 640, + "height": 460, + "planes": 1, + "bits_per_pixel": 8, + "compression": 0, + "image_size": 294400, + "colors_used": 256 + } + }, + { + "type": "DAT", + "id": "998", + "file_offset": 1357056, + "allocated_size": 294656, + "flags": "0x0c00", + "raw_sha256": "75a50e0fa18ee1fae783aeca89a08d23f9e58b4dc4a35d25dbb2677711cdf1ba", + "raw_path": "assets/raw/DAT/00998.bin", + "decoded_paths": [ + "assets/decoded/images/dat_00998.png" + ], + "actual_size": 294440, + "image": { + "width": 640, + "height": 460, + "planes": 1, + "bits_per_pixel": 8, + "compression": 0, + "image_size": 294400, + "colors_used": 256 + } + }, + { + "type": "DAT", + "id": "1001", + "file_offset": 1651712, + "allocated_size": 294656, + "flags": "0x0c00", + "raw_sha256": "2db3a4b5d33883c3d4e9687b03275e75f559b1e0ed57d91e286e6a97404c1be8", + "raw_path": "assets/raw/DAT/01001.bin", + "decoded_paths": [ + "assets/decoded/images/dat_01001.png" + ], + "actual_size": 294440, + "image": { + "width": 640, + "height": 460, + "planes": 1, + "bits_per_pixel": 8, + "compression": 0, + "image_size": 294400, + "colors_used": 256 + } + }, + { + "type": "DAT", + "id": "1002", + "file_offset": 1946368, + "allocated_size": 294656, + "flags": "0x0c00", + "raw_sha256": "df11fbc3b043a540d0231804a01a106a5b5dfe48aff9b3d6bdeb83a4b13928c2", + "raw_path": "assets/raw/DAT/01002.bin", + "decoded_paths": [ + "assets/decoded/images/dat_01002.png" + ], + "actual_size": 294440, + "image": { + "width": 640, + "height": 460, + "planes": 1, + "bits_per_pixel": 8, + "compression": 0, + "image_size": 294400, + "colors_used": 256 + } + }, + { + "type": "DAT", + "id": "1003", + "file_offset": 2241024, + "allocated_size": 294656, + "flags": "0x0c00", + "raw_sha256": "27cfcf709f21256135bfaf8bb506897b0996225ddcf69cab2cd934cbf0d9a2d9", + "raw_path": "assets/raw/DAT/01003.bin", + "decoded_paths": [ + "assets/decoded/images/dat_01003.png" + ], + "actual_size": 294440, + "image": { + "width": 640, + "height": 460, + "planes": 1, + "bits_per_pixel": 8, + "compression": 0, + "image_size": 294400, + "colors_used": 256 + } + }, + { + "type": "DAT", + "id": "1004", + "file_offset": 2535680, + "allocated_size": 294656, + "flags": "0x0c00", + "raw_sha256": "12929d04af2525a10b621a135eedd17eea71ee3511adfd7f80359812fc43d668", + "raw_path": "assets/raw/DAT/01004.bin", + "decoded_paths": [ + "assets/decoded/images/dat_01004.png" + ], + "actual_size": 294440, + "image": { + "width": 640, + "height": 460, + "planes": 1, + "bits_per_pixel": 8, + "compression": 0, + "image_size": 294400, + "colors_used": 256 + } + }, + { + "type": "DAT", + "id": "1005", + "file_offset": 2830336, + "allocated_size": 294656, + "flags": "0x0c00", + "raw_sha256": "70cc938c97efe772759859524f3855bda4454c8bbf403ac0aa04a8d04a9ecf34", + "raw_path": "assets/raw/DAT/01005.bin", + "decoded_paths": [ + "assets/decoded/images/dat_01005.png" + ], + "actual_size": 294440, + "image": { + "width": 640, + "height": 460, + "planes": 1, + "bits_per_pixel": 8, + "compression": 0, + "image_size": 294400, + "colors_used": 256 + } + }, + { + "type": "PAL", + "id": "999", + "file_offset": 3124992, + "allocated_size": 768, + "flags": "0x0c00", + "raw_sha256": "a116d7bbef4ee4f8228aa0fcaf5eea63057e460323d6ad9584fd1ffbc20d60d9", + "raw_path": "assets/raw/PAL/00999.bin", + "decoded_paths": [ + "assets/decoded/palettes/palette_0999.png", + "assets/decoded/palettes/palette_0999.gpl" + ], + "actual_size": 768 + }, + { + "type": "WAV", + "id": "2001", + "file_offset": 3125760, + "allocated_size": 6400, + "flags": "0x1c70", + "raw_sha256": "751d21b1ed7d7f2acd4f8f52478dcf7d57be42ebc3059343c706a9253a84cdd8", + "raw_path": "assets/raw/WAV/02001.bin", + "decoded_paths": [ + "assets/decoded/audio/wav_02001.wav" + ], + "actual_size": 6302, + "audio": { + "format": "PCM", + "channels": 1, + "sample_rate": 22222, + "sample_width_bits": 8, + "frames": 6258, + "duration_seconds": 0.2816128161281613 + } + }, + { + "type": "WAV", + "id": "2002", + "file_offset": 3132160, + "allocated_size": 4608, + "flags": "0x1c70", + "raw_sha256": "ecc192f2d6bfd706f4d3f91cc6cbeb40fa91c50bd2f933da3e35c0258b637172", + "raw_path": "assets/raw/WAV/02002.bin", + "decoded_paths": [ + "assets/decoded/audio/wav_02002.wav" + ], + "actual_size": 4594, + "audio": { + "format": "PCM", + "channels": 1, + "sample_rate": 22222, + "sample_width_bits": 8, + "frames": 4550, + "duration_seconds": 0.2047520475204752 + } + }, + { + "type": "WAV", + "id": "2004", + "file_offset": 3136768, + "allocated_size": 7680, + "flags": "0x1c70", + "raw_sha256": "d84f7a3285fca2b40a219b7e796066bd0294692b2761f565d55b0deb6254f305", + "raw_path": "assets/raw/WAV/02004.bin", + "decoded_paths": [ + "assets/decoded/audio/wav_02004.wav" + ], + "actual_size": 7554, + "audio": { + "format": "PCM", + "channels": 1, + "sample_rate": 22222, + "sample_width_bits": 8, + "frames": 7510, + "duration_seconds": 0.33795337953379534 + } + }, + { + "type": "WAV", + "id": "2006", + "file_offset": 3144448, + "allocated_size": 3072, + "flags": "0x0c60", + "raw_sha256": "c803e22b0cfcc1dbd4ff8bfe966894d95b0f3217c4fc4954ca3ebf9dc5077e07", + "raw_path": "assets/raw/WAV/02006.bin", + "decoded_paths": [ + "assets/decoded/audio/wav_02006.wav" + ], + "actual_size": 2906, + "audio": { + "format": "PCM", + "channels": 1, + "sample_rate": 22050, + "sample_width_bits": 8, + "frames": 2861, + "duration_seconds": 0.12975056689342404 + } + }, + { + "type": "WAV", + "id": "2007", + "file_offset": 3147520, + "allocated_size": 30464, + "flags": "0x1c70", + "raw_sha256": "2e6d4a0ac436e0d5ceb508f4239e871081bf8319c8c44226e83d30dc780f90ab", + "raw_path": "assets/raw/WAV/02007.bin", + "decoded_paths": [ + "assets/decoded/audio/wav_02007.wav" + ], + "actual_size": 30452, + "audio": { + "format": "PCM", + "channels": 1, + "sample_rate": 22222, + "sample_width_bits": 8, + "frames": 30408, + "duration_seconds": 1.3683736837368374 + } + }, + { + "type": "WAV", + "id": "2008", + "file_offset": 3177984, + "allocated_size": 39168, + "flags": "0x1c70", + "raw_sha256": "b9a9af48f0794d51a8e3c0ee8c30e21382d35d8bbc76a28dc595940fbfe0eab1", + "raw_path": "assets/raw/WAV/02008.bin", + "decoded_paths": [ + "assets/decoded/audio/wav_02008.wav" + ], + "actual_size": 39134, + "audio": { + "format": "PCM", + "channels": 1, + "sample_rate": 22050, + "sample_width_bits": 8, + "frames": 39090, + "duration_seconds": 1.7727891156462585 + } + }, + { + "type": "WAV", + "id": "2011", + "file_offset": 3217152, + "allocated_size": 6912, + "flags": "0x0c60", + "raw_sha256": "f7046a06ec0c990b334a1572d81a50d2215f31b112270c5a24344132dc805072", + "raw_path": "assets/raw/WAV/02011.bin", + "decoded_paths": [ + "assets/decoded/audio/wav_02011.wav" + ], + "actual_size": 6710, + "audio": { + "format": "PCM", + "channels": 1, + "sample_rate": 22050, + "sample_width_bits": 8, + "frames": 6665, + "duration_seconds": 0.3022675736961451 + } + }, + { + "type": "WAV", + "id": "2012", + "file_offset": 3224064, + "allocated_size": 512, + "flags": "0x0c60", + "raw_sha256": "c46c9b564f04eef86143875ece96f32171d0f9b788215e13f81738694403bb77", + "raw_path": "assets/raw/WAV/02012.bin", + "decoded_paths": [ + "assets/decoded/audio/wav_02012.wav" + ], + "actual_size": 320, + "audio": { + "format": "PCM", + "channels": 1, + "sample_rate": 22050, + "sample_width_bits": 8, + "frames": 276, + "duration_seconds": 0.012517006802721088 + } + }, + { + "type": "WAV", + "id": "2013", + "file_offset": 3224576, + "allocated_size": 46592, + "flags": "0x0c60", + "raw_sha256": "5dc24553391a2cc17e7388747f42ee63897c0e8f8cd74e18f83f60ff2986cacb", + "raw_path": "assets/raw/WAV/02013.bin", + "decoded_paths": [ + "assets/decoded/audio/wav_02013.wav" + ], + "actual_size": 46348, + "audio": { + "format": "PCM", + "channels": 1, + "sample_rate": 22050, + "sample_width_bits": 8, + "frames": 46304, + "duration_seconds": 2.099954648526077 + } + }, + { + "type": "WAV", + "id": "2015", + "file_offset": 3271168, + "allocated_size": 8192, + "flags": "0x1c70", + "raw_sha256": "4e7fc9f71e187f7b89d5296583d400afc92cd84310c3b6e114a14c6c18cdd4db", + "raw_path": "assets/raw/WAV/02015.bin", + "decoded_paths": [ + "assets/decoded/audio/wav_02015.wav" + ], + "actual_size": 7946, + "audio": { + "format": "PCM", + "channels": 1, + "sample_rate": 22050, + "sample_width_bits": 8, + "frames": 7902, + "duration_seconds": 0.35836734693877553 + } + }, + { + "type": "WAV", + "id": "2016", + "file_offset": 3279360, + "allocated_size": 3584, + "flags": "0x1c70", + "raw_sha256": "72c76e72e9933d02dd4ca4c44434acd1a79591fe486f9bd6da73f59748ee0f1f", + "raw_path": "assets/raw/WAV/02016.bin", + "decoded_paths": [ + "assets/decoded/audio/wav_02016.wav" + ], + "actual_size": 3518, + "audio": { + "format": "PCM", + "channels": 1, + "sample_rate": 22222, + "sample_width_bits": 8, + "frames": 3474, + "duration_seconds": 0.15633156331563317 + } + }, + { + "type": "WAV", + "id": "2017", + "file_offset": 3282944, + "allocated_size": 35072, + "flags": "0x1c70", + "raw_sha256": "f7c91915c93302cb55cb703278e55ae3d08e3bb50b31ce50fbefe9a708f99926", + "raw_path": "assets/raw/WAV/02017.bin", + "decoded_paths": [ + "assets/decoded/audio/wav_02017.wav" + ], + "actual_size": 34842, + "audio": { + "format": "PCM", + "channels": 1, + "sample_rate": 22050, + "sample_width_bits": 8, + "frames": 34798, + "duration_seconds": 1.578140589569161 + } + }, + { + "type": "WAV", + "id": "2019", + "file_offset": 3318016, + "allocated_size": 5376, + "flags": "0x1c70", + "raw_sha256": "2b65c01e848225791efc58e9018f6b9e24e6da5cc753ca74c43b52cab1532cc6", + "raw_path": "assets/raw/WAV/02019.bin", + "decoded_paths": [ + "assets/decoded/audio/wav_02019.wav" + ], + "actual_size": 5148, + "audio": { + "format": "PCM", + "channels": 1, + "sample_rate": 22222, + "sample_width_bits": 8, + "frames": 5104, + "duration_seconds": 0.22968229682296823 + } + }, + { + "type": "WAV", + "id": "2020", + "file_offset": 3323392, + "allocated_size": 30208, + "flags": "0x1c70", + "raw_sha256": "45f03303ce04dc9dc470863bc2cbb638fa6b644afdd9792d8b47667130f71886", + "raw_path": "assets/raw/WAV/02020.bin", + "decoded_paths": [ + "assets/decoded/audio/wav_02020.wav" + ], + "actual_size": 30000, + "audio": { + "format": "PCM", + "channels": 1, + "sample_rate": 22222, + "sample_width_bits": 8, + "frames": 29956, + "duration_seconds": 1.3480334803348033 + } + }, + { + "type": "WAV", + "id": "2021", + "file_offset": 3353600, + "allocated_size": 3328, + "flags": "0x1c70", + "raw_sha256": "9f9be797898500c85a6494d2d157f535025f8858b4b085d52843f6605495a494", + "raw_path": "assets/raw/WAV/02021.bin", + "decoded_paths": [ + "assets/decoded/audio/wav_02021.wav" + ], + "actual_size": 3194, + "audio": { + "format": "PCM", + "channels": 1, + "sample_rate": 22222, + "sample_width_bits": 8, + "frames": 3150, + "duration_seconds": 0.14175141751417514 + } + }, + { + "type": "WAV", + "id": "2022", + "file_offset": 3356928, + "allocated_size": 22272, + "flags": "0x1c70", + "raw_sha256": "e10196861e6eaf5656a5ba475c6226a9c2948b53ca7ee095a1fe7754d511410b", + "raw_path": "assets/raw/WAV/02022.bin", + "decoded_paths": [ + "assets/decoded/audio/wav_02022.wav" + ], + "actual_size": 22122, + "audio": { + "format": "PCM", + "channels": 1, + "sample_rate": 22050, + "sample_width_bits": 8, + "frames": 22078, + "duration_seconds": 1.0012698412698413 + } + }, + { + "type": "BITMAP", + "id": "101", + "file_offset": 3379200, + "allocated_size": 256, + "flags": "0x0c30", + "raw_sha256": "828e3a3f570b6d5eb2406a4e751a1992b35f134138b22b3cda6f628eddc3268d", + "raw_path": "assets/raw/BITMAP/00101.bin", + "decoded_paths": [ + "assets/decoded/images/bitmap_00101.bmp", + "assets/decoded/images/bitmap_00101.png" + ], + "actual_size": 232, + "image": { + "width": 16, + "height": 16, + "planes": 1, + "bits_per_pixel": 4, + "compression": 0, + "image_size": 128, + "colors_used": 0 + } + }, + { + "type": "BITMAP", + "id": "102", + "file_offset": 3379456, + "allocated_size": 256, + "flags": "0x0c30", + "raw_sha256": "8ddb45855da1a1edd14bf2a760f1ec87f77e107519821c9931097c9369f36fa9", + "raw_path": "assets/raw/BITMAP/00102.bin", + "decoded_paths": [ + "assets/decoded/images/bitmap_00102.bmp", + "assets/decoded/images/bitmap_00102.png" + ], + "actual_size": 232, + "image": { + "width": 16, + "height": 16, + "planes": 1, + "bits_per_pixel": 4, + "compression": 0, + "image_size": 128, + "colors_used": 0 + } + }, + { + "type": "BITMAP", + "id": "500", + "file_offset": 3379712, + "allocated_size": 13568, + "flags": "0x0c30", + "raw_sha256": "03bd8020f22a9d05abba8df794a9fedfdbbd3efe9c512d36aa3fdbfe939c73ed", + "raw_path": "assets/raw/BITMAP/00500.bin", + "decoded_paths": [ + "assets/decoded/images/bitmap_00500.bmp", + "assets/decoded/images/bitmap_00500.png" + ], + "actual_size": 13320, + "image": { + "width": 944, + "height": 28, + "planes": 1, + "bits_per_pixel": 4, + "compression": 0, + "image_size": 13216, + "colors_used": 16 + } + }, + { + "type": "ICON", + "id": "1", + "file_offset": 3393280, + "allocated_size": 768, + "flags": "0x1c30", + "raw_sha256": "7700e0cb938f72c273919288a1d93f2d651d0fd1cc0aaf0fc6820ecb852a0cb5", + "raw_path": "assets/raw/ICON/00001.bin", + "decoded_paths": [ + "assets/decoded/icons/icon_00001.ico", + "assets/decoded/icons/icon_00001.png" + ], + "actual_size": 744, + "image": { + "width": 32, + "height": 32, + "planes": 1, + "bits_per_pixel": 4, + "compression": 0, + "image_size": 512, + "colors_used": 0 + } + }, + { + "type": "GROUP_ICON", + "id": "996", + "file_offset": 3394048, + "allocated_size": 256, + "flags": "0x1c30", + "raw_sha256": "b6436bbb9fca95b8a94008d045bf87f404b0a02d7690a0191861d229841dc25b", + "raw_path": "assets/raw/GROUP_ICON/00996.bin", + "decoded_paths": [], + "actual_size": 20 + }, + { + "type": "VERSION", + "id": "1", + "file_offset": 3394304, + "allocated_size": 512, + "flags": "0x0c30", + "raw_sha256": "95f627c29e452fff1032c16384f37128496a3bbc822c39247050f1382507dacc", + "raw_path": "assets/raw/VERSION/00001.bin", + "decoded_paths": [ + "assets/decoded/metadata/version_00001.json" + ], + "actual_size": 416 + }, + { + "type": "DIALOG", + "id": "32512", + "file_offset": 3394816, + "allocated_size": 256, + "flags": "0x1c30", + "raw_sha256": "544570c3e1ac0cbcd690365d2191b71ffc1e6cb1fb525085cec317d41cac9be1", + "raw_path": "assets/raw/DIALOG/32512.bin", + "decoded_paths": [ + "assets/decoded/dialogs/dialog_32512.json" + ], + "actual_size": 250 + }, + { + "type": "DIALOG", + "id": "32513", + "file_offset": 3395072, + "allocated_size": 256, + "flags": "0x1c30", + "raw_sha256": "2e64029d822874a8a74c0ba1367c454d95d999ee8feda1465fe8b3f585d1b03d", + "raw_path": "assets/raw/DIALOG/32513.bin", + "decoded_paths": [ + "assets/decoded/dialogs/dialog_32513.json" + ], + "actual_size": 212 + }, + { + "type": "DIALOG", + "id": "32514", + "file_offset": 3395328, + "allocated_size": 256, + "flags": "0x1c30", + "raw_sha256": "f7f38c4f14d5fba42e370c438fc41e041e744aaef73c65a618070338b650cba1", + "raw_path": "assets/raw/DIALOG/32514.bin", + "decoded_paths": [ + "assets/decoded/dialogs/dialog_32514.json" + ], + "actual_size": 99 + }, + { + "type": "DIALOG", + "id": "32515", + "file_offset": 3395584, + "allocated_size": 512, + "flags": "0x1c30", + "raw_sha256": "75a4de77aa549d3edbe4825c1345093ed8d6ae81559aad4514b0a853ec50921b", + "raw_path": "assets/raw/DIALOG/32515.bin", + "decoded_paths": [ + "assets/decoded/dialogs/dialog_32515.json" + ], + "actual_size": 372 + }, + { + "type": "DIALOG", + "id": "32516", + "file_offset": 3396096, + "allocated_size": 512, + "flags": "0x1c30", + "raw_sha256": "dddb764f91fbd212481c1510c50875a289f9f525674c2bc7eefbf94b8ce892ef", + "raw_path": "assets/raw/DIALOG/32516.bin", + "decoded_paths": [ + "assets/decoded/dialogs/dialog_32516.json" + ], + "actual_size": 309 + }, + { + "type": "DIALOG", + "id": "32517", + "file_offset": 3396608, + "allocated_size": 256, + "flags": "0x1c30", + "raw_sha256": "be406a27876296e9ac46021d67b1591f9bffa0a98a9a55a53ecb9adddc660ef6", + "raw_path": "assets/raw/DIALOG/32517.bin", + "decoded_paths": [ + "assets/decoded/dialogs/dialog_32517.json" + ], + "actual_size": 146 + } + ], + "decode_errors": [] +} diff --git a/original/assets/raw/BITMAP/00101.bin b/original/assets/raw/BITMAP/00101.bin new file mode 100644 index 0000000..5cc3703 Binary files /dev/null and b/original/assets/raw/BITMAP/00101.bin differ diff --git a/original/assets/raw/BITMAP/00102.bin b/original/assets/raw/BITMAP/00102.bin new file mode 100644 index 0000000..d4704a6 Binary files /dev/null and b/original/assets/raw/BITMAP/00102.bin differ diff --git a/original/assets/raw/BITMAP/00500.bin b/original/assets/raw/BITMAP/00500.bin new file mode 100644 index 0000000..7e8a8f9 Binary files /dev/null and b/original/assets/raw/BITMAP/00500.bin differ diff --git a/original/assets/raw/DAT/00400.bin b/original/assets/raw/DAT/00400.bin new file mode 100644 index 0000000..6314a59 Binary files /dev/null and b/original/assets/raw/DAT/00400.bin differ diff --git a/original/assets/raw/DAT/00401.bin b/original/assets/raw/DAT/00401.bin new file mode 100644 index 0000000..88ee330 Binary files /dev/null and b/original/assets/raw/DAT/00401.bin differ diff --git a/original/assets/raw/DAT/00402.bin b/original/assets/raw/DAT/00402.bin new file mode 100644 index 0000000..c25eb8d Binary files /dev/null and b/original/assets/raw/DAT/00402.bin differ diff --git a/original/assets/raw/DAT/00403.bin b/original/assets/raw/DAT/00403.bin new file mode 100644 index 0000000..c11335f Binary files /dev/null and b/original/assets/raw/DAT/00403.bin differ diff --git a/original/assets/raw/DAT/00404.bin b/original/assets/raw/DAT/00404.bin new file mode 100644 index 0000000..c7aa2f7 Binary files /dev/null and b/original/assets/raw/DAT/00404.bin differ diff --git a/original/assets/raw/DAT/00405.bin b/original/assets/raw/DAT/00405.bin new file mode 100644 index 0000000..202493e Binary files /dev/null and b/original/assets/raw/DAT/00405.bin differ diff --git a/original/assets/raw/DAT/00406.bin b/original/assets/raw/DAT/00406.bin new file mode 100644 index 0000000..811b4b8 Binary files /dev/null and b/original/assets/raw/DAT/00406.bin differ diff --git a/original/assets/raw/DAT/00407.bin b/original/assets/raw/DAT/00407.bin new file mode 100644 index 0000000..168bdb9 Binary files /dev/null and b/original/assets/raw/DAT/00407.bin differ diff --git a/original/assets/raw/DAT/00600.bin b/original/assets/raw/DAT/00600.bin new file mode 100644 index 0000000..15f4560 Binary files /dev/null and b/original/assets/raw/DAT/00600.bin differ diff --git a/original/assets/raw/DAT/00701.bin b/original/assets/raw/DAT/00701.bin new file mode 100644 index 0000000..9a2e9aa Binary files /dev/null and b/original/assets/raw/DAT/00701.bin differ diff --git a/original/assets/raw/DAT/00702.bin b/original/assets/raw/DAT/00702.bin new file mode 100644 index 0000000..485e996 Binary files /dev/null and b/original/assets/raw/DAT/00702.bin differ diff --git a/original/assets/raw/DAT/00703.bin b/original/assets/raw/DAT/00703.bin new file mode 100644 index 0000000..e34e9f2 Binary files /dev/null and b/original/assets/raw/DAT/00703.bin differ diff --git a/original/assets/raw/DAT/00704.bin b/original/assets/raw/DAT/00704.bin new file mode 100644 index 0000000..b1a7b43 Binary files /dev/null and b/original/assets/raw/DAT/00704.bin differ diff --git a/original/assets/raw/DAT/00801.bin b/original/assets/raw/DAT/00801.bin new file mode 100644 index 0000000..b42b7cb Binary files /dev/null and b/original/assets/raw/DAT/00801.bin differ diff --git a/original/assets/raw/DAT/00802.bin b/original/assets/raw/DAT/00802.bin new file mode 100644 index 0000000..b935f0f Binary files /dev/null and b/original/assets/raw/DAT/00802.bin differ diff --git a/original/assets/raw/DAT/00803.bin b/original/assets/raw/DAT/00803.bin new file mode 100644 index 0000000..273bd38 Binary files /dev/null and b/original/assets/raw/DAT/00803.bin differ diff --git a/original/assets/raw/DAT/00804.bin b/original/assets/raw/DAT/00804.bin new file mode 100644 index 0000000..87599ae Binary files /dev/null and b/original/assets/raw/DAT/00804.bin differ diff --git a/original/assets/raw/DAT/00805.bin b/original/assets/raw/DAT/00805.bin new file mode 100644 index 0000000..1bcaf62 Binary files /dev/null and b/original/assets/raw/DAT/00805.bin differ diff --git a/original/assets/raw/DAT/00806.bin b/original/assets/raw/DAT/00806.bin new file mode 100644 index 0000000..34e8e22 Binary files /dev/null and b/original/assets/raw/DAT/00806.bin differ diff --git a/original/assets/raw/DAT/00807.bin b/original/assets/raw/DAT/00807.bin new file mode 100644 index 0000000..7410688 Binary files /dev/null and b/original/assets/raw/DAT/00807.bin differ diff --git a/original/assets/raw/DAT/00808.bin b/original/assets/raw/DAT/00808.bin new file mode 100644 index 0000000..8b904d3 Binary files /dev/null and b/original/assets/raw/DAT/00808.bin differ diff --git a/original/assets/raw/DAT/00809.bin b/original/assets/raw/DAT/00809.bin new file mode 100644 index 0000000..965b376 Binary files /dev/null and b/original/assets/raw/DAT/00809.bin differ diff --git a/original/assets/raw/DAT/00900.bin b/original/assets/raw/DAT/00900.bin new file mode 100644 index 0000000..00b999b Binary files /dev/null and b/original/assets/raw/DAT/00900.bin differ diff --git a/original/assets/raw/DAT/00901.bin b/original/assets/raw/DAT/00901.bin new file mode 100644 index 0000000..ad37eaf Binary files /dev/null and b/original/assets/raw/DAT/00901.bin differ diff --git a/original/assets/raw/DAT/00993.bin b/original/assets/raw/DAT/00993.bin new file mode 100644 index 0000000..9f33050 Binary files /dev/null and b/original/assets/raw/DAT/00993.bin differ diff --git a/original/assets/raw/DAT/00994.bin b/original/assets/raw/DAT/00994.bin new file mode 100644 index 0000000..b188b50 Binary files /dev/null and b/original/assets/raw/DAT/00994.bin differ diff --git a/original/assets/raw/DAT/00995.bin b/original/assets/raw/DAT/00995.bin new file mode 100644 index 0000000..07c7372 Binary files /dev/null and b/original/assets/raw/DAT/00995.bin differ diff --git a/original/assets/raw/DAT/00997.bin b/original/assets/raw/DAT/00997.bin new file mode 100644 index 0000000..c328aa3 Binary files /dev/null and b/original/assets/raw/DAT/00997.bin differ diff --git a/original/assets/raw/DAT/00998.bin b/original/assets/raw/DAT/00998.bin new file mode 100644 index 0000000..42ce130 Binary files /dev/null and b/original/assets/raw/DAT/00998.bin differ diff --git a/original/assets/raw/DAT/01001.bin b/original/assets/raw/DAT/01001.bin new file mode 100644 index 0000000..5d30c7a Binary files /dev/null and b/original/assets/raw/DAT/01001.bin differ diff --git a/original/assets/raw/DAT/01002.bin b/original/assets/raw/DAT/01002.bin new file mode 100644 index 0000000..449603c Binary files /dev/null and b/original/assets/raw/DAT/01002.bin differ diff --git a/original/assets/raw/DAT/01003.bin b/original/assets/raw/DAT/01003.bin new file mode 100644 index 0000000..8b4ea91 Binary files /dev/null and b/original/assets/raw/DAT/01003.bin differ diff --git a/original/assets/raw/DAT/01004.bin b/original/assets/raw/DAT/01004.bin new file mode 100644 index 0000000..dfaafe6 Binary files /dev/null and b/original/assets/raw/DAT/01004.bin differ diff --git a/original/assets/raw/DAT/01005.bin b/original/assets/raw/DAT/01005.bin new file mode 100644 index 0000000..480135c Binary files /dev/null and b/original/assets/raw/DAT/01005.bin differ diff --git a/original/assets/raw/DIALOG/32512.bin b/original/assets/raw/DIALOG/32512.bin new file mode 100644 index 0000000..c2d6bfb Binary files /dev/null and b/original/assets/raw/DIALOG/32512.bin differ diff --git a/original/assets/raw/DIALOG/32513.bin b/original/assets/raw/DIALOG/32513.bin new file mode 100644 index 0000000..f63e54b Binary files /dev/null and b/original/assets/raw/DIALOG/32513.bin differ diff --git a/original/assets/raw/DIALOG/32514.bin b/original/assets/raw/DIALOG/32514.bin new file mode 100644 index 0000000..12ea522 Binary files /dev/null and b/original/assets/raw/DIALOG/32514.bin differ diff --git a/original/assets/raw/DIALOG/32515.bin b/original/assets/raw/DIALOG/32515.bin new file mode 100644 index 0000000..90d5115 Binary files /dev/null and b/original/assets/raw/DIALOG/32515.bin differ diff --git a/original/assets/raw/DIALOG/32516.bin b/original/assets/raw/DIALOG/32516.bin new file mode 100644 index 0000000..ed07982 Binary files /dev/null and b/original/assets/raw/DIALOG/32516.bin differ diff --git a/original/assets/raw/DIALOG/32517.bin b/original/assets/raw/DIALOG/32517.bin new file mode 100644 index 0000000..5b5e7b7 Binary files /dev/null and b/original/assets/raw/DIALOG/32517.bin differ diff --git a/original/assets/raw/GROUP_ICON/00996.bin b/original/assets/raw/GROUP_ICON/00996.bin new file mode 100644 index 0000000..e09cb45 Binary files /dev/null and b/original/assets/raw/GROUP_ICON/00996.bin differ diff --git a/original/assets/raw/ICON/00001.bin b/original/assets/raw/ICON/00001.bin new file mode 100644 index 0000000..f570310 Binary files /dev/null and b/original/assets/raw/ICON/00001.bin differ diff --git a/original/assets/raw/PAL/00999.bin b/original/assets/raw/PAL/00999.bin new file mode 100644 index 0000000..4398d9a Binary files /dev/null and b/original/assets/raw/PAL/00999.bin differ diff --git a/original/assets/raw/VERSION/00001.bin b/original/assets/raw/VERSION/00001.bin new file mode 100644 index 0000000..b43eeaa Binary files /dev/null and b/original/assets/raw/VERSION/00001.bin differ diff --git a/original/assets/raw/WAV/02001.bin b/original/assets/raw/WAV/02001.bin new file mode 100644 index 0000000..3f0b957 Binary files /dev/null and b/original/assets/raw/WAV/02001.bin differ diff --git a/original/assets/raw/WAV/02002.bin b/original/assets/raw/WAV/02002.bin new file mode 100644 index 0000000..512a979 Binary files /dev/null and b/original/assets/raw/WAV/02002.bin differ diff --git a/original/assets/raw/WAV/02004.bin b/original/assets/raw/WAV/02004.bin new file mode 100644 index 0000000..dda5a77 Binary files /dev/null and b/original/assets/raw/WAV/02004.bin differ diff --git a/original/assets/raw/WAV/02006.bin b/original/assets/raw/WAV/02006.bin new file mode 100644 index 0000000..49bea51 Binary files /dev/null and b/original/assets/raw/WAV/02006.bin differ diff --git a/original/assets/raw/WAV/02007.bin b/original/assets/raw/WAV/02007.bin new file mode 100644 index 0000000..8fa9d18 Binary files /dev/null and b/original/assets/raw/WAV/02007.bin differ diff --git a/original/assets/raw/WAV/02008.bin b/original/assets/raw/WAV/02008.bin new file mode 100644 index 0000000..7954959 Binary files /dev/null and b/original/assets/raw/WAV/02008.bin differ diff --git a/original/assets/raw/WAV/02011.bin b/original/assets/raw/WAV/02011.bin new file mode 100644 index 0000000..2f354b6 Binary files /dev/null and b/original/assets/raw/WAV/02011.bin differ diff --git a/original/assets/raw/WAV/02012.bin b/original/assets/raw/WAV/02012.bin new file mode 100644 index 0000000..0892bda Binary files /dev/null and b/original/assets/raw/WAV/02012.bin differ diff --git a/original/assets/raw/WAV/02013.bin b/original/assets/raw/WAV/02013.bin new file mode 100644 index 0000000..3a19776 Binary files /dev/null and b/original/assets/raw/WAV/02013.bin differ diff --git a/original/assets/raw/WAV/02015.bin b/original/assets/raw/WAV/02015.bin new file mode 100644 index 0000000..6f8a27c Binary files /dev/null and b/original/assets/raw/WAV/02015.bin differ diff --git a/original/assets/raw/WAV/02016.bin b/original/assets/raw/WAV/02016.bin new file mode 100644 index 0000000..c859ddb Binary files /dev/null and b/original/assets/raw/WAV/02016.bin differ diff --git a/original/assets/raw/WAV/02017.bin b/original/assets/raw/WAV/02017.bin new file mode 100644 index 0000000..aff1b94 Binary files /dev/null and b/original/assets/raw/WAV/02017.bin differ diff --git a/original/assets/raw/WAV/02019.bin b/original/assets/raw/WAV/02019.bin new file mode 100644 index 0000000..e8daea8 Binary files /dev/null and b/original/assets/raw/WAV/02019.bin differ diff --git a/original/assets/raw/WAV/02020.bin b/original/assets/raw/WAV/02020.bin new file mode 100644 index 0000000..b86c57c Binary files /dev/null and b/original/assets/raw/WAV/02020.bin differ diff --git a/original/assets/raw/WAV/02021.bin b/original/assets/raw/WAV/02021.bin new file mode 100644 index 0000000..d58c5a7 Binary files /dev/null and b/original/assets/raw/WAV/02021.bin differ diff --git a/original/assets/raw/WAV/02022.bin b/original/assets/raw/WAV/02022.bin new file mode 100644 index 0000000..2ec71d7 Binary files /dev/null and b/original/assets/raw/WAV/02022.bin differ diff --git a/original/tools/AuditCoverage.java b/original/tools/AuditCoverage.java new file mode 100644 index 0000000..7a19847 --- /dev/null +++ b/original/tools/AuditCoverage.java @@ -0,0 +1,89 @@ +// Report executable-segment instruction and function-body coverage for the current program. +// @category TDKPIN + +import java.io.BufferedWriter; +import java.io.FileWriter; +import java.io.PrintWriter; + +import ghidra.app.script.GhidraScript; +import ghidra.program.model.address.AddressSet; +import ghidra.program.model.address.AddressSetView; +import ghidra.program.model.listing.Function; +import ghidra.program.model.listing.FunctionIterator; +import ghidra.program.model.listing.Instruction; +import ghidra.program.model.listing.InstructionIterator; +import ghidra.program.model.mem.MemoryBlock; + +public class AuditCoverage extends GhidraScript { + @Override + public void run() throws Exception { + String[] args = getScriptArgs(); + if (args.length != 1) { + throw new IllegalArgumentException("usage: AuditCoverage.java OUTPUT_TSV"); + } + + AddressSet executable = new AddressSet(); + AddressSet instructions = new AddressSet(); + AddressSet definedData = new AddressSet(); + AddressSet functionBodies = new AddressSet(); + int internalFunctions = 0; + + try (PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(args[0])))) { + out.println("record\tname_or_start\tend\tbytes\tdetail"); + for (MemoryBlock block : currentProgram.getMemory().getBlocks()) { + String detail = String.format("r=%s,w=%s,x=%s,initialized=%s", + block.isRead(), block.isWrite(), block.isExecute(), block.isInitialized()); + out.printf("block\t%s\t%s\t%d\t%s%n", block.getName(), block.getEnd(), + block.getSize(), detail); + if (block.isExecute()) { + executable.add(block.getStart(), block.getEnd()); + } + } + + InstructionIterator instructionIterator = + currentProgram.getListing().getInstructions(executable, true); + while (instructionIterator.hasNext()) { + Instruction instruction = instructionIterator.next(); + instructions.add(instruction.getMinAddress(), instruction.getMaxAddress()); + } + var dataIterator = currentProgram.getListing().getDefinedData(executable, true); + while (dataIterator.hasNext()) { + var data = dataIterator.next(); + definedData.add(data.getMinAddress(), data.getMaxAddress()); + } + + FunctionIterator functionIterator = currentProgram.getFunctionManager().getFunctions(true); + while (functionIterator.hasNext()) { + Function function = functionIterator.next(); + MemoryBlock block = currentProgram.getMemory().getBlock(function.getEntryPoint()); + if (!function.isExternal() && block != null && block.isExecute()) { + internalFunctions++; + functionBodies.add(function.getBody()); + } + } + + AddressSet explained = instructions.union(definedData); + AddressSet undefined = executable.subtract(explained); + out.printf("summary\texecutable-bytes\t\t%d\t%n", executable.getNumAddresses()); + out.printf("summary\tdisassembled-bytes\t\t%d\t%.2f%% of executable%n", + instructions.getNumAddresses(), percent(instructions, executable)); + out.printf("summary\tdefined-data-bytes\t\t%d\t%.2f%% of executable%n", + definedData.getNumAddresses(), percent(definedData, executable)); + out.printf("summary\texplained-code-or-data-bytes\t\t%d\t%.2f%% of executable%n", + explained.getNumAddresses(), percent(explained, executable)); + out.printf("summary\tfunction-body-bytes\t\t%d\t%.2f%% of executable%n", + functionBodies.intersect(executable).getNumAddresses(), percent(functionBodies, executable)); + out.printf("summary\tinternal-functions\t\t%d\t%n", internalFunctions); + out.printf("summary\tundefined-executable-bytes\t\t%d\t%n", undefined.getNumAddresses()); + for (var range : undefined) { + out.printf("undefined-range\t%s\t%s\t%d\t%n", range.getMinAddress(), + range.getMaxAddress(), range.getLength()); + } + } + } + + private double percent(AddressSetView numerator, AddressSetView denominator) { + long total = denominator.getNumAddresses(); + return total == 0 ? 0.0 : 100.0 * numerator.intersect(denominator).getNumAddresses() / total; + } +} diff --git a/original/tools/ExportDecompilation.java b/original/tools/ExportDecompilation.java new file mode 100644 index 0000000..cf27bdb --- /dev/null +++ b/original/tools/ExportDecompilation.java @@ -0,0 +1,81 @@ +// Export every function in the current Ghidra program as one traceable C-like file. +// @category TDKPIN + +import java.io.BufferedWriter; +import java.io.FileWriter; +import java.io.PrintWriter; + +import ghidra.app.decompiler.DecompInterface; +import ghidra.app.decompiler.DecompileResults; +import ghidra.app.script.GhidraScript; +import ghidra.program.model.listing.Function; +import ghidra.program.model.listing.FunctionIterator; +import ghidra.program.model.mem.MemoryBlock; + +public class ExportDecompilation extends GhidraScript { + @Override + public void run() throws Exception { + String[] args = getScriptArgs(); + if (args.length != 2) { + throw new IllegalArgumentException("usage: ExportDecompilation.java OUTPUT_C OUTPUT_TSV"); + } + + DecompInterface decompiler = new DecompInterface(); + decompiler.toggleCCode(true); + decompiler.toggleSyntaxTree(true); + if (!decompiler.openProgram(currentProgram)) { + throw new IllegalStateException("cannot open program in decompiler"); + } + + int total = 0; + int internal = 0; + int external = 0; + int succeeded = 0; + int failed = 0; + try (PrintWriter c = new PrintWriter(new BufferedWriter(new FileWriter(args[0]))); + PrintWriter ledger = new PrintWriter(new BufferedWriter(new FileWriter(args[1])))) { + c.println("/*"); + c.println(" * Raw Ghidra decompilation of TDKPIN.EXE."); + c.println(" * Function boundaries and names are analysis artifacts, not original source symbols."); + c.println(" */"); + c.println(); + ledger.println("address\tname\tkind\tstatus\tmessage"); + + FunctionIterator functions = currentProgram.getFunctionManager().getFunctions(true); + while (functions.hasNext() && !monitor.isCancelled()) { + Function function = functions.next(); + total++; + String address = function.getEntryPoint().toString(); + String name = function.getName(); + MemoryBlock block = currentProgram.getMemory().getBlock(function.getEntryPoint()); + boolean imported = function.isExternal() || block == null || + !block.isInitialized() || "EXTERNAL".equals(block.getName()); + if (imported) { + external++; + ledger.printf("%s\t%s\texternal\tn/a\timported function%n", address, name); + continue; + } + internal++; + DecompileResults result = decompiler.decompileFunction(function, 120, monitor); + c.printf("/* ===== %s %s ===== */%n", address, name); + if (result.decompileCompleted() && result.getDecompiledFunction() != null) { + c.println(result.getDecompiledFunction().getC()); + succeeded++; + ledger.printf("%s\t%s\tinternal\tok\t%n", address, name); + } else { + String message = result.getErrorMessage(); + c.printf("/* DECOMPILATION FAILED: %s */%n%n", message); + failed++; + ledger.printf("%s\t%s\tinternal\tfailed\t%s%n", address, name, + message == null ? "" : message.replace('\t', ' ').replace('\n', ' ')); + } + } + c.printf("/* SUMMARY: total=%d internal=%d external=%d succeeded=%d failed=%d */%n", + total, internal, external, succeeded, failed); + println(String.format("Exported total=%d internal=%d external=%d succeeded=%d failed=%d", + total, internal, external, succeeded, failed)); + } finally { + decompiler.dispose(); + } + } +} diff --git a/original/tools/SeedMissingEntrypoints.java b/original/tools/SeedMissingEntrypoints.java new file mode 100644 index 0000000..b2cae13 --- /dev/null +++ b/original/tools/SeedMissingEntrypoints.java @@ -0,0 +1,29 @@ +// Seed NE entry points that Ghidra 12.1's automatic analysis leaves undefined. +// @category TDKPIN + +import ghidra.app.script.GhidraScript; +import ghidra.program.model.address.Address; +import ghidra.program.model.listing.Function; +import ghidra.program.model.symbol.SourceType; + +public class SeedMissingEntrypoints extends GhidraScript { + @Override + public void run() throws Exception { + seed("1000:eaB1", "exported_ordinal_10"); + seed("1000:fd85", "ne_program_entry"); + analyzeAll(currentProgram); + } + + private void seed(String text, String name) throws Exception { + Address address = toAddr(text); + disassemble(address); + Function function = getFunctionAt(address); + if (function == null) { + function = createFunction(address, name); + } + if (function != null && !name.equals(function.getName())) { + function.setName(name, SourceType.USER_DEFINED); + } + println("Seeded " + name + " at " + address); + } +} diff --git a/original/tools/decompile.sh b/original/tools/decompile.sh new file mode 100755 index 0000000..f2dc279 --- /dev/null +++ b/original/tools/decompile.sh @@ -0,0 +1,31 @@ +#!/usr/bin/env bash +set -euo pipefail + +workspace_dir=$(pwd -P) +ghidra_install_dir=${GHIDRA_INSTALL_DIR:-/opt/ghidra} +headless_analyzer="$ghidra_install_dir/support/analyzeHeadless" +script_dir="$workspace_dir/tools" +project_dir=$(mktemp -d /tmp/tdkpin-ghidra.XXXXXX) + +if [[ ! -x "$headless_analyzer" ]]; then + echo "Ghidra headless analyzer not found at: $headless_analyzer" >&2 + exit 1 +fi + +"$headless_analyzer" "$project_dir" tdkpin \ + -import "$workspace_dir/TDKPIN.EXE" \ + -analysisTimeoutPerFile 900 \ + -max-cpu 8 + +"$headless_analyzer" "$project_dir" tdkpin \ + -process TDKPIN.EXE \ + -noanalysis \ + -scriptPath "$script_dir" \ + -preScript SeedMissingEntrypoints.java \ + -postScript ExportDecompilation.java \ + "$workspace_dir/TDKPIN_GHIDRA_RAW.c" \ + "$workspace_dir/FUNCTIONS.tsv" \ + -postScript AuditCoverage.java \ + "$workspace_dir/COVERAGE.tsv" + +echo "Ghidra project retained at: $project_dir" diff --git a/original/tools/extract_ne_resources.py b/original/tools/extract_ne_resources.py new file mode 100755 index 0000000..60b8af0 --- /dev/null +++ b/original/tools/extract_ne_resources.py @@ -0,0 +1,450 @@ +#!/usr/bin/env python3 +"""Losslessly extract and decode resources from the 16-bit TDKPIN NE image.""" + +from __future__ import annotations + +import hashlib +import io +import json +import re +import struct +import wave +from dataclasses import dataclass +from pathlib import Path +from typing import Any + +from PIL import Image + + +ROOT = Path(__file__).resolve().parent.parent +SOURCE = ROOT / "TDKPIN.EXE" +OUTPUT = ROOT / "assets" + +INTEGER_TYPES = { + 1: "CURSOR", + 2: "BITMAP", + 3: "ICON", + 4: "MENU", + 5: "DIALOG", + 6: "STRING", + 7: "FONTDIR", + 8: "FONT", + 9: "ACCELERATOR", + 10: "RCDATA", + 11: "MESSAGETABLE", + 12: "GROUP_CURSOR", + 14: "GROUP_ICON", + 15: "VERSION_OLD", + 16: "VERSION", +} + + +@dataclass +class Resource: + type_name: str + resource_id: str + offset: int + allocated_size: int + flags: int + data: bytes + + @property + def stem(self) -> str: + return f"{int(self.resource_id):05d}" if self.resource_id.isdigit() else self.resource_id + + +def u16(data: bytes, offset: int) -> int: + return struct.unpack_from(" int: + return struct.unpack_from(" str: + length = image[base + offset] + return image[base + offset + 1 : base + offset + 1 + length].decode("cp1252") + + +def resource_name(image: bytes, base: int, value: int, is_type: bool) -> str: + if value & 0x8000: + number = value & 0x7FFF + return INTEGER_TYPES.get(number, f"TYPE_{number}") if is_type else str(number) + return read_pascal_string(image, base, value) + + +def parse_resources(image: bytes) -> tuple[list[Resource], dict[str, Any]]: + ne_offset = u32(image, 0x3C) + resource_offset = u16(image, ne_offset + 0x24) + resident_names_offset = u16(image, ne_offset + 0x26) + table_base = ne_offset + resource_offset + pos = table_base + shift = u16(image, pos) + pos += 2 + resources: list[Resource] = [] + + while True: + type_id = u16(image, pos) + if type_id == 0: + break + count = u16(image, pos + 2) + pos += 8 + type_name = resource_name(image, table_base, type_id, True) + for _ in range(count): + offset_units, length_units, flags, name_id, _handle, _usage = struct.unpack_from( + " dict[str, int]: + if len(data) < 40 or u32(data, 0) != 40: + raise ValueError("not a BITMAPINFOHEADER DIB") + width, height = struct.unpack_from(" tuple[Image.Image, int, dict[str, int]]: + info = dib_info(data) + width = info["width"] + height = abs(info["height"]) + bits_per_pixel = info["bits_per_pixel"] + if bits_per_pixel != 8 or info["compression"] != 0: + raise ValueError(f"unsupported custom DIB: {bits_per_pixel} bpp compression={info['compression']}") + stride = ((width * bits_per_pixel + 31) // 32) * 4 + pixel_size = info["image_size"] or stride * height + pixel_offset = 40 + pixels = data[pixel_offset : pixel_offset + pixel_size] + if len(pixels) != pixel_size: + raise ValueError("truncated custom DIB pixels") + rows = [pixels[i * stride : i * stride + width] for i in range(height)] + if info["height"] > 0: + rows.reverse() + image = Image.frombytes("P", (width, height), b"".join(rows)) + image.putpalette(palette) + return image, pixel_offset + pixel_size, info + + +def wrap_bitmap_dib(data: bytes) -> tuple[bytes, int, dict[str, int]]: + info = dib_info(data) + width = info["width"] + height = abs(info["height"]) + bits_per_pixel = info["bits_per_pixel"] + color_count = info["colors_used"] or (1 << bits_per_pixel if bits_per_pixel <= 8 else 0) + pixel_offset = 40 + color_count * 4 + stride = ((width * bits_per_pixel + 31) // 32) * 4 + pixel_size = info["image_size"] or stride * height + actual_size = pixel_offset + pixel_size + if actual_size > len(data): + raise ValueError("truncated bitmap DIB") + header = struct.pack("<2sIHHI", b"BM", 14 + actual_size, 0, 0, 14 + pixel_offset) + return header + data[:actual_size], actual_size, info + + +def decode_icon(data: bytes) -> tuple[bytes, int, dict[str, int]]: + info = dib_info(data) + width = info["width"] + height = abs(info["height"]) // 2 + bits_per_pixel = info["bits_per_pixel"] + color_count = info["colors_used"] or (1 << bits_per_pixel if bits_per_pixel <= 8 else 0) + xor_stride = ((width * bits_per_pixel + 31) // 32) * 4 + and_stride = ((width + 31) // 32) * 4 + actual_size = 40 + color_count * 4 + xor_stride * height + and_stride * height + if actual_size > len(data): + raise ValueError("truncated icon DIB") + directory = struct.pack( + " tuple[str, int]: + end = data.index(0, pos) + return data[pos:end].decode("cp1252", errors="replace"), end + 1 + + +def read_dialog_field(data: bytes, pos: int) -> tuple[Any, int]: + first = data[pos] + if first == 0: + return None, pos + 1 + if first == 0xFF: + return {"ordinal": u16(data, pos + 1)}, pos + 3 + if first >= 0x80: + atoms = {0x80: "BUTTON", 0x81: "EDIT", 0x82: "STATIC", 0x83: "LISTBOX", 0x84: "SCROLLBAR", 0x85: "COMBOBOX"} + return {"class_atom": atoms.get(first, f"ATOM_{first:02X}")}, pos + 1 + return read_ansi_z(data, pos) + + +def decode_dialog(data: bytes) -> tuple[dict[str, Any], int]: + style = u32(data, 0) + count = data[4] + x, y, cx, cy = struct.unpack_from(" dict[str, Any]: + strings = [ + match.decode("cp1252", errors="replace") + for match in re.findall(rb"[\x20-\x7e]{3,}", data) + ] + result: dict[str, Any] = {"printable_strings": strings} + signature = data.find(b"\xbd\x04\xef\xfe") + if signature >= 0 and signature + 52 <= len(data): + fields = struct.unpack_from("<13I", data, signature) + result["fixed_file_info"] = { + "signature": f"0x{fields[0]:08x}", + "structure_version": f"0x{fields[1]:08x}", + "file_version_ms": f"0x{fields[2]:08x}", + "file_version_ls": f"0x{fields[3]:08x}", + "product_version_ms": f"0x{fields[4]:08x}", + "product_version_ls": f"0x{fields[5]:08x}", + "file_flags_mask": f"0x{fields[6]:08x}", + "file_flags": f"0x{fields[7]:08x}", + "file_os": f"0x{fields[8]:08x}", + "file_type": f"0x{fields[9]:08x}", + "file_subtype": f"0x{fields[10]:08x}", + "file_date_ms": f"0x{fields[11]:08x}", + "file_date_ls": f"0x{fields[12]:08x}", + } + return result + + +def wav_info(data: bytes) -> dict[str, Any]: + with wave.open(io.BytesIO(data), "rb") as stream: + frames = stream.getnframes() + rate = stream.getframerate() + return { + "format": "PCM", + "channels": stream.getnchannels(), + "sample_rate": rate, + "sample_width_bits": stream.getsampwidth() * 8, + "frames": frames, + "duration_seconds": frames / rate, + } + + +def save_palette(palette: bytes, resource_id: str) -> list[str]: + if len(palette) < 768: + raise ValueError("palette is shorter than 256 RGB entries") + palette = palette[:768] + image = Image.new("RGB", (256, 256)) + pixels = image.load() + for index in range(256): + color = tuple(palette[index * 3 : index * 3 + 3]) + x0 = (index % 16) * 16 + y0 = (index // 16) * 16 + for y in range(y0, y0 + 16): + for x in range(x0, x0 + 16): + pixels[x, y] = color + png_path = OUTPUT / "decoded" / "palettes" / f"palette_{int(resource_id):04d}.png" + png_path.parent.mkdir(parents=True, exist_ok=True) + image.save(png_path) + gpl_path = png_path.with_suffix(".gpl") + lines = ["GIMP Palette", f"Name: TDKPIN resource {resource_id}", "Columns: 16", "#"] + for index in range(256): + red, green, blue = palette[index * 3 : index * 3 + 3] + lines.append(f"{red:3d} {green:3d} {blue:3d}\tIndex {index}") + gpl_path.write_text("\n".join(lines) + "\n", encoding="utf-8") + return [str(png_path.relative_to(ROOT)), str(gpl_path.relative_to(ROOT))] + + +def main() -> None: + image = SOURCE.read_bytes() + resources, ne_metadata = parse_resources(image) + palette_resources = [resource for resource in resources if resource.type_name == "PAL"] + if len(palette_resources) != 1: + raise ValueError(f"expected one PAL resource, found {len(palette_resources)}") + shared_palette = palette_resources[0].data[:768] + manifest_entries: list[dict[str, Any]] = [] + extraction_errors: list[str] = [] + + for resource in resources: + raw_path = OUTPUT / "raw" / resource.type_name / f"{resource.stem}.bin" + raw_path.parent.mkdir(parents=True, exist_ok=True) + raw_path.write_bytes(resource.data) + entry: dict[str, Any] = { + "type": resource.type_name, + "id": resource.resource_id, + "file_offset": resource.offset, + "allocated_size": resource.allocated_size, + "flags": f"0x{resource.flags:04x}", + "raw_sha256": hashlib.sha256(resource.data).hexdigest(), + "raw_path": str(raw_path.relative_to(ROOT)), + "decoded_paths": [], + } + try: + if resource.type_name == "DAT": + decoded, actual_size, info = decode_custom_dib(resource.data, shared_palette) + path = OUTPUT / "decoded" / "images" / f"dat_{resource.stem}.png" + path.parent.mkdir(parents=True, exist_ok=True) + decoded.save(path) + entry.update({"actual_size": actual_size, "image": info}) + entry["decoded_paths"].append(str(path.relative_to(ROOT))) + elif resource.type_name == "PAL": + entry["actual_size"] = 768 + entry["decoded_paths"].extend(save_palette(shared_palette, resource.resource_id)) + elif resource.type_name == "WAV": + if resource.data[:4] != b"RIFF" or resource.data[8:12] != b"WAVE": + raise ValueError("WAV resource lacks RIFF/WAVE signature") + actual_size = u32(resource.data, 4) + 8 + if actual_size > len(resource.data): + raise ValueError("truncated RIFF resource") + path = OUTPUT / "decoded" / "audio" / f"wav_{resource.stem}.wav" + path.parent.mkdir(parents=True, exist_ok=True) + path.write_bytes(resource.data[:actual_size]) + entry["actual_size"] = actual_size + entry["audio"] = wav_info(resource.data[:actual_size]) + entry["decoded_paths"].append(str(path.relative_to(ROOT))) + elif resource.type_name == "BITMAP": + bmp, actual_size, info = wrap_bitmap_dib(resource.data) + png_path = OUTPUT / "decoded" / "images" / f"bitmap_{resource.stem}.png" + bmp_path = png_path.with_suffix(".bmp") + png_path.parent.mkdir(parents=True, exist_ok=True) + bmp_path.write_bytes(bmp) + with Image.open(bmp_path) as decoded: + decoded.save(png_path) + entry.update({"actual_size": actual_size, "image": info}) + entry["decoded_paths"].extend( + [str(bmp_path.relative_to(ROOT)), str(png_path.relative_to(ROOT))] + ) + elif resource.type_name == "ICON": + ico, actual_size, info = decode_icon(resource.data) + ico_path = OUTPUT / "decoded" / "icons" / f"icon_{resource.stem}.ico" + png_path = ico_path.with_suffix(".png") + ico_path.parent.mkdir(parents=True, exist_ok=True) + ico_path.write_bytes(ico) + with Image.open(ico_path) as decoded: + decoded.convert("RGBA").save(png_path) + entry.update({"actual_size": actual_size, "image": info}) + entry["decoded_paths"].extend( + [str(ico_path.relative_to(ROOT)), str(png_path.relative_to(ROOT))] + ) + elif resource.type_name == "DIALOG": + dialog, actual_size = decode_dialog(resource.data) + path = OUTPUT / "decoded" / "dialogs" / f"dialog_{resource.stem}.json" + path.parent.mkdir(parents=True, exist_ok=True) + path.write_text(json.dumps(dialog, indent=2, ensure_ascii=False) + "\n", encoding="utf-8") + entry["actual_size"] = actual_size + entry["decoded_paths"].append(str(path.relative_to(ROOT))) + elif resource.type_name == "VERSION": + decoded = decode_version(resource.data) + path = OUTPUT / "decoded" / "metadata" / f"version_{resource.stem}.json" + path.parent.mkdir(parents=True, exist_ok=True) + path.write_text(json.dumps(decoded, indent=2, ensure_ascii=False) + "\n", encoding="utf-8") + entry["actual_size"] = u16(resource.data, 0) + entry["decoded_paths"].append(str(path.relative_to(ROOT))) + elif resource.type_name == "GROUP_ICON": + count = u16(resource.data, 4) + entry["actual_size"] = 6 + count * 14 + except Exception as error: + message = f"{resource.type_name}/{resource.resource_id}: {error}" + entry["decode_error"] = str(error) + extraction_errors.append(message) + manifest_entries.append(entry) + + manifest = { + "source": str(SOURCE.relative_to(ROOT)), + "source_sha256": hashlib.sha256(image).hexdigest(), + "resource_count": len(resources), + "ne": ne_metadata, + "resources": manifest_entries, + "decode_errors": extraction_errors, + } + OUTPUT.mkdir(parents=True, exist_ok=True) + (OUTPUT / "manifest.json").write_text( + json.dumps(manifest, indent=2, ensure_ascii=False) + "\n", encoding="utf-8" + ) + if extraction_errors: + raise SystemExit("resource extraction completed with decode errors:\n" + "\n".join(extraction_errors)) + print(f"Extracted {len(resources)} resources to {OUTPUT}") + + +if __name__ == "__main__": + main() diff --git a/original/tools/verify_extracted_assets.py b/original/tools/verify_extracted_assets.py new file mode 100755 index 0000000..7e0f725 --- /dev/null +++ b/original/tools/verify_extracted_assets.py @@ -0,0 +1,78 @@ +#!/usr/bin/env python3 +"""Verify that every manifest resource round-trips to TDKPIN.EXE.""" + +from __future__ import annotations + +import hashlib +import json +import struct +import wave +from collections import Counter +from pathlib import Path + +from PIL import Image + + +ROOT = Path(__file__).resolve().parent.parent + + +def main() -> None: + manifest = json.loads((ROOT / "assets" / "manifest.json").read_text(encoding="utf-8")) + source = (ROOT / manifest["source"]).read_bytes() + assert hashlib.sha256(source).hexdigest() == manifest["source_sha256"] + assert manifest["resource_count"] == 63 + assert len(manifest["resources"]) == 63 + assert not manifest["decode_errors"] + + expected_types = { + "DAT": 34, + "PAL": 1, + "WAV": 16, + "BITMAP": 3, + "ICON": 1, + "GROUP_ICON": 1, + "VERSION": 1, + "DIALOG": 6, + } + assert Counter(entry["type"] for entry in manifest["resources"]) == expected_types + + for entry in manifest["resources"]: + raw = (ROOT / entry["raw_path"]).read_bytes() + offset = entry["file_offset"] + allocated_size = entry["allocated_size"] + assert len(raw) == allocated_size + assert raw == source[offset : offset + allocated_size] + assert hashlib.sha256(raw).hexdigest() == entry["raw_sha256"] + for decoded_path in entry["decoded_paths"]: + assert (ROOT / decoded_path).is_file() + if entry["type"] in {"DAT", "BITMAP", "ICON"}: + png_paths = [path for path in entry["decoded_paths"] if path.endswith(".png")] + assert len(png_paths) == 1 + with Image.open(ROOT / png_paths[0]) as image: + assert image.width == entry["image"]["width"] + assert image.height == abs(entry["image"]["height"]) + if entry["type"] == "WAV": + wav_path = ROOT / entry["decoded_paths"][0] + with wave.open(str(wav_path), "rb") as stream: + assert stream.getnchannels() == entry["audio"]["channels"] + assert stream.getframerate() == entry["audio"]["sample_rate"] + assert stream.getsampwidth() * 8 == entry["audio"]["sample_width_bits"] + if entry["type"] == "DIALOG": + dialog = json.loads((ROOT / entry["decoded_paths"][0]).read_text(encoding="utf-8")) + assert len(dialog["controls"]) == dialog["declared_control_count"] + if "actual_size" in entry: + assert 0 < entry["actual_size"] <= allocated_size + + # Verify that the resource intervals do not overlap one another. + ranges = sorted( + (entry["file_offset"], entry["file_offset"] + entry["allocated_size"]) + for entry in manifest["resources"] + ) + for previous, current in zip(ranges, ranges[1:]): + assert previous[1] <= current[0] + + print("Verified 63/63 raw resources and all decoded derivatives") + + +if __name__ == "__main__": + main() diff --git a/tdkpin-rs/AGENTS.md b/tdkpin-rs/AGENTS.md new file mode 100644 index 0000000..015262b --- /dev/null +++ b/tdkpin-rs/AGENTS.md @@ -0,0 +1,19 @@ +# Agent Instructions + +## Commit Policy + +Automatically commit changes once a full feature, bugfix, refactor, or other +coherent unit of work is finished. Do not wait for the user to ask for a commit. + +## Versioning Policy + +Only update the version, when the user explicitly asks for it. + +### Guidelines for how to update the version + +1. Use `cargo set-version` to bump the version. Decide, based on the actual + changes, based on semver semantics, if major, minor or patch needs to be + bumped. +2. Update the CHANGELOG.md file accordingly. +3. Create a release commit. +4. Tag the release commit in the style of previous versioning tags. diff --git a/tdkpin-rs/CHANGELOG.md b/tdkpin-rs/CHANGELOG.md new file mode 100644 index 0000000..62517c1 --- /dev/null +++ b/tdkpin-rs/CHANGELOG.md @@ -0,0 +1,7 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), +and this project adheres to +[Semantic Versioning](https://semver.org/spec/v2.0.0.html). diff --git a/tdkpin-rs/CLAUDE.md b/tdkpin-rs/CLAUDE.md new file mode 120000 index 0000000..47dc3e3 --- /dev/null +++ b/tdkpin-rs/CLAUDE.md @@ -0,0 +1 @@ +AGENTS.md \ No newline at end of file diff --git a/tdkpin-rs/Cargo.lock b/tdkpin-rs/Cargo.lock new file mode 100644 index 0000000..2606752 --- /dev/null +++ b/tdkpin-rs/Cargo.lock @@ -0,0 +1,7 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "tdkpin-rs" +version = "0.1.0" diff --git a/tdkpin-rs/Cargo.toml b/tdkpin-rs/Cargo.toml new file mode 100644 index 0000000..1bb0176 --- /dev/null +++ b/tdkpin-rs/Cargo.toml @@ -0,0 +1,33 @@ +[package] +name = "tdkpin-rs" +version = "0.1.0" +edition = "2024" + +[dependencies] + +[lints.clippy] +pedantic = { level = "warn", priority = -1 } +todo = "warn" +unwrap_used = "warn" + +[lints.rust] +unsafe_code = "forbid" + +[profile.release] +debug = true +strip = false +debug-assertions = true +overflow-checks = true +lto = false +panic = "unwind" +incremental = true + +[profile.production] +inherits = "release" +debug = false +strip = true +debug-assertions = false +overflow-checks = false +lto = true +incremental = false +codegen-units = 1 diff --git a/tdkpin-rs/GEMINI.md b/tdkpin-rs/GEMINI.md new file mode 120000 index 0000000..47dc3e3 --- /dev/null +++ b/tdkpin-rs/GEMINI.md @@ -0,0 +1 @@ +AGENTS.md \ No newline at end of file diff --git a/tdkpin-rs/justfile b/tdkpin-rs/justfile new file mode 100644 index 0000000..8d41d09 --- /dev/null +++ b/tdkpin-rs/justfile @@ -0,0 +1,35 @@ +set positional-arguments + +run *args: + cargo run -- "$@" + +build: + cargo build + +build-release: + cargo build --release + +build-production: + cargo build --profile production + +fmt: + cargo +nightly fmt + tombi format + fd -tf -e md -x prettier --write --prose-wrap always --print-width 80 + rumdl check --flavor commonmark --fix + just --fmt + +_fix: + cargo fix --workspace --all-targets --all-features + cargo clippy --fix --workspace --all-targets --all-features + +fix: _fix fmt + +clippy: + cargo clippy --workspace --all-targets --all-features -- -D warnings + +test: + cargo test --workspace --all-targets --all-features + +clean: + cargo clean diff --git a/tdkpin-rs/rustfmt.toml b/tdkpin-rs/rustfmt.toml new file mode 100644 index 0000000..e270811 --- /dev/null +++ b/tdkpin-rs/rustfmt.toml @@ -0,0 +1,3 @@ +group_imports = "StdExternalCrate" +imports_granularity = "Crate" +imports_layout = "HorizontalVertical" diff --git a/tdkpin-rs/src/main.rs b/tdkpin-rs/src/main.rs new file mode 100644 index 0000000..e7a11a9 --- /dev/null +++ b/tdkpin-rs/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + println!("Hello, world!"); +}