Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
ygopro-core
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nanahira
ygopro-core
Commits
292e0b0e
Commit
292e0b0e
authored
Jul 30, 2025
by
nanahira
Committed by
GitHub
Jul 30, 2025
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into patch-memtrack
parents
9198f9e4
1bde2fb4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
7 deletions
+12
-7
duel.cpp
duel.cpp
+1
-1
interpreter.cpp
interpreter.cpp
+10
-5
interpreter.h
interpreter.h
+1
-1
No files found.
duel.cpp
View file @
292e0b0e
...
@@ -16,7 +16,7 @@
...
@@ -16,7 +16,7 @@
#include "buffer.h"
#include "buffer.h"
duel
::
duel
()
{
duel
::
duel
()
{
lua
=
new
interpreter
(
this
);
lua
=
new
interpreter
(
this
,
false
);
game_field
=
new
field
(
this
);
game_field
=
new
field
(
this
);
game_field
->
temp_card
=
new_card
(
TEMP_CARD_ID
);
game_field
->
temp_card
=
new_card
(
TEMP_CARD_ID
);
message_buffer
.
reserve
(
SIZE_MESSAGE_BUFFER
);
message_buffer
.
reserve
(
SIZE_MESSAGE_BUFFER
);
...
...
interpreter.cpp
View file @
292e0b0e
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
#include "ocgapi.h"
#include "ocgapi.h"
#include "interpreter.h"
#include "interpreter.h"
interpreter
::
interpreter
(
duel
*
pd
)
:
coroutines
(
256
)
{
interpreter
::
interpreter
(
duel
*
pd
,
bool
enable_unsafe_libraries
)
:
coroutines
(
256
)
{
mem_tracker
=
new
LuaMemTracker
(
YGOPRO_LUA_MEMORY_SIZE
);
mem_tracker
=
new
LuaMemTracker
(
YGOPRO_LUA_MEMORY_SIZE
);
lua_state
=
lua_newstate
(
LuaMemTracker
::
AllocThunk
,
mem_tracker
);
lua_state
=
lua_newstate
(
LuaMemTracker
::
AllocThunk
,
mem_tracker
);
current_state
=
lua_state
;
current_state
=
lua_state
;
...
@@ -33,15 +33,20 @@ interpreter::interpreter(duel* pd): coroutines(256) {
...
@@ -33,15 +33,20 @@ interpreter::interpreter(duel* pd): coroutines(256) {
lua_pop
(
lua_state
,
1
);
lua_pop
(
lua_state
,
1
);
luaL_requiref
(
lua_state
,
"math"
,
luaopen_math
,
1
);
luaL_requiref
(
lua_state
,
"math"
,
luaopen_math
,
1
);
lua_pop
(
lua_state
,
1
);
lua_pop
(
lua_state
,
1
);
if
(
enable_unsafe_libraries
)
{
luaL_requiref
(
lua_state
,
"io"
,
luaopen_io
,
1
);
lua_pop
(
lua_state
,
1
);
}
auto
nil_out
=
[
&
](
const
char
*
name
)
{
auto
nil_out
=
[
&
](
const
char
*
name
)
{
lua_pushnil
(
lua_state
);
lua_pushnil
(
lua_state
);
lua_setglobal
(
lua_state
,
name
);
lua_setglobal
(
lua_state
,
name
);
};
};
nil_out
(
"collectgarbage"
);
nil_out
(
"collectgarbage"
);
#ifndef ENABLE_UNSAFE_LIBRARIES
if
(
!
enable_unsafe_libraries
)
{
nil_out
(
"dofile"
);
nil_out
(
"dofile"
);
nil_out
(
"loadfile"
);
nil_out
(
"loadfile"
);
#endif // ENABLE_UNSAFE_LIBRARIES
}
//open all libs
//open all libs
scriptlib
::
open_cardlib
(
lua_state
);
scriptlib
::
open_cardlib
(
lua_state
);
scriptlib
::
open_effectlib
(
lua_state
);
scriptlib
::
open_effectlib
(
lua_state
);
...
...
interpreter.h
View file @
292e0b0e
...
@@ -55,7 +55,7 @@ public:
...
@@ -55,7 +55,7 @@ public:
int32_t
no_action
;
int32_t
no_action
;
int32_t
call_depth
;
int32_t
call_depth
;
explicit
interpreter
(
duel
*
pd
);
explicit
interpreter
(
duel
*
pd
,
bool
enable_unsafe_libraries
);
~
interpreter
();
~
interpreter
();
void
register_card
(
card
*
pcard
);
void
register_card
(
card
*
pcard
);
...
...
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