Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
YGOMobile-Cn-Ko-En
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-Cn-Ko-En
Commits
80f742f1
Commit
80f742f1
authored
Dec 02, 2024
by
fallenstardust
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update gframe
parent
de23152b
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
69 additions
and
62 deletions
+69
-62
Classes/gframe/bufferio.h
Classes/gframe/bufferio.h
+11
-7
Classes/gframe/config.h
Classes/gframe/config.h
+5
-2
Classes/gframe/data_manager.cpp
Classes/gframe/data_manager.cpp
+4
-4
Classes/gframe/data_manager.h
Classes/gframe/data_manager.h
+4
-4
Classes/gframe/deck_manager.cpp
Classes/gframe/deck_manager.cpp
+2
-4
Classes/gframe/menu_handler.cpp
Classes/gframe/menu_handler.cpp
+21
-13
Classes/gframe/replay.cpp
Classes/gframe/replay.cpp
+9
-16
Classes/gframe/replay.h
Classes/gframe/replay.h
+1
-1
Classes/gframe/replay_mode.cpp
Classes/gframe/replay_mode.cpp
+1
-1
Classes/gframe/single_duel.cpp
Classes/gframe/single_duel.cpp
+1
-1
Classes/gframe/single_mode.cpp
Classes/gframe/single_mode.cpp
+9
-8
Classes/gframe/tag_duel.cpp
Classes/gframe/tag_duel.cpp
+1
-1
No files found.
Classes/gframe/bufferio.h
View file @
80f742f1
...
@@ -256,14 +256,18 @@ public:
...
@@ -256,14 +256,18 @@ public:
str
[
N
-
1
]
=
0
;
str
[
N
-
1
]
=
0
;
}
}
static
int
GetVal
(
const
wchar_t
*
pstr
)
{
static
int
GetVal
(
const
wchar_t
*
pstr
)
{
unsigned
int
ret
=
0
;
if
(
*
pstr
>=
L'0'
&&
*
pstr
<=
L'9'
)
{
while
(
*
pstr
>=
L'0'
&&
*
pstr
<=
L'9'
)
{
int
ret
{};
ret
=
ret
*
10
+
(
*
pstr
-
L'0'
);
wchar_t
*
str_end
{};
pstr
++
;
ret
=
std
::
wcstol
(
pstr
,
&
str_end
,
10
);
if
(
*
str_end
==
0
)
return
ret
;
else
return
0
;
}
}
if
(
*
pstr
==
0
)
else
return
(
int
)
ret
;
return
0
;
return
0
;
}
}
};
};
...
...
Classes/gframe/config.h
View file @
80f742f1
...
@@ -87,12 +87,15 @@ inline int swprintf(wchar_t(&buf)[N], const wchar_t* fmt, TR... args) {
...
@@ -87,12 +87,15 @@ inline int swprintf(wchar_t(&buf)[N], const wchar_t* fmt, TR... args) {
#endif // UNICODE
#endif // UNICODE
#endif
#endif
inline
FILE
*
myfopen
(
const
char
*
filename
,
const
char
*
mode
)
{
inline
FILE
*
myfopen
(
const
wchar_t
*
filename
,
const
char
*
mode
)
{
FILE
*
fp
{};
FILE
*
fp
{};
fp
=
fopen
(
filename
,
mode
);
char
fname
[
1024
]{};
BufferIO
::
EncodeUTF8
(
filename
,
fname
);
fp
=
fopen
(
fname
,
mode
);
return
fp
;
return
fp
;
}
}
#include <irrlicht.h>
#include <irrlicht.h>
using
namespace
irr
;
using
namespace
irr
;
using
namespace
core
;
using
namespace
core
;
...
...
Classes/gframe/data_manager.cpp
View file @
80f742f1
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
namespace
ygo
{
namespace
ygo
{
const
wchar_t
*
DataManager
::
unknown_string
=
L"???"
;
const
wchar_t
*
DataManager
::
unknown_string
=
L"???"
;
byte
DataManager
::
scriptBuffer
[
0x20000
];
unsigned
char
DataManager
::
scriptBuffer
[
0x20000
];
IFileSystem
*
DataManager
::
FileSystem
;
IFileSystem
*
DataManager
::
FileSystem
;
DataManager
dataManager
;
DataManager
dataManager
;
...
@@ -387,7 +387,7 @@ uint32 DataManager::CardReader(uint32 code, card_data* pData) {
...
@@ -387,7 +387,7 @@ uint32 DataManager::CardReader(uint32 code, card_data* pData) {
pData
->
clear
();
pData
->
clear
();
return
0
;
return
0
;
}
}
byte
*
DataManager
::
ScriptReaderEx
(
const
char
*
script_name
,
int
*
slen
)
{
unsigned
char
*
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
]{};
...
@@ -409,7 +409,7 @@ byte* DataManager::ScriptReaderEx(const char* script_name, int* slen) {
...
@@ -409,7 +409,7 @@ byte* DataManager::ScriptReaderEx(const char* script_name, int* slen) {
else
else
return
ScriptReaderZip
(
second
,
slen
);
return
ScriptReaderZip
(
second
,
slen
);
}
}
byte
*
DataManager
::
ScriptReader
(
const
char
*
script_name
,
int
*
slen
)
{
unsigned
char
*
DataManager
::
ScriptReader
(
const
char
*
script_name
,
int
*
slen
)
{
FILE
*
fp
=
fopen
(
script_name
,
"rb"
);
FILE
*
fp
=
fopen
(
script_name
,
"rb"
);
if
(
!
fp
)
if
(
!
fp
)
return
0
;
return
0
;
...
@@ -420,7 +420,7 @@ byte* DataManager::ScriptReader(const char* script_name, int* slen) {
...
@@ -420,7 +420,7 @@ byte* DataManager::ScriptReader(const char* script_name, int* slen) {
*
slen
=
len
;
*
slen
=
len
;
return
scriptBuffer
;
return
scriptBuffer
;
}
}
byte
*
DataManager
::
ScriptReaderZip
(
const
char
*
script_name
,
int
*
slen
)
{
unsigned
char
*
DataManager
::
ScriptReaderZip
(
const
char
*
script_name
,
int
*
slen
)
{
IReadFile
*
reader
=
FileSystem
->
createAndOpenFile
(
script_name
);
IReadFile
*
reader
=
FileSystem
->
createAndOpenFile
(
script_name
);
if
(
!
reader
)
if
(
!
reader
)
return
nullptr
;
return
nullptr
;
...
...
Classes/gframe/data_manager.h
View file @
80f742f1
...
@@ -50,12 +50,12 @@ public:
...
@@ -50,12 +50,12 @@ public:
std
::
unordered_map
<
unsigned
int
,
std
::
wstring
>
_sysStrings
;
std
::
unordered_map
<
unsigned
int
,
std
::
wstring
>
_sysStrings
;
char
errmsg
[
512
]{};
char
errmsg
[
512
]{};
static
byte
scriptBuffer
[
0x20000
];
static
unsigned
char
scriptBuffer
[
0x20000
];
static
const
wchar_t
*
unknown_string
;
static
const
wchar_t
*
unknown_string
;
static
uint32
CardReader
(
uint32
,
card_data
*
);
static
uint32
CardReader
(
uint32
,
card_data
*
);
static
byte
*
ScriptReaderEx
(
const
char
*
script_name
,
int
*
slen
);
static
unsigned
char
*
ScriptReaderEx
(
const
char
*
script_name
,
int
*
slen
);
static
byte
*
ScriptReader
(
const
char
*
script_name
,
int
*
slen
);
static
unsigned
char
*
ScriptReader
(
const
char
*
script_name
,
int
*
slen
);
static
byte
*
ScriptReaderZip
(
const
char
*
script_name
,
int
*
slen
);
static
unsigned
char
*
ScriptReaderZip
(
const
char
*
script_name
,
int
*
slen
);
static
IFileSystem
*
FileSystem
;
static
IFileSystem
*
FileSystem
;
private:
private:
...
...
Classes/gframe/deck_manager.cpp
View file @
80f742f1
...
@@ -276,9 +276,7 @@ void DeckManager::GetDeckFile(wchar_t* ret, irr::gui::IGUIComboBox* cbCategory,
...
@@ -276,9 +276,7 @@ void DeckManager::GetDeckFile(wchar_t* ret, irr::gui::IGUIComboBox* cbCategory,
}
}
}
}
FILE
*
DeckManager
::
OpenDeckFile
(
const
wchar_t
*
file
,
const
char
*
mode
)
{
FILE
*
DeckManager
::
OpenDeckFile
(
const
wchar_t
*
file
,
const
char
*
mode
)
{
char
fullname
[
256
]{};
FILE
*
fp
=
myfopen
(
file
,
mode
);
BufferIO
::
EncodeUTF8
(
file
,
fullname
);
FILE
*
fp
=
myfopen
(
fullname
,
mode
);
return
fp
;
return
fp
;
}
}
IReadFile
*
DeckManager
::
OpenDeckReader
(
const
wchar_t
*
file
)
{
IReadFile
*
DeckManager
::
OpenDeckReader
(
const
wchar_t
*
file
)
{
...
@@ -342,7 +340,7 @@ bool DeckManager::SaveDeck(Deck& deck, const wchar_t* file) {
...
@@ -342,7 +340,7 @@ bool DeckManager::SaveDeck(Deck& deck, const wchar_t* file) {
return
true
;
return
true
;
}
}
bool
DeckManager
::
DeleteDeck
(
const
wchar_t
*
file
)
{
bool
DeckManager
::
DeleteDeck
(
const
wchar_t
*
file
)
{
#ifdef WIN32
#ifdef
_
WIN32
BOOL
result
=
DeleteFileW
(
file
);
BOOL
result
=
DeleteFileW
(
file
);
return
!!
result
;
return
!!
result
;
#else
#else
...
...
Classes/gframe/menu_handler.cpp
View file @
80f742f1
...
@@ -22,7 +22,7 @@ void UpdateDeck() {
...
@@ -22,7 +22,7 @@ void UpdateDeck() {
BufferIO
::
EncodeUTF8
(
mainGame
->
gameConf
.
lastdeck
,
linebuf
);
BufferIO
::
EncodeUTF8
(
mainGame
->
gameConf
.
lastdeck
,
linebuf
);
android
::
setLastDeck
(
mainGame
->
appMain
,
linebuf
);
android
::
setLastDeck
(
mainGame
->
appMain
,
linebuf
);
unsigned
char
deckbuf
[
1024
];
unsigned
char
deckbuf
[
1024
]
{}
;
auto
pdeck
=
deckbuf
;
auto
pdeck
=
deckbuf
;
BufferIO
::
WriteInt32
(
pdeck
,
deckManager
.
current_deck
.
main
.
size
()
+
deckManager
.
current_deck
.
extra
.
size
());
BufferIO
::
WriteInt32
(
pdeck
,
deckManager
.
current_deck
.
main
.
size
()
+
deckManager
.
current_deck
.
extra
.
size
());
BufferIO
::
WriteInt32
(
pdeck
,
deckManager
.
current_deck
.
side
.
size
());
BufferIO
::
WriteInt32
(
pdeck
,
deckManager
.
current_deck
.
side
.
size
());
...
@@ -323,10 +323,13 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
...
@@ -323,10 +323,13 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
break
;
break
;
}
}
case
BUTTON_LOAD_REPLAY
:
{
case
BUTTON_LOAD_REPLAY
:
{
if
(
mainGame
->
lstReplayList
->
getSelected
()
==
-
1
)
auto
selected
=
mainGame
->
lstReplayList
->
getSelected
();
break
;
if
(
selected
==
-
1
)
if
(
!
ReplayMode
::
cur_replay
.
OpenReplay
(
mainGame
->
lstReplayList
->
getListItem
(
mainGame
->
lstReplayList
->
getSelected
())))
break
;
break
;
wchar_t
replay_path
[
256
]{};
myswprintf
(
replay_path
,
L"./replay/%ls"
,
mainGame
->
lstReplayList
->
getListItem
(
selected
));
if
(
!
ReplayMode
::
cur_replay
.
OpenReplay
(
replay_path
))
break
;
mainGame
->
ClearCardInfo
();
mainGame
->
ClearCardInfo
();
mainGame
->
imgCard
->
setScaleImage
(
true
);
mainGame
->
imgCard
->
setScaleImage
(
true
);
mainGame
->
wCardImg
->
setVisible
(
true
);
mainGame
->
wCardImg
->
setVisible
(
true
);
...
@@ -399,14 +402,17 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
...
@@ -399,14 +402,17 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
break
;
break
;
}
}
case
BUTTON_EXPORT_DECK
:
{
case
BUTTON_EXPORT_DECK
:
{
if
(
mainGame
->
lstReplayList
->
getSelected
()
==
-
1
)
auto
selected
=
mainGame
->
lstReplayList
->
getSelected
();
if
(
selected
==
-
1
)
break
;
break
;
Replay
replay
;
Replay
replay
;
wchar_t
ex_filename
[
256
]{};
wchar_t
ex_filename
[
256
]{};
wchar_t
namebuf
[
4
][
20
]{};
wchar_t
namebuf
[
4
][
20
]{};
wchar_t
filename
[
256
]{};
wchar_t
filename
[
256
]{};
myswprintf
(
ex_filename
,
L"%ls"
,
mainGame
->
lstReplayList
->
getListItem
(
mainGame
->
lstReplayList
->
getSelected
()));
wchar_t
replay_path
[
256
]{};
if
(
!
replay
.
OpenReplay
(
ex_filename
))
BufferIO
::
CopyWideString
(
mainGame
->
lstReplayList
->
getListItem
(
selected
),
ex_filename
);
myswprintf
(
replay_path
,
L"./replay/%ls"
,
ex_filename
);
if
(
!
replay
.
OpenReplay
(
replay_path
))
break
;
break
;
const
ReplayHeader
&
rh
=
replay
.
pheader
;
const
ReplayHeader
&
rh
=
replay
.
pheader
;
if
(
rh
.
flag
&
REPLAY_SINGLE_MODE
)
if
(
rh
.
flag
&
REPLAY_SINGLE_MODE
)
...
@@ -629,9 +635,13 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
...
@@ -629,9 +635,13 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
int
sel
=
mainGame
->
lstReplayList
->
getSelected
();
int
sel
=
mainGame
->
lstReplayList
->
getSelected
();
if
(
sel
==
-
1
)
if
(
sel
==
-
1
)
break
;
break
;
if
(
!
ReplayMode
::
cur_replay
.
OpenReplay
(
mainGame
->
lstReplayList
->
getListItem
(
sel
)))
wchar_t
replay_path
[
256
]{};
myswprintf
(
replay_path
,
L"./replay/%ls"
,
mainGame
->
lstReplayList
->
getListItem
(
sel
));
if
(
!
ReplayMode
::
cur_replay
.
OpenReplay
(
replay_path
))
{
mainGame
->
stReplayInfo
->
setText
(
L""
);
break
;
break
;
wchar_t
infobuf
[
256
];
}
wchar_t
infobuf
[
256
]{};
std
::
wstring
repinfo
;
std
::
wstring
repinfo
;
time_t
curtime
;
time_t
curtime
;
if
(
ReplayMode
::
cur_replay
.
pheader
.
flag
&
REPLAY_UNIFORM
)
if
(
ReplayMode
::
cur_replay
.
pheader
.
flag
&
REPLAY_UNIFORM
)
...
@@ -664,9 +674,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
...
@@ -664,9 +674,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
const
wchar_t
*
name
=
mainGame
->
lstSinglePlayList
->
getListItem
(
sel
);
const
wchar_t
*
name
=
mainGame
->
lstSinglePlayList
->
getListItem
(
sel
);
wchar_t
fname
[
256
];
wchar_t
fname
[
256
];
myswprintf
(
fname
,
L"./single/%ls"
,
name
);
myswprintf
(
fname
,
L"./single/%ls"
,
name
);
char
fullname
[
256
]{};
FILE
*
fp
=
myfopen
(
fname
,
"rb"
);
BufferIO
::
EncodeUTF8
(
fname
,
fullname
);
FILE
*
fp
=
myfopen
(
fullname
,
"rb"
);
if
(
!
fp
)
{
if
(
!
fp
)
{
mainGame
->
stSinglePlayInfo
->
setText
(
L""
);
mainGame
->
stSinglePlayInfo
->
setText
(
L""
);
break
;
break
;
...
...
Classes/gframe/replay.cpp
View file @
80f742f1
...
@@ -102,9 +102,7 @@ void Replay::SaveReplay(const wchar_t* name) {
...
@@ -102,9 +102,7 @@ void Replay::SaveReplay(const wchar_t* name) {
return
;
return
;
wchar_t
fname
[
256
];
wchar_t
fname
[
256
];
myswprintf
(
fname
,
L"./replay/%ls.yrp"
,
name
);
myswprintf
(
fname
,
L"./replay/%ls.yrp"
,
name
);
char
fullname
[
256
]{};
FILE
*
rfp
=
myfopen
(
fname
,
"wb"
);
BufferIO
::
EncodeUTF8
(
fname
,
fullname
);
FILE
*
rfp
=
myfopen
(
fullname
,
"wb"
);
if
(
!
rfp
)
if
(
!
rfp
)
return
;
return
;
fwrite
(
&
pheader
,
sizeof
pheader
,
1
,
rfp
);
fwrite
(
&
pheader
,
sizeof
pheader
,
1
,
rfp
);
...
@@ -112,14 +110,11 @@ void Replay::SaveReplay(const wchar_t* name) {
...
@@ -112,14 +110,11 @@ void Replay::SaveReplay(const wchar_t* name) {
fclose
(
rfp
);
fclose
(
rfp
);
}
}
bool
Replay
::
OpenReplay
(
const
wchar_t
*
name
)
{
bool
Replay
::
OpenReplay
(
const
wchar_t
*
name
)
{
char
fullname
[
256
]{};
FILE
*
rfp
=
myfopen
(
name
,
"rb"
);
BufferIO
::
EncodeUTF8
(
name
,
fullname
);
FILE
*
rfp
=
myfopen
(
fullname
,
"rb"
);
if
(
!
rfp
)
{
if
(
!
rfp
)
{
wchar_t
fname
[
256
];
wchar_t
fname
[
256
];
myswprintf
(
fname
,
L"./replay/%ls"
,
name
);
myswprintf
(
fname
,
L"./replay/%ls"
,
name
);
BufferIO
::
EncodeUTF8
(
fname
,
fullname
);
rfp
=
myfopen
(
fname
,
"rb"
);
rfp
=
myfopen
(
fullname
,
"rb"
);
}
}
if
(
!
rfp
)
if
(
!
rfp
)
return
false
;
return
false
;
...
@@ -136,7 +131,7 @@ bool Replay::OpenReplay(const wchar_t* name) {
...
@@ -136,7 +131,7 @@ bool Replay::OpenReplay(const wchar_t* name) {
if
(
pheader
.
flag
&
REPLAY_COMPRESSED
)
{
if
(
pheader
.
flag
&
REPLAY_COMPRESSED
)
{
comp_size
=
fread
(
comp_data
,
1
,
MAX_COMP_SIZE
,
rfp
);
comp_size
=
fread
(
comp_data
,
1
,
MAX_COMP_SIZE
,
rfp
);
fclose
(
rfp
);
fclose
(
rfp
);
if
(
(
int
)
pheader
.
datasize
<
0
&&
(
int
)
pheader
.
datasize
>
MAX_REPLAY_SIZE
)
if
(
pheader
.
datasize
>
MAX_REPLAY_SIZE
)
return
false
;
return
false
;
replay_size
=
pheader
.
datasize
;
replay_size
=
pheader
.
datasize
;
if
(
LzmaUncompress
(
replay_data
,
&
replay_size
,
comp_data
,
&
comp_size
,
pheader
.
props
,
5
)
!=
SZ_OK
)
if
(
LzmaUncompress
(
replay_data
,
&
replay_size
,
comp_data
,
&
comp_size
,
pheader
.
props
,
5
)
!=
SZ_OK
)
...
@@ -156,9 +151,7 @@ bool Replay::OpenReplay(const wchar_t* name) {
...
@@ -156,9 +151,7 @@ bool Replay::OpenReplay(const wchar_t* name) {
bool
Replay
::
CheckReplay
(
const
wchar_t
*
name
)
{
bool
Replay
::
CheckReplay
(
const
wchar_t
*
name
)
{
wchar_t
fname
[
256
];
wchar_t
fname
[
256
];
myswprintf
(
fname
,
L"./replay/%ls"
,
name
);
myswprintf
(
fname
,
L"./replay/%ls"
,
name
);
char
fullname
[
256
]{};
FILE
*
rfp
=
myfopen
(
fname
,
"rb"
);
BufferIO
::
EncodeUTF8
(
fname
,
fullname
);
FILE
*
rfp
=
myfopen
(
fullname
,
"rb"
);
if
(
!
rfp
)
if
(
!
rfp
)
return
false
;
return
false
;
ReplayHeader
rheader
;
ReplayHeader
rheader
;
...
@@ -184,7 +177,7 @@ bool Replay::RenameReplay(const wchar_t* oldname, const wchar_t* newname) {
...
@@ -184,7 +177,7 @@ bool Replay::RenameReplay(const wchar_t* oldname, const wchar_t* newname) {
wchar_t
newfname
[
256
];
wchar_t
newfname
[
256
];
myswprintf
(
oldfname
,
L"./replay/%ls"
,
oldname
);
myswprintf
(
oldfname
,
L"./replay/%ls"
,
oldname
);
myswprintf
(
newfname
,
L"./replay/%ls"
,
newname
);
myswprintf
(
newfname
,
L"./replay/%ls"
,
newname
);
#ifdef WIN32
#ifdef
_
WIN32
BOOL
result
=
MoveFileW
(
oldfname
,
newfname
);
BOOL
result
=
MoveFileW
(
oldfname
,
newfname
);
return
!!
result
;
return
!!
result
;
#else
#else
...
@@ -208,13 +201,13 @@ bool Replay::ReadNextResponse(unsigned char resp[]) {
...
@@ -208,13 +201,13 @@ bool Replay::ReadNextResponse(unsigned char resp[]) {
return
false
;
return
false
;
return
true
;
return
true
;
}
}
void
Replay
::
ReadName
(
wchar_t
*
data
)
{
bool
Replay
::
ReadName
(
wchar_t
*
data
)
{
uint16_t
buffer
[
20
]{};
uint16_t
buffer
[
20
]{};
if
(
!
ReadData
(
buffer
,
sizeof
buffer
))
{
if
(
!
ReadData
(
buffer
,
sizeof
buffer
))
{
data
[
0
]
=
0
;
return
false
;
return
;
}
}
BufferIO
::
CopyWStr
(
buffer
,
data
,
20
);
BufferIO
::
CopyWStr
(
buffer
,
data
,
20
);
return
true
;
}
}
bool
Replay
::
ReadData
(
void
*
data
,
int
length
)
{
bool
Replay
::
ReadData
(
void
*
data
,
int
length
)
{
if
(
!
is_replaying
)
if
(
!
is_replaying
)
...
...
Classes/gframe/replay.h
View file @
80f742f1
...
@@ -48,7 +48,7 @@ public:
...
@@ -48,7 +48,7 @@ public:
static
bool
DeleteReplay
(
const
wchar_t
*
name
);
static
bool
DeleteReplay
(
const
wchar_t
*
name
);
static
bool
RenameReplay
(
const
wchar_t
*
oldname
,
const
wchar_t
*
newname
);
static
bool
RenameReplay
(
const
wchar_t
*
oldname
,
const
wchar_t
*
newname
);
bool
ReadNextResponse
(
unsigned
char
resp
[]);
bool
ReadNextResponse
(
unsigned
char
resp
[]);
void
ReadName
(
wchar_t
*
data
);
bool
ReadName
(
wchar_t
*
data
);
//void ReadHeader(ReplayHeader& header);
//void ReadHeader(ReplayHeader& header);
bool
ReadData
(
void
*
data
,
int
length
);
bool
ReadData
(
void
*
data
,
int
length
);
template
<
typename
T
>
template
<
typename
T
>
...
...
Classes/gframe/replay_mode.cpp
View file @
80f742f1
...
@@ -886,7 +886,7 @@ inline void ReplayMode::ReloadLocation(int player, int location, int flag, std::
...
@@ -886,7 +886,7 @@ inline void ReplayMode::ReloadLocation(int player, int location, int flag, std::
mainGame
->
dField
.
UpdateFieldCard
(
mainGame
->
LocalPlayer
(
player
),
location
,
queryBuffer
.
data
());
mainGame
->
dField
.
UpdateFieldCard
(
mainGame
->
LocalPlayer
(
player
),
location
,
queryBuffer
.
data
());
}
}
void
ReplayMode
::
ReplayRefresh
(
int
flag
)
{
void
ReplayMode
::
ReplayRefresh
(
int
flag
)
{
std
::
vector
<
byte
>
queryBuffer
;
std
::
vector
<
unsigned
char
>
queryBuffer
;
queryBuffer
.
resize
(
SIZE_QUERY_BUFFER
);
queryBuffer
.
resize
(
SIZE_QUERY_BUFFER
);
ReloadLocation
(
0
,
LOCATION_MZONE
,
flag
,
queryBuffer
);
ReloadLocation
(
0
,
LOCATION_MZONE
,
flag
,
queryBuffer
);
ReloadLocation
(
1
,
LOCATION_MZONE
,
flag
,
queryBuffer
);
ReloadLocation
(
1
,
LOCATION_MZONE
,
flag
,
queryBuffer
);
...
...
Classes/gframe/single_duel.cpp
View file @
80f742f1
...
@@ -1418,7 +1418,7 @@ int SingleDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
...
@@ -1418,7 +1418,7 @@ int SingleDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
return
0
;
return
0
;
}
}
void
SingleDuel
::
GetResponse
(
DuelPlayer
*
dp
,
unsigned
char
*
pdata
,
unsigned
int
len
)
{
void
SingleDuel
::
GetResponse
(
DuelPlayer
*
dp
,
unsigned
char
*
pdata
,
unsigned
int
len
)
{
byte
resb
[
SIZE_RETURN_VALUE
]{};
unsigned
char
resb
[
SIZE_RETURN_VALUE
]{};
if
(
len
>
SIZE_RETURN_VALUE
)
if
(
len
>
SIZE_RETURN_VALUE
)
len
=
SIZE_RETURN_VALUE
;
len
=
SIZE_RETURN_VALUE
;
std
::
memcpy
(
resb
,
pdata
,
len
);
std
::
memcpy
(
resb
,
pdata
,
len
);
...
...
Classes/gframe/single_mode.cpp
View file @
80f742f1
...
@@ -55,10 +55,10 @@ int SingleMode::SinglePlayThread() {
...
@@ -55,10 +55,10 @@ int SingleMode::SinglePlayThread() {
mainGame
->
dInfo
.
turn
=
0
;
mainGame
->
dInfo
.
turn
=
0
;
if
(
mainGame
->
chkSinglePlayReturnDeckTop
->
isChecked
())
if
(
mainGame
->
chkSinglePlayReturnDeckTop
->
isChecked
())
opt
|=
DUEL_RETURN_DECK_TOP
;
opt
|=
DUEL_RETURN_DECK_TOP
;
char
filename
[
256
];
char
filename
[
256
]
{}
;
int
slen
=
0
;
int
slen
=
0
;
const
wchar_t
*
name
=
mainGame
->
lstSinglePlayList
->
getListItem
(
mainGame
->
lstSinglePlayList
->
getSelected
());
const
wchar_t
*
name
=
mainGame
->
lstSinglePlayList
->
getListItem
(
mainGame
->
lstSinglePlayList
->
getSelected
());
wchar_t
fname
[
256
];
wchar_t
fname
[
256
]
{}
;
myswprintf
(
fname
,
L"./single/%ls"
,
name
);
myswprintf
(
fname
,
L"./single/%ls"
,
name
);
slen
=
BufferIO
::
EncodeUTF8
(
fname
,
filename
);
slen
=
BufferIO
::
EncodeUTF8
(
fname
,
filename
);
if
(
!
preload_script
(
pduel
,
filename
))
if
(
!
preload_script
(
pduel
,
filename
))
...
@@ -98,11 +98,12 @@ int SingleMode::SinglePlayThread() {
...
@@ -98,11 +98,12 @@ int SingleMode::SinglePlayThread() {
is_continuing
=
SinglePlayAnalyze
(
engineBuffer
.
data
(),
len
);
is_continuing
=
SinglePlayAnalyze
(
engineBuffer
.
data
(),
len
);
last_replay
.
BeginRecord
();
last_replay
.
BeginRecord
();
last_replay
.
WriteHeader
(
rh
);
last_replay
.
WriteHeader
(
rh
);
uint16_t
buffer
[
20
];
uint16_t
host_name
[
20
]{};
BufferIO
::
CopyCharArray
(
mainGame
->
dInfo
.
hostname
,
buffer
);
BufferIO
::
CopyCharArray
(
mainGame
->
dInfo
.
hostname
,
host_name
);
last_replay
.
WriteData
(
buffer
,
40
,
false
);
last_replay
.
WriteData
(
host_name
,
sizeof
host_name
,
false
);
BufferIO
::
CopyCharArray
(
mainGame
->
dInfo
.
clientname
,
buffer
);
uint16_t
client_name
[
20
]{};
last_replay
.
WriteData
(
buffer
,
40
,
false
);
BufferIO
::
CopyCharArray
(
mainGame
->
dInfo
.
clientname
,
client_name
);
last_replay
.
WriteData
(
client_name
,
sizeof
client_name
,
false
);
last_replay
.
WriteInt32
(
start_lp
,
false
);
last_replay
.
WriteInt32
(
start_lp
,
false
);
last_replay
.
WriteInt32
(
start_hand
,
false
);
last_replay
.
WriteInt32
(
start_hand
,
false
);
last_replay
.
WriteInt32
(
draw_count
,
false
);
last_replay
.
WriteInt32
(
draw_count
,
false
);
...
@@ -804,7 +805,7 @@ void SingleMode::SinglePlayRefreshSingle(int player, int location, int sequence,
...
@@ -804,7 +805,7 @@ void SingleMode::SinglePlayRefreshSingle(int player, int location, int sequence,
mainGame
->
dField
.
UpdateCard
(
mainGame
->
LocalPlayer
(
player
),
location
,
sequence
,
queryBuffer
);
mainGame
->
dField
.
UpdateCard
(
mainGame
->
LocalPlayer
(
player
),
location
,
sequence
,
queryBuffer
);
}
}
void
SingleMode
::
SinglePlayReload
()
{
void
SingleMode
::
SinglePlayReload
()
{
std
::
vector
<
byte
>
queryBuffer
;
std
::
vector
<
unsigned
char
>
queryBuffer
;
queryBuffer
.
resize
(
SIZE_QUERY_BUFFER
);
queryBuffer
.
resize
(
SIZE_QUERY_BUFFER
);
unsigned
int
flag
=
0xffdfff
;
unsigned
int
flag
=
0xffdfff
;
ReloadLocation
(
0
,
LOCATION_MZONE
,
flag
,
queryBuffer
);
ReloadLocation
(
0
,
LOCATION_MZONE
,
flag
,
queryBuffer
);
...
...
Classes/gframe/tag_duel.cpp
View file @
80f742f1
...
@@ -1533,7 +1533,7 @@ int TagDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
...
@@ -1533,7 +1533,7 @@ int TagDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
return
0
;
return
0
;
}
}
void
TagDuel
::
GetResponse
(
DuelPlayer
*
dp
,
unsigned
char
*
pdata
,
unsigned
int
len
)
{
void
TagDuel
::
GetResponse
(
DuelPlayer
*
dp
,
unsigned
char
*
pdata
,
unsigned
int
len
)
{
byte
resb
[
SIZE_RETURN_VALUE
]{};
unsigned
char
resb
[
SIZE_RETURN_VALUE
]{};
if
(
len
>
SIZE_RETURN_VALUE
)
if
(
len
>
SIZE_RETURN_VALUE
)
len
=
SIZE_RETURN_VALUE
;
len
=
SIZE_RETURN_VALUE
;
std
::
memcpy
(
resb
,
pdata
,
len
);
std
::
memcpy
(
resb
,
pdata
,
len
);
...
...
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