Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
R
ReAPIE
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
CK
game-dev
ReAPIE
Commits
658dc07c
Unverified
Commit
658dc07c
authored
Jul 29, 2019
by
s1lent
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix another crash due AMXX_Assert function.
parent
a68cde02
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
45 additions
and
35 deletions
+45
-35
reapi/msvc/reapi.vcxproj
reapi/msvc/reapi.vcxproj
+1
-0
reapi/msvc/reapi.vcxproj.filters
reapi/msvc/reapi.vcxproj.filters
+3
-0
reapi/src/amx_hook.cpp
reapi/src/amx_hook.cpp
+37
-0
reapi/src/amx_hook.h
reapi/src/amx_hook.h
+3
-15
reapi/src/amxxmodule.cpp
reapi/src/amxxmodule.cpp
+0
-18
reapi/src/amxxmodule.h
reapi/src/amxxmodule.h
+0
-1
reapi/src/hook_callback.h
reapi/src/hook_callback.h
+1
-1
No files found.
reapi/msvc/reapi.vcxproj
View file @
658dc07c
...
...
@@ -250,6 +250,7 @@
</ClCompile>
<ClCompile
Include=
"..\include\cssdk\public\interface.cpp"
/>
<ClCompile
Include=
"..\src\amxxmodule.cpp"
/>
<ClCompile
Include=
"..\src\amx_hook.cpp"
/>
<ClCompile
Include=
"..\src\api_config.cpp"
/>
<ClCompile
Include=
"..\src\dllapi.cpp"
/>
<ClCompile
Include=
"..\src\engine_api.cpp"
/>
...
...
reapi/msvc/reapi.vcxproj.filters
View file @
658dc07c
...
...
@@ -824,6 +824,9 @@
<ClCompile
Include=
"..\src\entity_callback.cpp"
>
<Filter>
src
</Filter>
</ClCompile>
<ClCompile
Include=
"..\src\amx_hook.cpp"
>
<Filter>
src
</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<None
Include=
"..\extra\amxmodx\scripting\include\reapi.inc"
>
...
...
reapi/src/amx_hook.cpp
0 → 100644
View file @
658dc07c
#include "precompiled.h"
CAmxxHookBase
::
CAmxxHookBase
(
AMX
*
amx
,
const
char
*
funcname
,
int
index
)
:
m_index
(
index
),
m_state
(
FSTATE_ENABLED
),
m_amx
(
amx
)
{
Q_strlcpy
(
m_CallbackName
,
funcname
);
}
CAmxxHookBase
::~
CAmxxHookBase
()
{
if
(
m_index
!=
-
1
)
{
g_amxxapi
.
UnregisterSPForward
(
m_index
);
m_index
=
-
1
;
}
}
void
CAmxxHookBase
::
Error
(
int
error
,
const
char
*
fmt
,
...)
{
va_list
argptr
;
static
char
string
[
1024
];
va_start
(
argptr
,
fmt
);
vsprintf
(
string
,
fmt
,
argptr
);
va_end
(
argptr
);
auto
scriptName
=
g_amxxapi
.
GetAmxScriptName
(
g_amxxapi
.
FindAmxScriptByAmx
(
m_amx
));
if
(
scriptName
)
{
if
((
scriptName
=
strrchr
(
scriptName
,
CORRECT_PATH_SEPARATOR
)))
scriptName
++
;
}
g_amxxapi
.
Log
(
"Run time error %d (plugin
\"
%s
\"
) (forward
\"
%s
\"
)"
,
error
,
scriptName
,
m_CallbackName
);
g_amxxapi
.
Log
(
"%s"
,
string
);
}
reapi/src/amx_hook.h
View file @
658dc07c
...
...
@@ -11,21 +11,8 @@ enum fwdstate
class
CAmxxHookBase
{
public:
~
CAmxxHookBase
()
{
if
(
m_index
!=
-
1
)
{
g_amxxapi
.
UnregisterSPForward
(
m_index
);
m_index
=
-
1
;
}
}
CAmxxHookBase
(
AMX
*
amx
,
const
char
*
funcname
,
int
index
)
:
m_index
(
index
),
m_state
(
FSTATE_ENABLED
),
m_amx
(
amx
)
{
Q_strlcpy
(
m_CallbackName
,
funcname
);
}
~
CAmxxHookBase
();
CAmxxHookBase
(
AMX
*
amx
,
const
char
*
funcname
,
int
index
);
int
GetIndex
()
const
{
return
m_index
;
}
fwdstate
GetState
()
const
{
return
m_state
;
}
...
...
@@ -33,6 +20,7 @@ public:
const
char
*
GetCallbackName
()
const
{
return
m_CallbackName
;
}
void
SetState
(
fwdstate
st
)
{
m_state
=
st
;
}
void
Error
(
int
error
,
const
char
*
fmt
,
...);
private:
int
m_index
;
...
...
reapi/src/amxxmodule.cpp
View file @
658dc07c
...
...
@@ -221,24 +221,6 @@ NOINLINE void AMXX_LogError(AMX *amx, int err, const char *fmt, ...)
g_amxxapi
.
LogError
(
amx
,
err
,
"[%s] %s"
,
g_ModuleInfo
.
logtag
,
msg
);
}
NOINLINE
void
AMXX_Assert
(
AMX
*
amx
,
const
char
*
fmt
,
...)
{
char
msg
[
2048
];
va_list
arglst
;
va_start
(
arglst
,
fmt
);
vsnprintf
(
msg
,
sizeof
msg
,
fmt
,
arglst
);
va_end
(
arglst
);
auto
scriptName
=
g_amxxapi
.
GetAmxScriptName
(
g_amxxapi
.
FindAmxScriptByAmx
(
amx
));
if
(
scriptName
)
{
if
((
scriptName
=
strrchr
(
scriptName
,
CORRECT_PATH_SEPARATOR
)))
scriptName
++
;
}
g_amxxapi
.
LogError
(
amx
,
AMX_ERR_ASSERT
,
"[%s] %s"
,
scriptName
,
msg
);
}
char
*
getAmxString
(
cell
*
src
,
char
*
dest
,
size_t
max
,
size_t
*
len
)
{
char
*
start
=
dest
;
...
...
reapi/src/amxxmodule.h
View file @
658dc07c
...
...
@@ -493,7 +493,6 @@ extern amxxapi_t g_amxxapi;
void
AMXX_Log
(
const
char
*
fmt
,
...);
void
AMXX_LogError
(
AMX
*
amx
,
int
err
,
const
char
*
fmt
,
...);
void
AMXX_Assert
(
AMX
*
amx
,
const
char
*
fmt
,
...);
char
*
getAmxString
(
cell
*
src
,
char
*
dest
,
size_t
max
,
size_t
*
len
=
nullptr
);
void
setAmxString
(
cell
*
dest
,
const
char
*
string
,
size_t
max
);
...
...
reapi/src/hook_callback.h
View file @
658dc07c
...
...
@@ -215,7 +215,7 @@ NOINLINE R DLLEXPORT _callForward(const hook_t* hook, original_t original, f_arg
}
if
(
unlikely
(
!
hookCtx
->
retVal
.
set
))
{
AMXX_Assert
(
fwd
->
GetAmx
(),
"%s : Can't suppress original function call without new return value set"
,
fwd
->
GetCallbackName
()
);
fwd
->
Error
(
AMX_ERR_ASSERT
,
"Can't suppress original function call without new return value set"
);
continue
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment