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
31ef3c26
Commit
31ef3c26
authored
Jul 30, 2025
by
nanahira
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of github.com:Fluorohydride/ygopro-core into develop
parents
e883e2d8
1bde2fb4
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
48 additions
and
33 deletions
+48
-33
card.cpp
card.cpp
+0
-5
card_data.h
card_data.h
+30
-24
duel.cpp
duel.cpp
+1
-1
interpreter.cpp
interpreter.cpp
+15
-1
interpreter.h
interpreter.h
+1
-1
libduel.cpp
libduel.cpp
+1
-1
No files found.
card.cpp
View file @
31ef3c26
...
...
@@ -504,11 +504,6 @@ uint32_t card::get_another_code() {
return
otcode
;
return
0
;
}
inline
bool
check_setcode
(
uint16_t
setcode
,
uint32_t
value
)
{
const
uint32_t
settype
=
value
&
0x0fffU
;
const
uint32_t
setsubtype
=
value
&
0xf000U
;
return
(
setcode
&
0x0fffU
)
==
settype
&&
(
setcode
&
setsubtype
)
==
setsubtype
;
}
int32_t
card
::
is_set_card
(
uint32_t
set_code
)
{
uint32_t
code1
=
get_code
();
card_data
dat1
;
...
...
card_data.h
View file @
31ef3c26
...
...
@@ -24,6 +24,33 @@ const std::unordered_map<uint32_t, uint32_t> second_code = {
{
CARD_HERMOS
,
10000070u
},
};
inline
bool
check_setcode
(
uint16_t
setcode
,
uint32_t
value
)
{
const
uint32_t
settype
=
value
&
0x0fffU
;
const
uint32_t
setsubtype
=
value
&
0xf000U
;
return
setcode
&&
(
setcode
&
0x0fffU
)
==
settype
&&
(
setcode
&
setsubtype
)
==
setsubtype
;
}
inline
void
write_setcode
(
uint16_t
list
[],
uint64_t
value
)
{
if
(
!
list
)
return
;
int
len
=
0
;
while
(
value
)
{
if
(
value
&
0xffff
)
{
list
[
len
]
=
value
&
0xffff
;
++
len
;
}
value
>>=
16
;
}
if
(
len
<
SIZE_SETCODE
)
std
::
memset
(
list
+
len
,
0
,
(
SIZE_SETCODE
-
len
)
*
sizeof
(
uint16_t
));
}
inline
bool
is_alternative
(
uint32_t
code
,
uint32_t
alias
)
{
if
(
code
==
CARD_BLACK_LUSTER_SOLDIER2
)
return
false
;
return
alias
&&
(
alias
<
code
+
CARD_ARTWORK_VERSIONS_OFFSET
)
&&
(
code
<
alias
+
CARD_ARTWORK_VERSIONS_OFFSET
);
}
struct
card_data
{
uint32_t
code
{};
uint32_t
alias
{};
...
...
@@ -43,38 +70,17 @@ struct card_data {
}
bool
is_setcode
(
uint32_t
value
)
const
{
const
uint16_t
settype
=
value
&
0x0fff
;
const
uint16_t
setsubtype
=
value
&
0xf000
;
for
(
auto
&
x
:
setcode
)
{
if
((
x
&
0x0fff
)
==
settype
&&
(
x
&
setsubtype
)
==
setsubtype
)
return
true
;
if
(
!
x
)
return
false
;
if
(
check_setcode
(
x
,
value
))
return
true
;
}
return
false
;
}
bool
is_alternative
()
const
{
if
(
code
==
CARD_BLACK_LUSTER_SOLDIER2
)
return
false
;
return
alias
&&
(
alias
<
code
+
CARD_ARTWORK_VERSIONS_OFFSET
)
&&
(
code
<
alias
+
CARD_ARTWORK_VERSIONS_OFFSET
);
}
void
set_setcode
(
uint64_t
value
)
{
int
ctr
=
0
;
while
(
value
)
{
if
(
value
&
0xffff
)
{
setcode
[
ctr
]
=
value
&
0xffff
;
++
ctr
;
}
value
>>=
16
;
}
if
(
ctr
<
SIZE_SETCODE
)
std
::
memset
(
setcode
+
ctr
,
0
,
(
SIZE_SETCODE
-
ctr
)
*
sizeof
(
uint16_t
));
}
uint32_t
get_original_code
()
const
{
return
is_alternative
()
?
alias
:
code
;
return
is_alternative
(
code
,
alias
)
?
alias
:
code
;
}
};
...
...
duel.cpp
View file @
31ef3c26
...
...
@@ -16,7 +16,7 @@
#include "buffer.h"
duel
::
duel
()
{
lua
=
new
interpreter
(
this
);
lua
=
new
interpreter
(
this
,
false
);
game_field
=
new
field
(
this
);
game_field
->
temp_card
=
new_card
(
TEMP_CARD_ID
);
game_field
->
rose_card
=
0
;
...
...
interpreter.cpp
View file @
31ef3c26
...
...
@@ -14,7 +14,7 @@
#include "ocgapi.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
);
lua_state
=
lua_newstate
(
LuaMemTracker
::
AllocThunk
,
mem_tracker
);
current_state
=
lua_state
;
...
...
@@ -39,6 +39,20 @@ interpreter::interpreter(duel* pd): coroutines(256) {
lua_pop
(
lua_state
,
1
);
luaL_requiref
(
lua_state
,
"coroutine"
,
luaopen_coroutine
,
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
)
{
lua_pushnil
(
lua_state
);
lua_setglobal
(
lua_state
,
name
);
};
nil_out
(
"collectgarbage"
);
if
(
!
enable_unsafe_libraries
)
{
nil_out
(
"dofile"
);
nil_out
(
"loadfile"
);
}
#endif
//open all libs
...
...
interpreter.h
View file @
31ef3c26
...
...
@@ -57,7 +57,7 @@ public:
int32_t
preloaded
;
LuaMemTracker
*
mem_tracker
=
nullptr
;
explicit
interpreter
(
duel
*
pd
);
explicit
interpreter
(
duel
*
pd
,
bool
enable_unsafe_libraries
);
~
interpreter
();
void
register_card
(
card
*
pcard
);
...
...
libduel.cpp
View file @
31ef3c26
...
...
@@ -4839,7 +4839,7 @@ int32_t scriptlib::duel_is_player_can_spsummon_monster(lua_State * L) {
dat
.
code
=
code
;
dat
.
alias
=
0
;
if
(
lua_gettop
(
L
)
>=
3
&&
!
lua_isnil
(
L
,
3
))
dat
.
set_setcode
((
uint64_t
)
lua_tointeger
(
L
,
3
));
write_setcode
(
dat
.
setcode
,
lua_tointeger
(
L
,
3
));
if
(
lua_gettop
(
L
)
>=
4
&&
!
lua_isnil
(
L
,
4
))
dat
.
type
=
(
uint32_t
)
lua_tointeger
(
L
,
4
);
if
(
lua_gettop
(
L
)
>=
5
&&
!
lua_isnil
(
L
,
5
))
...
...
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