Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
ygopro
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
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
MyCard
ygopro
Commits
30415ba8
Commit
30415ba8
authored
Jul 31, 2018
by
DailyShana
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
ad5cfe65
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
24 deletions
+12
-24
gframe/single_mode.cpp
gframe/single_mode.cpp
+12
-23
gframe/single_mode.h
gframe/single_mode.h
+0
-1
No files found.
gframe/single_mode.cpp
View file @
30415ba8
...
@@ -12,8 +12,6 @@ bool SingleMode::is_closing = false;
...
@@ -12,8 +12,6 @@ bool SingleMode::is_closing = false;
bool
SingleMode
::
is_continuing
=
false
;
bool
SingleMode
::
is_continuing
=
false
;
Replay
SingleMode
::
last_replay
;
Replay
SingleMode
::
last_replay
;
static
byte
buffer
[
0x20000
];
bool
SingleMode
::
StartPlay
()
{
bool
SingleMode
::
StartPlay
()
{
Thread
::
NewThread
(
SinglePlayThread
,
0
);
Thread
::
NewThread
(
SinglePlayThread
,
0
);
return
true
;
return
true
;
...
@@ -60,7 +58,11 @@ int SingleMode::SinglePlayThread(void* param) {
...
@@ -60,7 +58,11 @@ int SingleMode::SinglePlayThread(void* param) {
if
(
!
preload_script
(
pduel
,
filename
,
slen
))
{
if
(
!
preload_script
(
pduel
,
filename
,
slen
))
{
wchar_t
fname
[
256
];
wchar_t
fname
[
256
];
myswprintf
(
fname
,
L"./single/%ls"
,
open_file_name
);
myswprintf
(
fname
,
L"./single/%ls"
,
open_file_name
);
#ifdef _WIN32
slen
=
WideCharToMultiByte
(
CP_ACP
,
0
,
fname
,
-
1
,
filename
,
256
,
0
,
0
);
#else
slen
=
BufferIO
::
EncodeUTF8
(
fname
,
filename
);
slen
=
BufferIO
::
EncodeUTF8
(
fname
,
filename
);
#endif // _WIN32
if
(
!
preload_script
(
pduel
,
filename
,
slen
))
if
(
!
preload_script
(
pduel
,
filename
,
slen
))
slen
=
0
;
slen
=
0
;
}
}
...
@@ -68,7 +70,11 @@ int SingleMode::SinglePlayThread(void* param) {
...
@@ -68,7 +70,11 @@ int SingleMode::SinglePlayThread(void* param) {
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
);
#ifdef _WIN32
slen
=
WideCharToMultiByte
(
CP_ACP
,
0
,
fname
,
-
1
,
filename
,
256
,
0
,
0
);
#else
slen
=
BufferIO
::
EncodeUTF8
(
fname
,
filename
);
slen
=
BufferIO
::
EncodeUTF8
(
fname
,
filename
);
#endif // _WIN32
if
(
!
preload_script
(
pduel
,
filename
,
slen
))
if
(
!
preload_script
(
pduel
,
filename
,
slen
))
slen
=
0
;
slen
=
0
;
}
}
...
@@ -898,30 +904,13 @@ void SingleMode::SinglePlayReload() {
...
@@ -898,30 +904,13 @@ void SingleMode::SinglePlayReload() {
mainGame
->
dField
.
UpdateFieldCard
(
mainGame
->
LocalPlayer
(
1
),
LOCATION_REMOVED
,
(
char
*
)
queryBuffer
);
mainGame
->
dField
.
UpdateFieldCard
(
mainGame
->
LocalPlayer
(
1
),
LOCATION_REMOVED
,
(
char
*
)
queryBuffer
);
}
}
byte
*
SingleMode
::
ScriptReaderEx
(
const
char
*
script_name
,
int
*
slen
)
{
byte
*
SingleMode
::
ScriptReaderEx
(
const
char
*
script_name
,
int
*
slen
)
{
char
sname
[
256
]
=
"./expansions"
;
char
sname
[
256
]
=
"./expansions"
;
strcat
(
sname
,
script_name
+
1
);
//default script name: ./script/c%d.lua
strcat
(
sname
,
script_name
+
1
);
//default script name: ./script/c%d.lua
if
(
ScriptReader
(
sname
,
slen
))
byte
*
buffer
=
default_script_reader
(
sname
,
slen
);
if
(
buffer
)
return
buffer
;
return
buffer
;
else
else
return
ScriptReader
(
script_name
,
slen
);
return
default_script_reader
(
script_name
,
slen
);
}
byte
*
SingleMode
::
ScriptReader
(
const
char
*
script_name
,
int
*
slen
)
{
FILE
*
fp
;
#ifdef _WIN32
wchar_t
fname
[
256
];
BufferIO
::
DecodeUTF8
(
script_name
,
fname
);
fp
=
_wfopen
(
fname
,
L"rb"
);
#else
fp
=
fopen
(
script_name
,
"rb"
);
#endif
if
(
!
fp
)
return
0
;
int
len
=
fread
(
buffer
,
1
,
sizeof
(
buffer
),
fp
);
fclose
(
fp
);
if
(
len
>=
sizeof
(
buffer
))
return
0
;
*
slen
=
len
;
return
buffer
;
}
}
int
SingleMode
::
MessageHandler
(
long
fduel
,
int
type
)
{
int
SingleMode
::
MessageHandler
(
long
fduel
,
int
type
)
{
if
(
!
enable_log
)
if
(
!
enable_log
)
...
...
gframe/single_mode.h
View file @
30415ba8
...
@@ -27,7 +27,6 @@ public:
...
@@ -27,7 +27,6 @@ public:
static
void
SinglePlayReload
();
static
void
SinglePlayReload
();
static
byte
*
ScriptReaderEx
(
const
char
*
script_name
,
int
*
slen
);
static
byte
*
ScriptReaderEx
(
const
char
*
script_name
,
int
*
slen
);
static
byte
*
ScriptReader
(
const
char
*
script_name
,
int
*
slen
);
static
int
MessageHandler
(
long
fduel
,
int
type
);
static
int
MessageHandler
(
long
fduel
,
int
type
);
protected:
protected:
...
...
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