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
06145170
Commit
06145170
authored
Sep 23, 2022
by
nanahira
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'server' of github.com:moecube/ygopro into server
parents
3a8c5e96
39dc7730
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
50 additions
and
40 deletions
+50
-40
appveyor.yml
appveyor.yml
+11
-11
cards.cdb
cards.cdb
+0
-0
gframe/data_manager.cpp
gframe/data_manager.cpp
+3
-4
gframe/data_manager.h
gframe/data_manager.h
+1
-1
gframe/deck_manager.cpp
gframe/deck_manager.cpp
+3
-1
gframe/deck_manager.h
gframe/deck_manager.h
+5
-1
gframe/game.cpp
gframe/game.cpp
+3
-3
gframe/game.h
gframe/game.h
+2
-1
gframe/gframe.cpp
gframe/gframe.cpp
+2
-2
gframe/myfilesystem.h
gframe/myfilesystem.h
+1
-2
gframe/replay.cpp
gframe/replay.cpp
+11
-11
gframe/replay.h
gframe/replay.h
+5
-0
gframe/single_duel.cpp
gframe/single_duel.cpp
+1
-1
gframe/tag_duel.cpp
gframe/tag_duel.cpp
+1
-1
ocgcore
ocgcore
+1
-1
No files found.
appveyor.yml
View file @
06145170
...
...
@@ -7,21 +7,21 @@ install:
-
git submodule update --init --recursive
# environment and system dependency
-
bash -c "curl --retry 5 --connect-timeout 30 --location --remote-header-name --remote-name https://github.com/premake/premake-core/releases/download/v5.0.0-beta
1/premake-5.0.0-beta1
-windows.zip ; exit 0"
-
7z x premake-5.0.0-beta
1
-windows.zip
-
bash -c "curl --retry 5 --connect-timeout 30 --location --remote-header-name --remote-name https://github.com/premake/premake-core/releases/download/v5.0.0-beta
2/premake-5.0.0-beta2
-windows.zip ; exit 0"
-
7z x premake-5.0.0-beta
2
-windows.zip
-
bash -c "curl --retry 5 --connect-timeout 30 --location --remote-header-name --remote-name https://github.com/libevent/libevent/releases/download/release-2.0.22-stable/libevent-2.0.22-stable.tar.gz ; exit 0"
-
tar xf libevent-2.0.22-stable.tar.gz
-
move libevent-2.0.22-stable event
-
xcopy /E event\WIN32-Code event\include
-
bash -c "curl --retry 5 --connect-timeout 30 --location --remote-header-name --remote-name https://www.lua.org/ftp/lua-5.
3.6
.tar.gz ; exit 0"
-
tar xf lua-5.
3.6
.tar.gz
-
move lua-5.
3.6
lua
-
bash -c "curl --retry 5 --connect-timeout 30 --location --remote-header-name --remote-name https://www.lua.org/ftp/lua-5.
4.4
.tar.gz ; exit 0"
-
tar xf lua-5.
4.4
.tar.gz
-
move lua-5.
4.4
lua
-
bash -c "curl --retry 5 --connect-timeout 30 --location --remote-header-name --remote-name https://www.sqlite.org/202
0/sqlite-amalgamation-3310100.zip
; exit 0"
-
7z x -y sqlite-amalgamation-33
101
00.zip
-
move sqlite-amalgamation-33
101
00 sqlite3
-
bash -c "curl --retry 5 --connect-timeout 30 --location --remote-header-name --remote-name https://www.sqlite.org/202
2/sqlite-amalgamation-3390300.zip
; exit 0"
-
7z x -y sqlite-amalgamation-33
903
00.zip
-
move sqlite-amalgamation-33
903
00 sqlite3
# let premake happy
-
xcopy /E premake\* .
...
...
@@ -89,7 +89,7 @@ deploy:
branch
:
server
cache
:
-
premake-5.0.0-beta
1
-windows.zip
-
premake-5.0.0-beta
2
-windows.zip
-
libevent-2.0.22-stable.tar.gz
-
lua-5.
3.6
.tar.gz
-
sqlite-amalgamation-33
101
00.zip
-
lua-5.
4.4
.tar.gz
-
sqlite-amalgamation-33
903
00.zip
cards.cdb
View file @
06145170
No preview for this file type
gframe/data_manager.cpp
View file @
06145170
...
...
@@ -185,7 +185,7 @@ bool DataManager::Error(spmemvfs_db_t* pDB, sqlite3_stmt* pStmt) {
spmemvfs_env_fini
();
return
false
;
}
#endif
#endif
//YGOPRO_SERVER_MODE
bool
DataManager
::
GetData
(
int
code
,
CardData
*
pData
)
{
auto
cdit
=
_datas
.
find
(
code
);
if
(
cdit
==
_datas
.
end
())
...
...
@@ -402,7 +402,7 @@ byte* DataManager::ScriptReaderEx(const char* script_name, int* slen) {
if
(
buffer
)
return
buffer
;
}
#endif
#endif
//YGOPRO_SERVER_MODE
buffer
=
ScriptReaderExSingle
(
"specials/"
,
script_name
,
slen
,
9
);
if
(
buffer
)
return
buffer
;
...
...
@@ -417,9 +417,8 @@ byte* DataManager::ScriptReaderExSingle(const char* path, const char* script_nam
return
ScriptReader
(
sname
,
slen
);
}
byte
*
DataManager
::
ScriptReader
(
const
char
*
script_name
,
int
*
slen
)
{
FILE
*
fp
;
#ifdef YGOPRO_SERVER_MODE
fp
=
fopen
(
script_name
,
"rb"
);
FILE
*
fp
=
fopen
(
script_name
,
"rb"
);
if
(
!
fp
)
return
0
;
int
len
=
fread
(
scriptBuffer
,
1
,
sizeof
(
scriptBuffer
),
fp
);
...
...
gframe/data_manager.h
View file @
06145170
...
...
@@ -23,7 +23,7 @@ public:
#else
void
ReadStringConfLine
(
const
char
*
linebuf
);
bool
Error
(
sqlite3
*
pDB
,
sqlite3_stmt
*
pStmt
=
0
);
#endif
#endif
//YGOPRO_SERVER_MODE
bool
GetData
(
int
code
,
CardData
*
pData
);
code_pointer
GetCodePointer
(
int
code
);
bool
GetString
(
int
code
,
CardString
*
pStr
);
...
...
gframe/deck_manager.cpp
View file @
06145170
...
...
@@ -6,7 +6,9 @@
namespace
ygo
{
#ifndef YGOPRO_SERVER_MODE
char
DeckManager
::
deckBuffer
[
0x10000
];
#endif
DeckManager
deckManager
;
void
DeckManager
::
LoadLFListSingle
(
const
char
*
path
)
{
...
...
@@ -253,7 +255,6 @@ bool DeckManager::LoadDeck(irr::gui::IGUIComboBox* cbCategory, irr::gui::IGUICom
mainGame
->
deckBuilder
.
RefreshPackListScroll
();
return
res
;
}
#endif
FILE
*
DeckManager
::
OpenDeckFile
(
const
wchar_t
*
file
,
const
char
*
mode
)
{
#ifdef WIN32
FILE
*
fp
=
_wfopen
(
file
,
(
wchar_t
*
)
mode
);
...
...
@@ -412,4 +413,5 @@ bool DeckManager::DeleteCategory(const wchar_t* name) {
return
false
;
return
FileSystem
::
DeleteDir
(
localname
);
}
#endif //YGOPRO_SERVER_MODE
}
gframe/deck_manager.h
View file @
06145170
...
...
@@ -5,7 +5,9 @@
#include "client_card.h"
#include <unordered_map>
#include <vector>
#ifndef YGOPRO_SERVER_MODE
#include <sstream>
#endif
namespace
ygo
{
...
...
@@ -36,7 +38,9 @@ public:
Deck
current_deck
;
std
::
vector
<
LFList
>
_lfList
;
#ifndef YGOPRO_SERVER_MODE
static
char
deckBuffer
[
0x10000
];
#endif
void
LoadLFListSingle
(
const
char
*
path
);
void
LoadLFList
();
...
...
@@ -49,7 +53,6 @@ public:
void
GetCategoryPath
(
wchar_t
*
ret
,
int
index
,
const
wchar_t
*
text
);
void
GetDeckFile
(
wchar_t
*
ret
,
irr
::
gui
::
IGUIComboBox
*
cbCategory
,
irr
::
gui
::
IGUIComboBox
*
cbDeck
);
bool
LoadDeck
(
irr
::
gui
::
IGUIComboBox
*
cbCategory
,
irr
::
gui
::
IGUIComboBox
*
cbDeck
);
#endif
FILE
*
OpenDeckFile
(
const
wchar_t
*
file
,
const
char
*
mode
);
IReadFile
*
OpenDeckReader
(
const
wchar_t
*
file
);
bool
LoadDeck
(
const
wchar_t
*
file
,
bool
is_packlist
=
false
);
...
...
@@ -63,6 +66,7 @@ public:
bool
CreateCategory
(
const
wchar_t
*
name
);
bool
RenameCategory
(
const
wchar_t
*
oldname
,
const
wchar_t
*
newname
);
bool
DeleteCategory
(
const
wchar_t
*
name
);
#endif //YGOPRO_SERVER_MODE
};
extern
DeckManager
deckManager
;
...
...
gframe/game.cpp
View file @
06145170
...
...
@@ -25,7 +25,7 @@ namespace ygo {
Game
*
mainGame
;
#ifdef YGOPRO_SERVER_MODE
unsigned
short
aServerP
ort
;
unsigned
short
server_p
ort
;
unsigned
short
replay_mode
;
unsigned
int
pre_seed
[
3
];
HostInfo
game_info
;
...
...
@@ -36,9 +36,9 @@ void Game::MainServerLoop() {
dataManager
.
LoadDB
(
L"cards.cdb"
);
LoadExpansions
();
aServerPort
=
NetServer
::
StartServer
(
aServerP
ort
);
server_port
=
NetServer
::
StartServer
(
server_p
ort
);
NetServer
::
InitDuel
();
printf
(
"%u
\n
"
,
aServerP
ort
);
printf
(
"%u
\n
"
,
server_p
ort
);
fflush
(
stdout
);
while
(
NetServer
::
net_evbase
)
{
...
...
gframe/game.h
View file @
06145170
...
...
@@ -645,8 +645,9 @@ public:
};
extern
Game
*
mainGame
;
#ifdef YGOPRO_SERVER_MODE
extern
unsigned
short
aServerP
ort
;
extern
unsigned
short
server_p
ort
;
extern
unsigned
short
replay_mode
;
extern
HostInfo
game_info
;
extern
unsigned
int
pre_seed
[
3
];
...
...
gframe/gframe.cpp
View file @
06145170
...
...
@@ -62,7 +62,7 @@ int main(int argc, char* argv[]) {
ygo
::
Game
_game
;
#ifdef YGOPRO_SERVER_MODE
enable_log
=
1
;
ygo
::
aServerP
ort
=
7911
;
ygo
::
server_p
ort
=
7911
;
ygo
::
replay_mode
=
0
;
ygo
::
game_info
.
lflist
=
0
;
ygo
::
game_info
.
rule
=
0
;
...
...
@@ -83,7 +83,7 @@ int main(int argc, char* argv[]) {
return
0
;
}
else
if
(
argc
>
2
)
{
ygo
::
aServerP
ort
=
atoi
(
argv
[
1
]);
ygo
::
server_p
ort
=
atoi
(
argv
[
1
]);
int
lflist
=
atoi
(
argv
[
2
]);
if
(
lflist
<
0
)
lflist
=
999
;
...
...
gframe/myfilesystem.h
View file @
06145170
...
...
@@ -209,8 +209,7 @@ public:
#ifndef YGOPRO_SERVER_MODE
std
::
vector
<
file_unit
>
file_list
;
#endif
while
((
dirp
=
readdir
(
dir
))
!=
nullptr
)
{
while
((
dirp
=
readdir
(
dir
))
!=
nullptr
)
{
#ifndef YGOPRO_SERVER_MODE
file_unit
funit
;
#endif
...
...
gframe/replay.cpp
View file @
06145170
...
...
@@ -6,7 +6,7 @@
namespace
ygo
{
#ifdef YGOPRO_SERVER_MODE
extern
unsigned
short
aServerP
ort
;
extern
unsigned
short
server_p
ort
;
extern
unsigned
short
replay_mode
;
#endif
Replay
::
Replay
()
...
...
@@ -23,7 +23,7 @@ Replay::~Replay() {
}
void
Replay
::
BeginRecord
()
{
#ifdef YGOPRO_SERVER_MODE
if
(
replay_mode
&
0x1
)
{
if
(
replay_mode
&
REPLAY_MODE_SAVE_IN_SERVER
)
{
#endif
if
(
!
FileSystem
::
IsDirExists
(
L"./replay"
)
&&
!
FileSystem
::
MakeDir
(
L"./replay"
))
return
;
...
...
@@ -36,7 +36,7 @@ void Replay::BeginRecord() {
wchar_t
tmppath
[
80
];
wcsftime
(
tmppath
,
80
,
L"./replay/%Y-%m-%d %H-%M-%S %%u.yrp"
,
localedtime
);
wchar_t
path
[
80
];
myswprintf
(
path
,
tmppath
,
aServerP
ort
);
myswprintf
(
path
,
tmppath
,
server_p
ort
);
recording_fp
=
CreateFileW
(
path
,
GENERIC_WRITE
,
0
,
NULL
,
CREATE_ALWAYS
,
FILE_FLAG_WRITE_THROUGH
,
NULL
);
#else
recording_fp
=
CreateFileW
(
L"./replay/_LastReplay.yrp"
,
GENERIC_WRITE
,
0
,
NULL
,
CREATE_ALWAYS
,
FILE_FLAG_WRITE_THROUGH
,
NULL
);
...
...
@@ -52,7 +52,7 @@ void Replay::BeginRecord() {
char
tmppath
[
40
];
strftime
(
tmppath
,
40
,
"./replay/%Y-%m-%d %H-%M-%S %%u.yrp"
,
localedtime
);
char
path
[
40
];
sprintf
(
path
,
tmppath
,
aServerP
ort
);
sprintf
(
path
,
tmppath
,
server_p
ort
);
fp
=
fopen
(
path
,
"wb"
);
#else
fp
=
fopen
(
"./replay/_LastReplay.yrp"
,
"wb"
);
...
...
@@ -72,7 +72,7 @@ void Replay::BeginRecord() {
void
Replay
::
WriteHeader
(
ReplayHeader
&
header
)
{
pheader
=
header
;
#ifdef YGOPRO_SERVER_MODE
if
(
!
(
replay_mode
&
0x1
))
return
;
if
(
!
(
replay_mode
&
REPLAY_MODE_SAVE_IN_SERVER
))
return
;
#endif
#ifdef _WIN32
DWORD
size
;
...
...
@@ -90,7 +90,7 @@ void Replay::WriteData(const void* data, int length, bool flush) {
memcpy
(
pdata
,
data
,
length
);
pdata
+=
length
;
#ifdef YGOPRO_SERVER_MODE
if
(
!
(
replay_mode
&
0x1
))
return
;
if
(
!
(
replay_mode
&
REPLAY_MODE_SAVE_IN_SERVER
))
return
;
#endif
#ifdef _WIN32
DWORD
size
;
...
...
@@ -109,7 +109,7 @@ void Replay::WriteInt32(int data, bool flush) {
*
((
int
*
)(
pdata
))
=
data
;
pdata
+=
4
;
#ifdef YGOPRO_SERVER_MODE
if
(
!
(
replay_mode
&
0x1
))
return
;
if
(
!
(
replay_mode
&
REPLAY_MODE_SAVE_IN_SERVER
))
return
;
#endif
#ifdef _WIN32
DWORD
size
;
...
...
@@ -128,7 +128,7 @@ void Replay::WriteInt16(short data, bool flush) {
*
((
short
*
)(
pdata
))
=
data
;
pdata
+=
2
;
#ifdef YGOPRO_SERVER_MODE
if
(
!
(
replay_mode
&
0x1
))
return
;
if
(
!
(
replay_mode
&
REPLAY_MODE_SAVE_IN_SERVER
))
return
;
#endif
#ifdef _WIN32
DWORD
size
;
...
...
@@ -147,7 +147,7 @@ void Replay::WriteInt8(char data, bool flush) {
*
pdata
=
data
;
pdata
++
;
#ifdef YGOPRO_SERVER_MODE
if
(
!
(
replay_mode
&
0x1
))
return
;
if
(
!
(
replay_mode
&
REPLAY_MODE_SAVE_IN_SERVER
))
return
;
#endif
#ifdef _WIN32
DWORD
size
;
...
...
@@ -162,7 +162,7 @@ void Replay::Flush() {
if
(
!
is_recording
)
return
;
#ifdef YGOPRO_SERVER_MODE
if
(
!
(
replay_mode
&
0x1
))
return
;
if
(
!
(
replay_mode
&
REPLAY_MODE_SAVE_IN_SERVER
))
return
;
#endif
#ifdef _WIN32
#else
...
...
@@ -173,7 +173,7 @@ void Replay::EndRecord() {
if
(
!
is_recording
)
return
;
#ifdef YGOPRO_SERVER_MODE
if
(
replay_mode
&
0x1
)
{
if
(
replay_mode
&
REPLAY_MODE_SAVE_IN_SERVER
)
{
#endif
#ifdef _WIN32
CloseHandle
(
recording_fp
);
...
...
gframe/replay.h
View file @
06145170
...
...
@@ -17,6 +17,11 @@ namespace ygo {
#define MAX_REPLAY_SIZE 0x20000
#define MAX_COMP_SIZE 0x2000
#ifdef YGOPRO_SERVER_MODE
#define REPLAY_MODE_SAVE_IN_SERVER 0x1
#define REPLAY_MODE_WATCHER_NO_SEND 0x2
#endif // YGOPRO_SERVER_MODE
struct
ReplayHeader
{
unsigned
int
id
;
unsigned
int
version
;
...
...
gframe/single_duel.cpp
View file @
06145170
...
...
@@ -1814,7 +1814,7 @@ void SingleDuel::EndDuel() {
NetServer
::
SendBufferToPlayer
(
players
[
0
],
STOC_REPLAY
,
replaybuf
,
sizeof
(
ReplayHeader
)
+
last_replay
.
comp_size
);
NetServer
::
ReSendToPlayer
(
players
[
1
]);
#ifdef YGOPRO_SERVER_MODE
if
(
!
(
replay_mode
&
0x2
))
{
if
(
!
(
replay_mode
&
REPLAY_MODE_WATCHER_NO_SEND
))
{
for
(
auto
oit
=
observers
.
begin
();
oit
!=
observers
.
end
();
++
oit
)
NetServer
::
ReSendToPlayer
(
*
oit
);
NetServer
::
ReSendToPlayers
(
cache_recorder
,
replay_recorder
);
...
...
gframe/tag_duel.cpp
View file @
06145170
...
...
@@ -1905,7 +1905,7 @@ void TagDuel::EndDuel() {
NetServer
::
ReSendToPlayer
(
players
[
2
]);
NetServer
::
ReSendToPlayer
(
players
[
3
]);
#ifdef YGOPRO_SERVER_MODE
if
(
!
(
replay_mode
&
0x2
))
{
if
(
!
(
replay_mode
&
REPLAY_MODE_WATCHER_NO_SEND
))
{
for
(
auto
oit
=
observers
.
begin
();
oit
!=
observers
.
end
();
++
oit
)
NetServer
::
ReSendToPlayer
(
*
oit
);
NetServer
::
ReSendToPlayers
(
cache_recorder
,
replay_recorder
);
...
...
ocgcore
@
ac7997c0
Subproject commit
64c326410f815b48f5a42e78b59d4924c10f438a
Subproject commit
ac7997c0e493373c30f3485c136d4093e2f14ccd
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