This repository was archived by the owner on Sep 3, 2026. It is now read-only.
forked from Nommy228/Might-and-Magic-Trilogy
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFrameTableInc.cpp
More file actions
142 lines (132 loc) · 4.88 KB
/
Copy pathFrameTableInc.cpp
File metadata and controls
142 lines (132 loc) · 4.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
#define _CRT_SECURE_NO_WARNINGS
#include "FrameTableInc.h"
#include <memory.h>
//identical function to work in differnt threads
//----- (004BE3BF) --------------------------------------------------------
FrameTableTxtLine* txt_file_frametable_parser(const char *str_to_parse, FrameTableTxtLine *tokens_table)
{
bool new_token_flag; // edx@3
bool in_quotes; // [sp+Ch] [bp-4h]@3
char* parse_pos;
unsigned char test_char;
int i;
static char tokens_buff1[1000];
static struct FrameTableTxtLine temp_tokens_table1; // weak
temp_tokens_table1.uPropCount = 0;
if ( str_to_parse && *str_to_parse )
{
parse_pos=(char*)str_to_parse;
new_token_flag = true;
in_quotes = false;
for(i = 0; (i<1000)&&(temp_tokens_table1.uPropCount < 30) ; ++i)
{
test_char=*parse_pos;
tokens_buff1[i]=test_char;
if ( !test_char )
break;
if ( (test_char != ' ') && (test_char != ',') && (test_char != '\t') || in_quotes )
{
if ( test_char == '"' )
{
tokens_buff1[i]= '\0';
new_token_flag = true;
if ( in_quotes )
in_quotes = false;
else
{
in_quotes = true;
if ( *(parse_pos+1) == '"' )
{
temp_tokens_table1.pProperties[temp_tokens_table1.uPropCount] = &tokens_buff1[i];
++temp_tokens_table1.uPropCount;
}
}
}
else
{
if ( new_token_flag )
{
temp_tokens_table1.pProperties[temp_tokens_table1.uPropCount] = &tokens_buff1[i];
++temp_tokens_table1.uPropCount;
}
new_token_flag = false;
}
}
else
{
tokens_buff1[i]= '\0';
new_token_flag = true;
}
++parse_pos;
}
tokens_buff1[i]= '\0';
}
memcpy(tokens_table, &temp_tokens_table1, sizeof(FrameTableTxtLine));
return tokens_table;
}
// F8BA58: using guessed type FrameTableTxtLine static_stru_F8BA58;
//----- (004BE485) --------------------------------------------------------
FrameTableTxtLine * frame_table_txt_parser(const char *str_to_parse, FrameTableTxtLine *tokens_table)
{
bool new_token_flag; // edx@3
bool in_quotes; // [sp+Ch] [bp-4h]@3
char* parse_pos;
unsigned char test_char;
int i;
static char tokens_buff2[1000];
static struct FrameTableTxtLine temp_tokens_table2; // weak
temp_tokens_table2.uPropCount = 0;
if ( str_to_parse && *str_to_parse )
{
parse_pos=(char*)str_to_parse;
new_token_flag = true;
in_quotes = false;
for(i = 0; (i<1000)&&(temp_tokens_table2.uPropCount < 30); ++i)
{
test_char=*parse_pos;
tokens_buff2[i]=test_char;
if ( !test_char )
break;
if ( (test_char != ' ') && (test_char != ',') && (test_char != '\t') || in_quotes )
{
if ( test_char == '"' )
{
tokens_buff2[i]= '\0';
new_token_flag = true;
if ( in_quotes )
in_quotes = false;
else
{
in_quotes = true;
if ( *(parse_pos+1) == '"' )
{
temp_tokens_table2.pProperties[temp_tokens_table2.uPropCount] = &tokens_buff2[i];
++temp_tokens_table2.uPropCount;
}
}
}
else
{
if ( new_token_flag )
{
temp_tokens_table2.pProperties[temp_tokens_table2.uPropCount] = &tokens_buff2[i];
++temp_tokens_table2.uPropCount;
}
new_token_flag = false;
}
}
else
{
tokens_buff2[i]= '\0';
new_token_flag = true;
}
++parse_pos;
}
tokens_buff2[i]= '\0';
}
memcpy(tokens_table, &temp_tokens_table2, sizeof(FrameTableTxtLine));
return tokens_table;
}