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
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
baichixing
ygopro
Commits
f42ed605
Commit
f42ed605
authored
Sep 20, 2018
by
DailyShana
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "fix & remove redoundant code"
This reverts commit
2c080e02
.
parent
2c080e02
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
94 additions
and
42 deletions
+94
-42
gframe/gframe.cpp
gframe/gframe.cpp
+94
-42
No files found.
gframe/gframe.cpp
View file @
f42ed605
...
@@ -12,6 +12,9 @@ bool open_file = false;
...
@@ -12,6 +12,9 @@ bool open_file = false;
wchar_t
open_file_name
[
256
]
=
L""
;
wchar_t
open_file_name
[
256
]
=
L""
;
bool
bot_mode
=
false
;
bool
bot_mode
=
false
;
void
GetParameterW
(
wchar_t
*
param
,
const
char
*
arg
)
{
BufferIO
::
DecodeUTF8
(
arg
,
param
);
}
void
ClickButton
(
irr
::
gui
::
IGUIElement
*
btn
)
{
void
ClickButton
(
irr
::
gui
::
IGUIElement
*
btn
)
{
irr
::
SEvent
event
;
irr
::
SEvent
event
;
event
.
EventType
=
irr
::
EET_GUI_EVENT
;
event
.
EventType
=
irr
::
EET_GUI_EVENT
;
...
@@ -57,66 +60,120 @@ int main(int argc, char* argv[]) {
...
@@ -57,66 +60,120 @@ int main(int argc, char* argv[]) {
return
0
;
return
0
;
#ifdef _WIN32
#ifdef _WIN32
wchar_t
**
wargv
;
wchar_t
*
command
=
GetCommandLineW
();
int
wargc
;
char
buffer
[
2048
];
LPWSTR
commandLine
=
GetCommandLineW
();
BufferIO
::
EncodeUTF8
(
command
,
buffer
);
wargv
=
CommandLineToArgvW
(
commandLine
,
&
wargc
);
char
*
ptr
=
buffer
;
#else
argc
=
0
;
wchar_t
wargv
[
argc
][
256
];
int
j
=
0
;
for
(
int
i
=
1
;
i
<
argc
;
++
i
)
{
bool
in_QM
=
false
,
in_TEXT
=
false
,
in_SPACE
=
true
;
BufferIO
::
DecodeUTF8
(
argv
[
i
],
wargv
[
i
]);
while
(
*
ptr
)
{
if
(
in_QM
)
{
if
(
*
ptr
==
'\"'
)
in_QM
=
false
;
else
++
j
;
}
else
{
switch
(
*
ptr
)
{
case
'\"'
:
{
in_QM
=
true
;
in_TEXT
=
true
;
if
(
in_SPACE
)
{
argv
[
argc
]
=
ptr
+
1
;
j
=
0
;
}
}
#endif //_WIN32
in_SPACE
=
false
;
break
;
}
case
' '
:
case
'\t'
:
case
'\n'
:
case
'\r'
:
{
if
(
in_TEXT
)
{
argv
[
argc
][
j
]
=
'\0'
;
++
argc
;
}
in_TEXT
=
false
;
in_SPACE
=
true
;
break
;
}
default:
{
in_TEXT
=
true
;
if
(
in_SPACE
)
{
argv
[
argc
]
=
ptr
;
j
=
1
;
}
else
++
j
;
in_SPACE
=
false
;
break
;
}
}
}
++
ptr
;
}
if
(
in_TEXT
)
{
argv
[
argc
][
j
]
=
'\0'
;
++
argc
;
}
argv
[
argc
]
=
NULL
;
#endif // _WIN32
bool
keep_on_return
=
false
;
bool
keep_on_return
=
false
;
for
(
int
i
=
1
;
i
<
argc
;
++
i
)
{
for
(
int
i
=
1
;
i
<
argc
;
++
i
)
{
if
(
argv
[
i
][
0
]
==
'-'
&&
argv
[
i
][
1
]
==
'e'
&&
argv
[
i
][
2
]
!=
'\0'
)
{
if
(
argv
[
i
][
0
]
==
'-'
&&
argv
[
i
][
1
]
==
'e'
&&
argv
[
i
][
2
])
{
char
param
[
128
];
ygo
::
dataManager
.
LoadDB
(
&
argv
[
i
][
2
]);
BufferIO
::
EncodeUTF8
(
&
wargv
[
i
][
2
],
param
);
ygo
::
dataManager
.
LoadDB
(
param
);
continue
;
continue
;
}
}
if
(
!
strcmp
(
argv
[
i
],
"-e"
))
{
// extra database
if
(
!
strcmp
(
argv
[
i
],
"-e"
))
{
// extra database
++
i
;
++
i
;
if
(
i
<
argc
)
{
if
(
i
<
argc
)
char
param
[
128
];
ygo
::
dataManager
.
LoadDB
(
&
argv
[
i
][
0
]);
BufferIO
::
EncodeUTF8
(
wargv
[
i
],
param
);
ygo
::
dataManager
.
LoadDB
(
param
);
}
continue
;
continue
;
}
else
if
(
!
strcmp
(
argv
[
i
],
"-n"
))
{
// nickName
}
else
if
(
!
strcmp
(
argv
[
i
],
"-n"
))
{
// nickName
++
i
;
++
i
;
if
(
i
<
argc
)
if
(
i
<
argc
)
{
ygo
::
mainGame
->
ebNickName
->
setText
(
wargv
[
i
]);
wchar_t
param
[
128
];
GetParameterW
(
param
,
&
argv
[
i
][
0
]);
ygo
::
mainGame
->
ebNickName
->
setText
(
param
);
}
continue
;
continue
;
}
else
if
(
!
strcmp
(
argv
[
i
],
"-h"
))
{
// Host address
}
else
if
(
!
strcmp
(
argv
[
i
],
"-h"
))
{
// Host address
++
i
;
++
i
;
if
(
i
<
argc
)
if
(
i
<
argc
)
{
ygo
::
mainGame
->
ebJoinHost
->
setText
(
wargv
[
i
]);
wchar_t
param
[
128
];
GetParameterW
(
param
,
&
argv
[
i
][
0
]);
ygo
::
mainGame
->
ebJoinHost
->
setText
(
param
);
}
continue
;
continue
;
}
else
if
(
!
strcmp
(
argv
[
i
],
"-p"
))
{
// host Port
}
else
if
(
!
strcmp
(
argv
[
i
],
"-p"
))
{
// host Port
++
i
;
++
i
;
if
(
i
<
argc
)
if
(
i
<
argc
)
{
ygo
::
mainGame
->
ebJoinPort
->
setText
(
wargv
[
i
]);
wchar_t
param
[
128
];
GetParameterW
(
param
,
&
argv
[
i
][
0
]);
ygo
::
mainGame
->
ebJoinPort
->
setText
(
param
);
}
continue
;
continue
;
}
else
if
(
!
strcmp
(
argv
[
i
],
"-w"
))
{
// host passWord
}
else
if
(
!
strcmp
(
argv
[
i
],
"-w"
))
{
// host passWord
++
i
;
++
i
;
if
(
i
<
argc
)
if
(
i
<
argc
)
{
ygo
::
mainGame
->
ebJoinPass
->
setText
(
wargv
[
i
]);
wchar_t
param
[
128
];
GetParameterW
(
param
,
&
argv
[
i
][
0
]);
ygo
::
mainGame
->
ebJoinPass
->
setText
(
param
);
}
continue
;
continue
;
}
else
if
(
!
strcmp
(
argv
[
i
],
"-k"
))
{
// Keep on return
}
else
if
(
!
strcmp
(
argv
[
i
],
"-k"
))
{
// Keep on return
exit_on_return
=
false
;
exit_on_return
=
false
;
keep_on_return
=
true
;
keep_on_return
=
true
;
}
else
if
(
!
strcmp
(
argv
[
i
],
"-d"
))
{
// Deck
}
else
if
(
!
strcmp
(
argv
[
i
],
"-d"
))
{
// Deck
if
(
i
+
2
<
argc
)
{
// select deck
++
i
;
++
i
;
if
(
i
+
1
<
argc
)
{
// select deck
GetParameterW
(
ygo
::
mainGame
->
gameConf
.
lastdeck
,
&
argv
[
i
][
0
]);
wcscpy
(
ygo
::
mainGame
->
gameConf
.
lastdeck
,
wargv
[
i
]);
continue
;
continue
;
}
else
{
// open deck
}
else
{
// open deck
exit_on_return
=
!
keep_on_return
;
exit_on_return
=
!
keep_on_return
;
if
(
i
<
argc
)
{
if
(
i
+
1
<
argc
)
{
open_file
=
true
;
open_file
=
true
;
wcscpy
(
open_file_name
,
wargv
[
i
]);
GetParameterW
(
open_file_name
,
&
argv
[
i
+
1
][
0
]);
}
}
ClickButton
(
ygo
::
mainGame
->
btnDeckEdit
);
ClickButton
(
ygo
::
mainGame
->
btnDeckEdit
);
break
;
break
;
...
@@ -133,10 +190,9 @@ int main(int argc, char* argv[]) {
...
@@ -133,10 +190,9 @@ int main(int argc, char* argv[]) {
break
;
break
;
}
else
if
(
!
strcmp
(
argv
[
i
],
"-r"
))
{
// Replay
}
else
if
(
!
strcmp
(
argv
[
i
],
"-r"
))
{
// Replay
exit_on_return
=
!
keep_on_return
;
exit_on_return
=
!
keep_on_return
;
++
i
;
if
(
i
+
1
<
argc
)
{
if
(
i
<
argc
)
{
open_file
=
true
;
open_file
=
true
;
wcscpy
(
open_file_name
,
wargv
[
i
]);
GetParameterW
(
open_file_name
,
&
argv
[
i
+
1
][
0
]);
}
}
ClickButton
(
ygo
::
mainGame
->
btnReplayMode
);
ClickButton
(
ygo
::
mainGame
->
btnReplayMode
);
if
(
open_file
)
if
(
open_file
)
...
@@ -144,10 +200,9 @@ int main(int argc, char* argv[]) {
...
@@ -144,10 +200,9 @@ int main(int argc, char* argv[]) {
break
;
break
;
}
else
if
(
!
strcmp
(
argv
[
i
],
"-s"
))
{
// Single
}
else
if
(
!
strcmp
(
argv
[
i
],
"-s"
))
{
// Single
exit_on_return
=
!
keep_on_return
;
exit_on_return
=
!
keep_on_return
;
++
i
;
if
(
i
+
1
<
argc
)
{
if
(
i
<
argc
)
{
open_file
=
true
;
open_file
=
true
;
wcscpy
(
open_file_name
,
wargv
[
i
]);
GetParameterW
(
open_file_name
,
&
argv
[
i
+
1
][
0
]);
}
}
ClickButton
(
ygo
::
mainGame
->
btnSingleMode
);
ClickButton
(
ygo
::
mainGame
->
btnSingleMode
);
if
(
open_file
)
if
(
open_file
)
...
@@ -157,14 +212,14 @@ int main(int argc, char* argv[]) {
...
@@ -157,14 +212,14 @@ int main(int argc, char* argv[]) {
char
*
pstrext
=
argv
[
1
]
+
strlen
(
argv
[
1
])
-
4
;
char
*
pstrext
=
argv
[
1
]
+
strlen
(
argv
[
1
])
-
4
;
if
(
!
mystrncasecmp
(
pstrext
,
".ydk"
,
4
))
{
if
(
!
mystrncasecmp
(
pstrext
,
".ydk"
,
4
))
{
open_file
=
true
;
open_file
=
true
;
wcscpy
(
open_file_name
,
wargv
[
i
]);
GetParameterW
(
open_file_name
,
&
argv
[
1
][
0
]);
exit_on_return
=
!
keep_on_return
;
exit_on_return
=
!
keep_on_return
;
ClickButton
(
ygo
::
mainGame
->
btnDeckEdit
);
ClickButton
(
ygo
::
mainGame
->
btnDeckEdit
);
break
;
break
;
}
}
if
(
!
mystrncasecmp
(
pstrext
,
".yrp"
,
4
))
{
if
(
!
mystrncasecmp
(
pstrext
,
".yrp"
,
4
))
{
open_file
=
true
;
open_file
=
true
;
wcscpy
(
open_file_name
,
wargv
[
i
]);
GetParameterW
(
open_file_name
,
&
argv
[
1
][
0
]);
exit_on_return
=
!
keep_on_return
;
exit_on_return
=
!
keep_on_return
;
ClickButton
(
ygo
::
mainGame
->
btnReplayMode
);
ClickButton
(
ygo
::
mainGame
->
btnReplayMode
);
ClickButton
(
ygo
::
mainGame
->
btnLoadReplay
);
ClickButton
(
ygo
::
mainGame
->
btnLoadReplay
);
...
@@ -172,9 +227,6 @@ int main(int argc, char* argv[]) {
...
@@ -172,9 +227,6 @@ int main(int argc, char* argv[]) {
}
}
}
}
}
}
#ifdef _WIN32
LocalFree
(
wargv
);
#endif
ygo
::
mainGame
->
MainLoop
();
ygo
::
mainGame
->
MainLoop
();
#ifdef _WIN32
#ifdef _WIN32
WSACleanup
();
WSACleanup
();
...
...
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