Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
YGOMobile
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
fallenstardust
YGOMobile
Commits
8ca8759a
Commit
8ca8759a
authored
May 24, 2024
by
fallenstardust
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update gframe
parent
31b2b890
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
142 additions
and
111 deletions
+142
-111
Classes/gframe/bufferio.h
Classes/gframe/bufferio.h
+72
-46
Classes/gframe/client_card.h
Classes/gframe/client_card.h
+8
-0
Classes/gframe/client_field.cpp
Classes/gframe/client_field.cpp
+1
-2
Classes/gframe/data_manager.cpp
Classes/gframe/data_manager.cpp
+19
-10
Classes/gframe/data_manager.h
Classes/gframe/data_manager.h
+1
-1
Classes/gframe/deck_con.cpp
Classes/gframe/deck_con.cpp
+6
-6
Classes/gframe/deck_manager.cpp
Classes/gframe/deck_manager.cpp
+1
-1
Classes/gframe/game.cpp
Classes/gframe/game.cpp
+1
-1
Classes/gframe/image_manager.cpp
Classes/gframe/image_manager.cpp
+10
-10
Classes/gframe/irrUString.h
Classes/gframe/irrUString.h
+2
-6
Classes/gframe/menu_handler.cpp
Classes/gframe/menu_handler.cpp
+3
-3
Classes/gframe/myfilesystem.h
Classes/gframe/myfilesystem.h
+1
-1
Classes/gframe/replay.cpp
Classes/gframe/replay.cpp
+3
-7
Classes/gframe/replay.h
Classes/gframe/replay.h
+14
-17
No files found.
Classes/gframe/bufferio.h
View file @
8ca8759a
...
@@ -49,67 +49,93 @@ public:
...
@@ -49,67 +49,93 @@ public:
return
l
;
return
l
;
}
}
// UTF-16/UTF-32 to UTF-8
// UTF-16/UTF-32 to UTF-8
static
int
EncodeUTF8
(
const
wchar_t
*
wsrc
,
char
*
str
)
{
template
<
size_t
N
>
static
int
EncodeUTF8
(
const
wchar_t
*
wsrc
,
char
(
&
str
)[
N
])
{
char
*
pstr
=
str
;
char
*
pstr
=
str
;
while
(
*
wsrc
!=
0
)
{
while
(
*
wsrc
!=
0
)
{
if
(
*
wsrc
<
0x80
)
{
unsigned
cur
=
*
wsrc
;
*
str
=
(
char
)
*
wsrc
;
int
codepoint_size
=
0
;
++
str
;
if
(
cur
<
0x80U
)
}
else
if
(
*
wsrc
<
0x800
)
{
codepoint_size
=
1
;
str
[
0
]
=
((
*
wsrc
>>
6
)
&
0x1f
)
|
0xc0
;
else
if
(
cur
<
0x800U
)
str
[
1
]
=
((
*
wsrc
)
&
0x3f
)
|
0x80
;
codepoint_size
=
2
;
str
+=
2
;
else
if
(
cur
<
0x10000U
&&
(
cur
<
0xd800U
||
cur
>
0xdfffU
))
}
else
if
(
*
wsrc
<
0x10000
&&
(
*
wsrc
<
0xd800
||
*
wsrc
>
0xdfff
))
{
codepoint_size
=
3
;
str
[
0
]
=
((
*
wsrc
>>
12
)
&
0xf
)
|
0xe0
;
else
str
[
1
]
=
((
*
wsrc
>>
6
)
&
0x3f
)
|
0x80
;
codepoint_size
=
4
;
str
[
2
]
=
((
*
wsrc
)
&
0x3f
)
|
0x80
;
if
(
pstr
-
str
+
codepoint_size
>
N
-
1
)
str
+=
3
;
break
;
}
else
{
switch
(
codepoint_size
)
{
#ifdef _WIN32
case
1
:
unsigned
unicode
=
0
;
*
pstr
=
(
char
)
cur
;
unicode
|=
(
*
wsrc
++
&
0x3ff
)
<<
10
;
break
;
unicode
|=
*
wsrc
&
0x3ff
;
case
2
:
unicode
+=
0x10000
;
pstr
[
0
]
=
((
cur
>>
6
)
&
0x1f
)
|
0xc0
;
str
[
0
]
=
((
unicode
>>
18
)
&
0x7
)
|
0xf0
;
pstr
[
1
]
=
(
cur
&
0x3f
)
|
0x80
;
str
[
1
]
=
((
unicode
>>
12
)
&
0x3f
)
|
0x80
;
break
;
str
[
2
]
=
((
unicode
>>
6
)
&
0x3f
)
|
0x80
;
case
3
:
str
[
3
]
=
((
unicode
)
&
0x3f
)
|
0x80
;
pstr
[
0
]
=
((
cur
>>
12
)
&
0xf
)
|
0xe0
;
#else
pstr
[
1
]
=
((
cur
>>
6
)
&
0x3f
)
|
0x80
;
str
[
0
]
=
((
*
wsrc
>>
18
)
&
0x7
)
|
0xf0
;
pstr
[
2
]
=
(
cur
&
0x3f
)
|
0x80
;
str
[
1
]
=
((
*
wsrc
>>
12
)
&
0x3f
)
|
0x80
;
break
;
str
[
2
]
=
((
*
wsrc
>>
6
)
&
0x3f
)
|
0x80
;
case
4
:
str
[
3
]
=
((
*
wsrc
)
&
0x3f
)
|
0x80
;
if
(
sizeof
(
wchar_t
)
==
2
)
{
#endif // _WIN32
cur
=
0
;
str
+=
4
;
cur
|=
((
unsigned
)
*
wsrc
&
0x3ff
)
<<
10
;
++
wsrc
;
cur
|=
(
unsigned
)
*
wsrc
&
0x3ff
;
cur
+=
0x10000
;
}
pstr
[
0
]
=
((
cur
>>
18
)
&
0x7
)
|
0xf0
;
pstr
[
1
]
=
((
cur
>>
12
)
&
0x3f
)
|
0x80
;
pstr
[
2
]
=
((
cur
>>
6
)
&
0x3f
)
|
0x80
;
pstr
[
3
]
=
(
cur
&
0x3f
)
|
0x80
;
break
;
default:
break
;
}
}
pstr
+=
codepoint_size
;
wsrc
++
;
wsrc
++
;
}
}
*
str
=
0
;
*
p
str
=
0
;
return
str
-
p
str
;
return
pstr
-
str
;
}
}
// UTF-8 to UTF-16/UTF-32
// UTF-8 to UTF-16/UTF-32
static
int
DecodeUTF8
(
const
char
*
src
,
wchar_t
*
wstr
)
{
template
<
size_t
N
>
static
int
DecodeUTF8
(
const
char
*
src
,
wchar_t
(
&
wstr
)[
N
])
{
const
char
*
p
=
src
;
const
char
*
p
=
src
;
wchar_t
*
wp
=
wstr
;
wchar_t
*
wp
=
wstr
;
while
(
*
p
!=
0
)
{
while
(
*
p
!=
0
)
{
if
((
*
p
&
0x80
)
==
0
)
{
const
unsigned
cur
=
(
unsigned
)
*
p
&
0xff
;
int
codepoint_size
=
0
;
if
((
cur
&
0xf8
)
==
0xf0
)
{
if
(
sizeof
(
wchar_t
)
==
2
)
codepoint_size
=
2
;
else
codepoint_size
=
1
;
}
else
codepoint_size
=
1
;
if
(
wp
-
wstr
+
codepoint_size
>
N
-
1
)
break
;
if
((
cur
&
0x80
)
==
0
)
{
*
wp
=
*
p
;
*
wp
=
*
p
;
p
++
;
p
++
;
}
else
if
((
*
p
&
0xe0
)
==
0xc0
)
{
}
else
if
((
cur
&
0xe0
)
==
0xc0
)
{
*
wp
=
(((
unsigned
)
p
[
0
]
&
0x1f
)
<<
6
)
|
((
unsigned
)
p
[
1
]
&
0x3f
);
*
wp
=
(((
unsigned
)
p
[
0
]
&
0x1f
)
<<
6
)
|
((
unsigned
)
p
[
1
]
&
0x3f
);
p
+=
2
;
p
+=
2
;
}
else
if
((
*
p
&
0xf0
)
==
0xe0
)
{
}
else
if
((
cur
&
0xf0
)
==
0xe0
)
{
*
wp
=
(((
unsigned
)
p
[
0
]
&
0xf
)
<<
12
)
|
(((
unsigned
)
p
[
1
]
&
0x3f
)
<<
6
)
|
((
unsigned
)
p
[
2
]
&
0x3f
);
*
wp
=
(((
unsigned
)
p
[
0
]
&
0xf
)
<<
12
)
|
(((
unsigned
)
p
[
1
]
&
0x3f
)
<<
6
)
|
((
unsigned
)
p
[
2
]
&
0x3f
);
p
+=
3
;
p
+=
3
;
}
else
if
((
*
p
&
0xf8
)
==
0xf0
)
{
}
else
if
((
cur
&
0xf8
)
==
0xf0
)
{
#ifdef _WIN32
if
(
sizeof
(
wchar_t
)
==
2
)
{
unsigned
unicode
=
(((
unsigned
)
p
[
0
]
&
0x7
)
<<
18
)
|
(((
unsigned
)
p
[
1
]
&
0x3f
)
<<
12
)
|
(((
unsigned
)
p
[
2
]
&
0x3f
)
<<
6
)
|
((
unsigned
)
p
[
3
]
&
0x3f
);
unsigned
unicode
=
(((
unsigned
)
p
[
0
]
&
0x7
)
<<
18
)
|
(((
unsigned
)
p
[
1
]
&
0x3f
)
<<
12
)
|
(((
unsigned
)
p
[
2
]
&
0x3f
)
<<
6
)
|
((
unsigned
)
p
[
3
]
&
0x3f
);
unicode
-=
0x10000
;
unicode
-=
0x10000
;
*
wp
++
=
(
unicode
>>
10
)
|
0xd800
;
*
wp
++
=
(
unicode
>>
10
)
|
0xd800
;
*
wp
=
(
unicode
&
0x3ff
)
|
0xdc00
;
*
wp
=
(
unicode
&
0x3ff
)
|
0xdc00
;
#else
}
else
{
*
wp
=
(((
unsigned
)
p
[
0
]
&
0x7
)
<<
18
)
|
(((
unsigned
)
p
[
1
]
&
0x3f
)
<<
12
)
|
(((
unsigned
)
p
[
2
]
&
0x3f
)
<<
6
)
|
((
unsigned
)
p
[
3
]
&
0x3f
);
*
wp
=
(((
unsigned
)
p
[
0
]
&
0x7
)
<<
18
)
|
(((
unsigned
)
p
[
1
]
&
0x3f
)
<<
12
)
|
(((
unsigned
)
p
[
2
]
&
0x3f
)
<<
6
)
|
((
unsigned
)
p
[
3
]
&
0x3f
);
#endif // _WIN32
}
p
+=
4
;
p
+=
4
;
}
else
}
else
p
++
;
p
++
;
...
...
Classes/gframe/client_card.h
View file @
8ca8759a
...
@@ -14,6 +14,14 @@ using CardData = card_data;
...
@@ -14,6 +14,14 @@ using CardData = card_data;
struct
CardDataC
:
card_data
{
struct
CardDataC
:
card_data
{
unsigned
int
ot
{};
unsigned
int
ot
{};
unsigned
int
category
{};
unsigned
int
category
{};
bool
is_setcodes
(
std
::
vector
<
uint32
>
values
)
const
{
for
(
auto
&
value
:
values
)
{
if
(
is_setcode
(
value
))
return
true
;
}
return
false
;
}
};
};
struct
CardString
{
struct
CardString
{
std
::
wstring
name
;
std
::
wstring
name
;
...
...
Classes/gframe/client_field.cpp
View file @
8ca8759a
...
@@ -700,8 +700,7 @@ void ClientField::ShowSelectOption(int select_hint) {
...
@@ -700,8 +700,7 @@ void ClientField::ShowSelectOption(int select_hint) {
mainGame
->
wOptions
->
setRelativePosition
(
pos
);
mainGame
->
wOptions
->
setRelativePosition
(
pos
);
mainGame
->
bgOptions
->
setRelativePosition
(
rect
<
s32
>
(
0
,
0
,
(
scrollbar
?
405
:
390
)
*
mainGame
->
xScale
,
pos
.
LowerRightCorner
.
Y
-
pos
.
UpperLeftCorner
.
Y
));
mainGame
->
bgOptions
->
setRelativePosition
(
rect
<
s32
>
(
0
,
0
,
(
scrollbar
?
405
:
390
)
*
mainGame
->
xScale
,
pos
.
LowerRightCorner
.
Y
-
pos
.
UpperLeftCorner
.
Y
));
}
else
{
}
else
{
mainGame
->
SetStaticText
(
mainGame
->
stOptions
,
350
*
mainGame
->
xScale
,
mainGame
->
guiFont
,
mainGame
->
SetStaticText
(
mainGame
->
stOptions
,
350
*
mainGame
->
xScale
,
mainGame
->
guiFont
,
dataManager
.
GetDesc
(
select_options
[
0
]));
(
wchar_t
*
)
dataManager
.
GetDesc
(
select_options
[
0
]));
mainGame
->
stOptions
->
setVisible
(
true
);
mainGame
->
stOptions
->
setVisible
(
true
);
mainGame
->
btnOptionp
->
setVisible
(
false
);
mainGame
->
btnOptionp
->
setVisible
(
false
);
mainGame
->
btnOptionn
->
setVisible
(
count
>
1
);
mainGame
->
btnOptionn
->
setVisible
(
count
>
1
);
...
...
Classes/gframe/data_manager.cpp
View file @
8ca8759a
...
@@ -272,13 +272,22 @@ const wchar_t* DataManager::GetSetName(int code) {
...
@@ -272,13 +272,22 @@ const wchar_t* DataManager::GetSetName(int code) {
return
NULL
;
return
NULL
;
return
csit
->
second
.
c_str
();
return
csit
->
second
.
c_str
();
}
}
unsigned
int
DataManager
::
GetSetCode
(
const
wchar_t
*
setname
)
{
std
::
vector
<
unsigned
int
>
DataManager
::
GetSetCodes
(
std
::
wstring
setname
)
{
std
::
vector
<
unsigned
int
>
matchingCodes
;
for
(
auto
csit
=
_setnameStrings
.
begin
();
csit
!=
_setnameStrings
.
end
();
++
csit
)
{
for
(
auto
csit
=
_setnameStrings
.
begin
();
csit
!=
_setnameStrings
.
end
();
++
csit
)
{
auto
xpos
=
csit
->
second
.
find_first_of
(
L'|'
);
//setname|another setname or extra info
auto
xpos
=
csit
->
second
.
find_first_of
(
L'|'
);
//setname|another setname or extra info
if
(
csit
->
second
.
compare
(
0
,
xpos
,
setname
)
==
0
||
csit
->
second
.
compare
(
xpos
+
1
,
csit
->
second
.
length
(),
setname
)
==
0
)
if
(
setname
.
size
()
<
2
)
{
return
csit
->
first
;
if
(
csit
->
second
.
compare
(
0
,
xpos
,
setname
)
==
0
||
csit
->
second
.
compare
(
xpos
+
1
,
csit
->
second
.
length
(),
setname
)
==
0
)
matchingCodes
.
push_back
(
csit
->
first
);
}
else
{
if
(
csit
->
second
.
substr
(
0
,
xpos
).
find
(
setname
)
!=
std
::
wstring
::
npos
||
csit
->
second
.
substr
(
xpos
+
1
).
find
(
setname
)
!=
std
::
wstring
::
npos
)
{
matchingCodes
.
push_back
(
csit
->
first
);
}
}
}
}
return
0
;
return
matchingCodes
;
}
}
const
wchar_t
*
DataManager
::
GetNumString
(
int
num
,
bool
bracket
)
{
const
wchar_t
*
DataManager
::
GetNumString
(
int
num
,
bool
bracket
)
{
if
(
!
bracket
)
if
(
!
bracket
)
...
@@ -405,14 +414,14 @@ uint32 DataManager::CardReader(uint32 code, card_data* pData) {
...
@@ -405,14 +414,14 @@ uint32 DataManager::CardReader(uint32 code, card_data* pData) {
}
}
byte
*
DataManager
::
ScriptReaderEx
(
const
char
*
script_name
,
int
*
slen
)
{
byte
*
DataManager
::
ScriptReaderEx
(
const
char
*
script_name
,
int
*
slen
)
{
// default script name: ./script/c%d.lua
// default script name: ./script/c%d.lua
char
first
[
256
];
char
first
[
256
]
{}
;
char
second
[
256
];
char
second
[
256
]
{}
;
if
(
mainGame
->
gameConf
.
prefer_expansion_script
)
{
if
(
mainGame
->
gameConf
.
prefer_expansion_script
)
{
s
printf
(
first
,
"expansions/%s"
,
script_name
+
2
);
s
nprintf
(
first
,
sizeof
first
,
"expansions/%s"
,
script_name
+
2
);
s
printf
(
second
,
"%s"
,
script_name
+
2
);
s
nprintf
(
second
,
sizeof
second
,
"%s"
,
script_name
+
2
);
}
else
{
}
else
{
s
printf
(
first
,
"%s"
,
script_name
+
2
);
s
nprintf
(
first
,
sizeof
first
,
"%s"
,
script_name
+
2
);
s
printf
(
second
,
"expansions/%s"
,
script_name
+
2
);
s
nprintf
(
second
,
sizeof
second
,
"expansions/%s"
,
script_name
+
2
);
}
}
if
(
mainGame
->
gameConf
.
prefer_expansion_script
)
{
if
(
mainGame
->
gameConf
.
prefer_expansion_script
)
{
if
(
ScriptReader
(
first
,
slen
))
if
(
ScriptReader
(
first
,
slen
))
...
...
Classes/gframe/data_manager.h
View file @
8ca8759a
...
@@ -34,7 +34,7 @@ public:
...
@@ -34,7 +34,7 @@ public:
const
wchar_t
*
GetVictoryString
(
int
code
);
const
wchar_t
*
GetVictoryString
(
int
code
);
const
wchar_t
*
GetCounterName
(
int
code
);
const
wchar_t
*
GetCounterName
(
int
code
);
const
wchar_t
*
GetSetName
(
int
code
);
const
wchar_t
*
GetSetName
(
int
code
);
unsigned
int
GetSetCode
(
const
wchar_t
*
setname
);
std
::
vector
<
unsigned
int
>
GetSetCodes
(
std
::
wstring
setname
);
const
wchar_t
*
GetNumString
(
int
num
,
bool
bracket
=
false
);
const
wchar_t
*
GetNumString
(
int
num
,
bool
bracket
=
false
);
const
wchar_t
*
FormatLocation
(
int
location
,
int
sequence
);
const
wchar_t
*
FormatLocation
(
int
location
,
int
sequence
);
const
wchar_t
*
FormatAttribute
(
int
attribute
);
const
wchar_t
*
FormatAttribute
(
int
attribute
);
...
...
Classes/gframe/deck_con.cpp
View file @
8ca8759a
...
@@ -1398,14 +1398,14 @@ void DeckBuilder::FilterCards() {
...
@@ -1398,14 +1398,14 @@ void DeckBuilder::FilterCards() {
results
.
clear
();
results
.
clear
();
struct
element_t
{
struct
element_t
{
std
::
wstring
keyword
;
std
::
wstring
keyword
;
unsigned
int
setcode
;
std
::
vector
<
unsigned
int
>
setcodes
;
enum
class
type_t
{
enum
class
type_t
{
all
,
all
,
name
,
name
,
setcode
setcode
}
type
;
}
type
;
bool
exclude
;
bool
exclude
;
element_t
()
:
setcode
(
0
),
type
(
type_t
::
all
),
exclude
(
false
)
{}
element_t
()
:
type
(
type_t
::
all
),
exclude
(
false
)
{}
};
};
const
wchar_t
*
pstr
=
mainGame
->
ebCardName
->
getText
();
const
wchar_t
*
pstr
=
mainGame
->
ebCardName
->
getText
();
std
::
wstring
str
=
std
::
wstring
(
pstr
);
std
::
wstring
str
=
std
::
wstring
(
pstr
);
...
@@ -1446,7 +1446,7 @@ void DeckBuilder::FilterCards() {
...
@@ -1446,7 +1446,7 @@ void DeckBuilder::FilterCards() {
element
.
keyword
=
str
.
substr
(
element_start
,
length
);
element
.
keyword
=
str
.
substr
(
element_start
,
length
);
}
else
}
else
element
.
keyword
=
str
.
substr
(
element_start
);
element
.
keyword
=
str
.
substr
(
element_start
);
element
.
setcode
=
dataManager
.
GetSetCode
(
element
.
keyword
.
c_str
()
);
element
.
setcode
s
=
dataManager
.
GetSetCodes
(
element
.
keyword
);
query_elements
.
push_back
(
element
);
query_elements
.
push_back
(
element
);
if
(
element_end
==
std
::
wstring
::
npos
)
if
(
element_end
==
std
::
wstring
::
npos
)
break
;
break
;
...
@@ -1464,7 +1464,7 @@ void DeckBuilder::FilterCards() {
...
@@ -1464,7 +1464,7 @@ void DeckBuilder::FilterCards() {
}
}
if
(
element_start
<
str
.
size
())
{
if
(
element_start
<
str
.
size
())
{
element
.
keyword
=
str
.
substr
(
element_start
);
element
.
keyword
=
str
.
substr
(
element_start
);
element
.
setcode
=
dataManager
.
GetSetCode
(
element
.
keyword
.
c_str
()
);
element
.
setcode
s
=
dataManager
.
GetSetCodes
(
element
.
keyword
);
query_elements
.
push_back
(
element
);
query_elements
.
push_back
(
element
);
}
}
}
}
...
@@ -1551,14 +1551,14 @@ void DeckBuilder::FilterCards() {
...
@@ -1551,14 +1551,14 @@ void DeckBuilder::FilterCards() {
if
(
elements_iterator
->
type
==
element_t
::
type_t
::
name
)
{
if
(
elements_iterator
->
type
==
element_t
::
type_t
::
name
)
{
match
=
CardNameContains
(
text
.
name
.
c_str
(),
elements_iterator
->
keyword
.
c_str
());
match
=
CardNameContains
(
text
.
name
.
c_str
(),
elements_iterator
->
keyword
.
c_str
());
}
else
if
(
elements_iterator
->
type
==
element_t
::
type_t
::
setcode
)
{
}
else
if
(
elements_iterator
->
type
==
element_t
::
type_t
::
setcode
)
{
match
=
elements_iterator
->
setcode
&&
data
.
is_setcode
(
elements_iterator
->
setcode
);
match
=
data
.
is_setcodes
(
elements_iterator
->
setcodes
);
}
else
{
}
else
{
int
trycode
=
BufferIO
::
GetVal
(
elements_iterator
->
keyword
.
c_str
());
int
trycode
=
BufferIO
::
GetVal
(
elements_iterator
->
keyword
.
c_str
());
bool
tryresult
=
dataManager
.
GetData
(
trycode
,
0
);
bool
tryresult
=
dataManager
.
GetData
(
trycode
,
0
);
if
(
!
tryresult
)
{
if
(
!
tryresult
)
{
match
=
CardNameContains
(
text
.
name
.
c_str
(),
elements_iterator
->
keyword
.
c_str
())
match
=
CardNameContains
(
text
.
name
.
c_str
(),
elements_iterator
->
keyword
.
c_str
())
||
text
.
text
.
find
(
elements_iterator
->
keyword
)
!=
std
::
wstring
::
npos
||
text
.
text
.
find
(
elements_iterator
->
keyword
)
!=
std
::
wstring
::
npos
||
(
elements_iterator
->
setcode
&&
data
.
is_setcode
(
elements_iterator
->
setcode
)
);
||
data
.
is_setcodes
(
elements_iterator
->
setcodes
);
}
else
{
}
else
{
match
=
data
.
code
==
trycode
||
data
.
alias
==
trycode
;
match
=
data
.
code
==
trycode
||
data
.
alias
==
trycode
;
}
}
...
...
Classes/gframe/deck_manager.cpp
View file @
8ca8759a
...
@@ -242,7 +242,7 @@ void DeckManager::GetCategoryPath(wchar_t* ret, int index, const wchar_t* text,
...
@@ -242,7 +242,7 @@ void DeckManager::GetCategoryPath(wchar_t* ret, int index, const wchar_t* text,
void
DeckManager
::
GetDeckFile
(
wchar_t
*
ret
,
irr
::
gui
::
IGUIComboBox
*
cbCategory
,
irr
::
gui
::
IGUIComboBox
*
cbDeck
)
{
void
DeckManager
::
GetDeckFile
(
wchar_t
*
ret
,
irr
::
gui
::
IGUIComboBox
*
cbCategory
,
irr
::
gui
::
IGUIComboBox
*
cbDeck
)
{
wchar_t
filepath
[
256
];
wchar_t
filepath
[
256
];
wchar_t
catepath
[
256
];
wchar_t
catepath
[
256
];
wchar_t
*
deckname
=
(
wchar_t
*
)
cbDeck
->
getItem
(
cbDeck
->
getSelected
());
const
wchar_t
*
deckname
=
cbDeck
->
getItem
(
cbDeck
->
getSelected
());
if
(
deckname
!=
NULL
)
{
if
(
deckname
!=
NULL
)
{
GetCategoryPath
(
catepath
,
cbCategory
->
getSelected
(),
cbCategory
->
getText
(),
cbCategory
==
mainGame
->
cbDBCategory
);
GetCategoryPath
(
catepath
,
cbCategory
->
getSelected
(),
cbCategory
->
getText
(),
cbCategory
==
mainGame
->
cbDBCategory
);
myswprintf
(
filepath
,
L"%ls/%ls.ydk"
,
catepath
,
deckname
);
myswprintf
(
filepath
,
L"%ls/%ls.ydk"
,
catepath
,
deckname
);
...
...
Classes/gframe/game.cpp
View file @
8ca8759a
...
@@ -2038,7 +2038,7 @@ void Game::AddDebugMsg(const char* msg) {
...
@@ -2038,7 +2038,7 @@ void Game::AddDebugMsg(const char* msg) {
}
}
if
(
enable_log
&
0x2
)
{
if
(
enable_log
&
0x2
)
{
char
msgbuf
[
1040
];
char
msgbuf
[
1040
];
s
printf
(
msgbuf
,
"[Script Error]: %s"
,
msg
);
s
nprintf
(
msgbuf
,
sizeof
msgbuf
,
"[Script Error]: %s"
,
msg
);
ErrorLog
(
msgbuf
);
ErrorLog
(
msgbuf
);
}
}
}
}
...
...
Classes/gframe/image_manager.cpp
View file @
8ca8759a
...
@@ -133,11 +133,11 @@ irr::video::ITexture* ImageManager::GetTexture(int code) {
...
@@ -133,11 +133,11 @@ irr::video::ITexture* ImageManager::GetTexture(int code) {
if
(
tit
==
tMap
.
end
())
{
if
(
tit
==
tMap
.
end
())
{
char
file
[
256
];
char
file
[
256
];
// char file_img[256];
// char file_img[256];
s
printf
(
file
,
"expansions/pics/%d.jpg"
,
code
);
s
nprintf
(
file
,
sizeof
file
,
"expansions/pics/%d.jpg"
,
code
);
irr
::
video
::
ITexture
*
img
=
NULL
;
irr
::
video
::
ITexture
*
img
=
NULL
;
std
::
list
<
std
::
string
>::
iterator
iter
;
std
::
list
<
std
::
string
>::
iterator
iter
;
for
(
iter
=
support_types
.
begin
();
iter
!=
support_types
.
end
();
++
iter
)
{
for
(
iter
=
support_types
.
begin
();
iter
!=
support_types
.
end
();
++
iter
)
{
s
printf
(
file
,
"/expansions/pics/%d.%s"
,
code
,
iter
->
c_str
());
s
nprintf
(
file
,
sizeof
file
,
"/expansions/pics/%d.%s"
,
code
,
iter
->
c_str
());
img
=
driver
->
getTexture
(
image_work_path
+
path
(
file
));
img
=
driver
->
getTexture
(
image_work_path
+
path
(
file
));
// sprintf(file_img, "%s", (image_work_path + path(file)).c_str());
// sprintf(file_img, "%s", (image_work_path + path(file)).c_str());
// img = GetTextureFromFile(file_img, width, height);
// img = GetTextureFromFile(file_img, width, height);
...
@@ -147,7 +147,7 @@ irr::video::ITexture* ImageManager::GetTexture(int code) {
...
@@ -147,7 +147,7 @@ irr::video::ITexture* ImageManager::GetTexture(int code) {
}
}
if
(
img
==
NULL
)
{
if
(
img
==
NULL
)
{
for
(
iter
=
support_types
.
begin
();
iter
!=
support_types
.
end
();
++
iter
)
{
for
(
iter
=
support_types
.
begin
();
iter
!=
support_types
.
end
();
++
iter
)
{
s
printf
(
file
,
"%s/%d.%s"
,
irr
::
android
::
getCardImagePath
(
mainGame
->
appMain
).
c_str
(),
code
,
iter
->
c_str
());
s
nprintf
(
file
,
sizeof
file
,
"%s/%d.%s"
,
irr
::
android
::
getCardImagePath
(
mainGame
->
appMain
).
c_str
(),
code
,
iter
->
c_str
());
img
=
driver
->
getTexture
(
file
);
img
=
driver
->
getTexture
(
file
);
// img = GetTextureFromFile(file, width, height);
// img = GetTextureFromFile(file, width, height);
if
(
img
!=
NULL
)
{
if
(
img
!=
NULL
)
{
...
@@ -157,7 +157,7 @@ irr::video::ITexture* ImageManager::GetTexture(int code) {
...
@@ -157,7 +157,7 @@ irr::video::ITexture* ImageManager::GetTexture(int code) {
}
}
if
(
img
==
NULL
){
//sdcard first, then zip
if
(
img
==
NULL
){
//sdcard first, then zip
for
(
iter
=
support_types
.
begin
();
iter
!=
support_types
.
end
();
++
iter
)
{
for
(
iter
=
support_types
.
begin
();
iter
!=
support_types
.
end
();
++
iter
)
{
s
printf
(
file
,
"pics/%d.%s"
,
code
,
iter
->
c_str
());
s
nprintf
(
file
,
sizeof
file
,
"pics/%d.%s"
,
code
,
iter
->
c_str
());
//load image in zip
//load image in zip
irr
::
io
::
IReadFile
*
in_zip_file
=
device
->
getFileSystem
()
->
createAndOpenFile
(
file
);
irr
::
io
::
IReadFile
*
in_zip_file
=
device
->
getFileSystem
()
->
createAndOpenFile
(
file
);
if
(
in_zip_file
&&
in_zip_file
->
getSize
()
>
0
)
{
if
(
in_zip_file
&&
in_zip_file
->
getSize
()
>
0
)
{
...
@@ -190,10 +190,10 @@ irr::video::ITexture* ImageManager::GetBigPicture(int code, float zoom) {
...
@@ -190,10 +190,10 @@ irr::video::ITexture* ImageManager::GetBigPicture(int code, float zoom) {
}
}
irr
::
video
::
ITexture
*
texture
;
irr
::
video
::
ITexture
*
texture
;
char
file
[
256
];
char
file
[
256
];
s
printf
(
file
,
"expansions/pics/%d.jpg"
,
code
);
s
nprintf
(
file
,
sizeof
file
,
"expansions/pics/%d.jpg"
,
code
);
irr
::
video
::
IImage
*
srcimg
=
driver
->
createImageFromFile
(
file
);
irr
::
video
::
IImage
*
srcimg
=
driver
->
createImageFromFile
(
file
);
if
(
srcimg
==
NULL
)
{
if
(
srcimg
==
NULL
)
{
s
printf
(
file
,
"pics/%d.jpg"
,
code
);
s
nprintf
(
file
,
sizeof
file
,
"pics/%d.jpg"
,
code
);
srcimg
=
driver
->
createImageFromFile
(
file
);
srcimg
=
driver
->
createImageFromFile
(
file
);
}
}
if
(
srcimg
==
NULL
)
{
if
(
srcimg
==
NULL
)
{
...
@@ -221,18 +221,18 @@ irr::video::ITexture* ImageManager::GetTextureField(int code) {
...
@@ -221,18 +221,18 @@ irr::video::ITexture* ImageManager::GetTextureField(int code) {
auto
tit
=
tFields
.
find
(
code
);
auto
tit
=
tFields
.
find
(
code
);
if
(
tit
==
tFields
.
end
())
{
if
(
tit
==
tFields
.
end
())
{
char
file
[
256
];
char
file
[
256
];
s
printf
(
file
,
"field/%s/%d.jpg"
,
irr
::
android
::
getCardImagePath
(
mainGame
->
appMain
).
c_str
(),
code
);
s
nprintf
(
file
,
sizeof
file
,
"field/%s/%d.jpg"
,
irr
::
android
::
getCardImagePath
(
mainGame
->
appMain
).
c_str
(),
code
);
irr
::
video
::
ITexture
*
img
=
driver
->
getTexture
(
file
);
irr
::
video
::
ITexture
*
img
=
driver
->
getTexture
(
file
);
if
(
img
==
NULL
)
{
if
(
img
==
NULL
)
{
s
printf
(
file
,
"field/%s/%d.jpg"
,
irr
::
android
::
getCardImagePath
(
mainGame
->
appMain
).
c_str
(),
code
);
s
nprintf
(
file
,
sizeof
file
,
"field/%s/%d.jpg"
,
irr
::
android
::
getCardImagePath
(
mainGame
->
appMain
).
c_str
(),
code
);
img
=
driver
->
getTexture
(
file
);
img
=
driver
->
getTexture
(
file
);
}
}
if
(
img
==
NULL
)
{
if
(
img
==
NULL
)
{
s
printf
(
file
,
"field/%s/%d.png"
,
irr
::
android
::
getCardImagePath
(
mainGame
->
appMain
).
c_str
(),
code
);
s
nprintf
(
file
,
sizeof
file
,
"field/%s/%d.png"
,
irr
::
android
::
getCardImagePath
(
mainGame
->
appMain
).
c_str
(),
code
);
img
=
driver
->
getTexture
(
file
);
img
=
driver
->
getTexture
(
file
);
}
}
if
(
img
==
NULL
)
{
if
(
img
==
NULL
)
{
s
printf
(
file
,
"pics/field/%d.jpg"
,
code
);
s
nprintf
(
file
,
sizeof
file
,
"pics/field/%d.jpg"
,
code
);
img
=
driver
->
getTexture
(
file
);
img
=
driver
->
getTexture
(
file
);
if
(
img
==
NULL
)
{
if
(
img
==
NULL
)
{
tFields
[
code
]
=
NULL
;
tFields
[
code
]
=
NULL
;
...
...
Classes/gframe/irrUString.h
View file @
8ca8759a
...
@@ -31,12 +31,8 @@
...
@@ -31,12 +31,8 @@
#ifndef __IRR_USTRING_H_INCLUDED__
#ifndef __IRR_USTRING_H_INCLUDED__
#define __IRR_USTRING_H_INCLUDED__
#define __IRR_USTRING_H_INCLUDED__
#if (__cplusplus > 199711L) || (_MSC_VER >= 1600) || defined(__GXX_EXPERIMENTAL_CXX0X__)
#define USTRING_CPP0X
# define USTRING_CPP0X
#define USTRING_CPP0X_NEWLITERALS
# if defined(__GXX_EXPERIMENTAL_CXX0X__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)))
# define USTRING_CPP0X_NEWLITERALS
# endif
#endif
#include <stdio.h>
#include <stdio.h>
#include <string.h>
#include <string.h>
...
...
Classes/gframe/menu_handler.cpp
View file @
8ca8759a
...
@@ -464,10 +464,10 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
...
@@ -464,10 +464,10 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
char
arg2
[
32
];
char
arg2
[
32
];
arg2
[
0
]
=
0
;
arg2
[
0
]
=
0
;
if
(
mainGame
->
chkBotHand
->
isChecked
())
if
(
mainGame
->
chkBotHand
->
isChecked
())
s
printf
(
arg2
,
" Hand=1"
);
s
nprintf
(
arg2
,
sizeof
arg2
,
" Hand=1"
);
char
arg3
[
32
];
char
arg3
[
32
];
s
printf
(
arg3
,
" Port=%d"
,
mainGame
->
gameConf
.
serverport
);
s
nprintf
(
arg3
,
sizeof
arg3
,
" Port=%d"
,
mainGame
->
gameConf
.
serverport
);
s
printf
(
args
,
"%s%s%s"
,
arg1
,
arg2
,
arg3
);
s
nprintf
(
args
,
sizeof
args
,
"%s%s%s"
,
arg1
,
arg2
,
arg3
);
android
::
runWindbot
(
mainGame
->
appMain
,
args
);
android
::
runWindbot
(
mainGame
->
appMain
,
args
);
if
(
!
NetServer
::
StartServer
(
mainGame
->
gameConf
.
serverport
))
{
if
(
!
NetServer
::
StartServer
(
mainGame
->
gameConf
.
serverport
))
{
mainGame
->
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
INFO
);
mainGame
->
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
INFO
);
...
...
Classes/gframe/myfilesystem.h
View file @
8ca8759a
...
@@ -176,7 +176,7 @@ public:
...
@@ -176,7 +176,7 @@ public:
bool
success
=
true
;
bool
success
=
true
;
TraversalDir
(
dir
,
[
dir
,
&
success
](
const
char
*
name
,
bool
isdir
)
{
TraversalDir
(
dir
,
[
dir
,
&
success
](
const
char
*
name
,
bool
isdir
)
{
char
full_path
[
256
];
char
full_path
[
256
];
s
printf
(
full_path
,
"%s/%s"
,
dir
,
name
);
s
nprintf
(
full_path
,
sizeof
full_path
,
"%s/%s"
,
dir
,
name
);
if
(
isdir
)
if
(
isdir
)
{
{
if
(
!
DeleteDir
(
full_path
))
if
(
!
DeleteDir
(
full_path
))
...
...
Classes/gframe/replay.cpp
View file @
8ca8759a
...
@@ -3,11 +3,7 @@
...
@@ -3,11 +3,7 @@
namespace
ygo
{
namespace
ygo
{
Replay
::
Replay
()
Replay
::
Replay
()
{
:
fp
(
nullptr
),
pheader
(),
pdata
(
nullptr
),
replay_size
(
0
),
comp_size
(
0
),
is_recording
(
false
),
is_replaying
(
false
)
{
#ifdef _WIN32
recording_fp
=
nullptr
;
#endif
replay_data
=
new
unsigned
char
[
MAX_REPLAY_SIZE
];
replay_data
=
new
unsigned
char
[
MAX_REPLAY_SIZE
];
comp_data
=
new
unsigned
char
[
MAX_COMP_SIZE
];
comp_data
=
new
unsigned
char
[
MAX_COMP_SIZE
];
}
}
...
@@ -134,8 +130,8 @@ void Replay::EndRecord() {
...
@@ -134,8 +130,8 @@ void Replay::EndRecord() {
comp_size
=
MAX_COMP_SIZE
;
comp_size
=
MAX_COMP_SIZE
;
int
ret
=
LzmaCompress
(
comp_data
,
&
comp_size
,
replay_data
,
replay_size
,
pheader
.
props
,
&
propsize
,
5
,
1
<<
24
,
3
,
0
,
2
,
32
,
1
);
int
ret
=
LzmaCompress
(
comp_data
,
&
comp_size
,
replay_data
,
replay_size
,
pheader
.
props
,
&
propsize
,
5
,
1
<<
24
,
3
,
0
,
2
,
32
,
1
);
if
(
ret
!=
SZ_OK
)
{
if
(
ret
!=
SZ_OK
)
{
*
((
int
*
)(
comp_data
))
=
ret
;
std
::
memcpy
(
comp_data
,
&
ret
,
sizeof
ret
)
;
comp_size
=
sizeof
(
ret
)
;
comp_size
=
sizeof
ret
;
}
}
is_recording
=
false
;
is_recording
=
false
;
}
}
...
...
Classes/gframe/replay.h
View file @
8ca8759a
...
@@ -17,16 +17,13 @@ namespace ygo {
...
@@ -17,16 +17,13 @@ namespace ygo {
#define MAX_COMP_SIZE 0x2000
#define MAX_COMP_SIZE 0x2000
struct
ReplayHeader
{
struct
ReplayHeader
{
unsigned
int
id
;
unsigned
int
id
{};
unsigned
int
version
;
unsigned
int
version
{};
unsigned
int
flag
;
unsigned
int
flag
{};
unsigned
int
seed
;
unsigned
int
seed
{};
unsigned
int
datasize
;
unsigned
int
datasize
{};
unsigned
int
start_time
;
unsigned
int
start_time
{};
unsigned
char
props
[
8
];
unsigned
char
props
[
8
]{};
ReplayHeader
()
:
id
(
0
),
version
(
0
),
flag
(
0
),
seed
(
0
),
datasize
(
0
),
start_time
(
0
),
props
{
0
}
{}
};
};
class
Replay
{
class
Replay
{
...
@@ -59,21 +56,21 @@ public:
...
@@ -59,21 +56,21 @@ public:
char
ReadInt8
();
char
ReadInt8
();
void
Rewind
();
void
Rewind
();
FILE
*
fp
;
FILE
*
fp
{
nullptr
}
;
#ifdef _WIN32
#ifdef _WIN32
HANDLE
recording_fp
;
HANDLE
recording_fp
{
nullptr
}
;
#endif
#endif
ReplayHeader
pheader
;
ReplayHeader
pheader
;
unsigned
char
*
replay_data
;
unsigned
char
*
replay_data
;
unsigned
char
*
comp_data
;
unsigned
char
*
comp_data
;
size_t
replay_size
;
size_t
replay_size
{}
;
size_t
comp_size
;
size_t
comp_size
{}
;
private:
private:
unsigned
char
*
pdata
;
unsigned
char
*
pdata
{
nullptr
}
;
bool
is_recording
;
bool
is_recording
{}
;
bool
is_replaying
;
bool
is_replaying
{}
;
};
};
}
}
...
...
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