Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
engine
Manage
Activity
Members
Labels
Plan
Redmine
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
sip
engine
Commits
3283d180
Commit
3283d180
authored
Dec 19, 2018
by
D-AIRY
Browse files
Options
Downloads
Patches
Plain Diff
Added config save logging
parent
f1a05f07
No related branches found
No related tags found
1 merge request
!1
Version 0.10.1
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
source/core/Config.cpp
+61
-7
61 additions, 7 deletions
source/core/Config.cpp
source/skyxengine.cpp
+2
-0
2 additions, 0 deletions
source/skyxengine.cpp
with
63 additions
and
7 deletions
source/core/Config.cpp
+
61
−
7
View file @
3283d180
...
...
@@ -5,6 +5,7 @@ See the license in LICENSE
***********************************************************/
#include
"Config.h"
#include
"sxcore.h"
/*
1. Проверить обработку циклических зависимостей
...
...
@@ -478,41 +479,94 @@ void CConfig::set(const char * sectionp, const char * key, const char * val)
int
CConfig
::
save
()
{
static
const
bool
*
s_pbDebug
=
GET_PCVAR_BOOL
(
"dbg_config_save"
);
if
(
*
s_pbDebug
)
{
printf
(
COLOR_GRAY
"====== "
COLOR_CYAN
"CConfig::save() "
COLOR_GRAY
"======"
COLOR_RESET
"
\n
"
);
}
int
terror
=
0
;
for
(
AssotiativeArray
<
CConfigString
,
CSection
>::
Iterator
i
=
m_mSections
.
begin
();
i
;
i
++
)
{
if
(
*
s_pbDebug
)
{
printf
(
"Testing section: "
COLOR_LGREEN
"%s"
COLOR_RESET
"..."
,
i
.
first
->
c_str
());
}
if
(
i
.
second
->
isModified
)
{
if
(
*
s_pbDebug
)
{
printf
(
COLOR_YELLOW
" modified"
COLOR_RESET
"
\n
"
,
i
.
first
->
c_str
());
}
for
(
AssotiativeArray
<
CConfigString
,
CValue
>::
Iterator
j
=
i
.
second
->
mValues
.
begin
();
j
;
j
++
)
{
if
(
*
s_pbDebug
)
{
printf
(
" testing key: "
COLOR_LGREEN
"%s"
COLOR_RESET
"..."
,
j
.
first
->
c_str
());
}
if
(
j
.
second
->
isModified
)
{
if
(
*
s_pbDebug
)
{
printf
(
COLOR_YELLOW
" modified"
COLOR_RESET
"
\n
"
,
i
.
first
->
c_str
());
}
if
(
i
.
second
->
native
)
// Write to BaseFile
{
if
(
*
s_pbDebug
)
{
printf
(
" writing to base file "
COLOR_CYAN
"%s"
COLOR_RESET
"...
\n
"
,
BaseFile
.
c_str
());
}
terror
=
writeFile
(
BaseFile
,
*
i
.
first
,
*
j
.
first
,
j
.
second
->
val
);
if
(
terror
!=
0
)
return
terror
;
goto
end
;
}
else
// Write to i.second->Include
{
if
(
*
s_pbDebug
)
{
printf
(
" writing to include file "
COLOR_CYAN
"%s"
COLOR_RESET
"...
\n
"
,
i
.
second
->
Include
.
c_str
());
}
terror
=
writeFile
(
i
.
second
->
Include
,
*
i
.
first
,
*
j
.
first
,
j
.
second
->
val
);
if
(
terror
!=
0
)
return
terror
;
goto
end
;
}
}
else
{
if
(
*
s_pbDebug
)
{
printf
(
COLOR_GRAY
" not modified"
COLOR_RESET
"
\n
"
,
i
.
first
->
c_str
());
}
}
}
return
0
;
}
else
{
if
(
*
s_pbDebug
)
{
printf
(
COLOR_GRAY
" not modified"
COLOR_RESET
"
\n
"
,
i
.
first
->
c_str
());
}
}
}
end
:
if
(
*
s_pbDebug
)
{
printf
(
COLOR_GRAY
"============================="
COLOR_RESET
"
\n
"
);
}
return
(
terror
);
}
int
CConfig
::
writeFile
(
const
CConfigString
&
name
,
CConfigString
section
,
CConfigString
key
,
const
CConfigString
&
val
)
{
static
const
bool
*
s_pbDebug
=
GET_PCVAR_BOOL
(
"dbg_config_save"
);
//printf("W: %s\t[%s]: %s = %s\n", name.c_str(), section.c_str(), key.c_str(), val.c_str());
FILE
*
pF
=
fopen
(
name
.
c_str
(),
"rb"
);
if
(
pF
)
{
if
(
*
s_pbDebug
)
{
printf
(
" file opened
\n
"
);
}
fseek
(
pF
,
0
,
SEEK_END
);
UINT
fl
=
ftell
(
pF
);
fseek
(
pF
,
0
,
SEEK_SET
);
...
...
This diff is collapsed.
Click to expand it.
source/skyxengine.cpp
+
2
−
0
View file @
3283d180
...
...
@@ -580,6 +580,8 @@ void SkyXEngine_CreateLoadCVar()
Core_0RegisterConcmd
(
"change_mode_window_abs"
,
SRender_FullScreenChangeSizeAbs
);
#endif
Core_0RegisterCVarBool
(
"dbg_config_save"
,
false
,
"Отладочный вывод процесса сохранения конфига"
);
LibReport
(
REPORT_MSG_LEVEL_NOTICE
,
"CVar initialized
\n
"
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment