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
3ce37cde
Commit
3ce37cde
authored
Jul 16, 2019
by
fallenstardust
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use standard mutex library
parent
0b80fb71
Changes
11
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
231 additions
and
289 deletions
+231
-289
Classes/gframe/client_field.cpp
Classes/gframe/client_field.cpp
+2
-2
Classes/gframe/config.h
Classes/gframe/config.h
+2
-2
Classes/gframe/deck_con.cpp
Classes/gframe/deck_con.cpp
+11
-11
Classes/gframe/duelclient.cpp
Classes/gframe/duelclient.cpp
+173
-173
Classes/gframe/game.cpp
Classes/gframe/game.cpp
+2
-2
Classes/gframe/game.h
Classes/gframe/game.h
+1
-3
Classes/gframe/menu_handler.cpp
Classes/gframe/menu_handler.cpp
+6
-6
Classes/gframe/mymutex.h
Classes/gframe/mymutex.h
+0
-56
Classes/gframe/replay_mode.cpp
Classes/gframe/replay_mode.cpp
+18
-18
Classes/gframe/single_mode.cpp
Classes/gframe/single_mode.cpp
+13
-13
libcore/jni/cn_garymb_ygomobile_core_IrrlichtBridge.cpp
libcore/jni/cn_garymb_ygomobile_core_IrrlichtBridge.cpp
+3
-3
No files found.
Classes/gframe/client_field.cpp
View file @
3ce37cde
...
@@ -601,7 +601,7 @@ void ClientField::ShowSelectOption(int select_hint) {
...
@@ -601,7 +601,7 @@ void ClientField::ShowSelectOption(int select_hint) {
wchar_t
textBuffer
[
256
];
wchar_t
textBuffer
[
256
];
int
count
=
select_options
.
size
();
int
count
=
select_options
.
size
();
bool
quickmode
=
true
;
bool
quickmode
=
true
;
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
for
(
auto
option
:
select_options
)
{
for
(
auto
option
:
select_options
)
{
if
(
mainGame
->
guiFont
->
getDimension
(
dataManager
.
GetDesc
(
option
)).
Width
>
310
*
mainGame
->
xScale
)
{
if
(
mainGame
->
guiFont
->
getDimension
(
dataManager
.
GetDesc
(
option
)).
Width
>
310
*
mainGame
->
xScale
)
{
quickmode
=
false
;
quickmode
=
false
;
...
@@ -649,7 +649,7 @@ void ClientField::ShowSelectOption(int select_hint) {
...
@@ -649,7 +649,7 @@ void ClientField::ShowSelectOption(int select_hint) {
myswprintf
(
textBuffer
,
dataManager
.
GetSysString
(
555
));
myswprintf
(
textBuffer
,
dataManager
.
GetSysString
(
555
));
mainGame
->
wOptions
->
setText
(
textBuffer
);
mainGame
->
wOptions
->
setText
(
textBuffer
);
mainGame
->
PopupElement
(
mainGame
->
wOptions
);
mainGame
->
PopupElement
(
mainGame
->
wOptions
);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
}
}
void
ClientField
::
ReplaySwap
()
{
void
ClientField
::
ReplaySwap
()
{
std
::
swap
(
deck
[
0
],
deck
[
1
]);
std
::
swap
(
deck
[
0
],
deck
[
1
]);
...
...
Classes/gframe/config.h
View file @
3ce37cde
...
@@ -85,10 +85,10 @@ inline int _wtoi(const wchar_t * s) {
...
@@ -85,10 +85,10 @@ inline int _wtoi(const wchar_t * s) {
#include <thread>
#include <thread>
#ifdef _IRR_ANDROID_PLATFORM_
#ifdef _IRR_ANDROID_PLATFORM_
#include <android/bufferio_android.h>
#include <android/bufferio_android.h>
#
else
#
include <mutex>
#include "bufferio.h"
#include "bufferio.h"
#endif
#endif
#include "my
mutex
.h"
#include "my
filesystem
.h"
#include "mysignal.h"
#include "mysignal.h"
#include "../ocgcore/ocgapi.h"
#include "../ocgcore/ocgapi.h"
#include "../ocgcore/common.h"
#include "../ocgcore/common.h"
...
...
Classes/gframe/deck_con.cpp
View file @
3ce37cde
...
@@ -139,10 +139,10 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
...
@@ -139,10 +139,10 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
switch
(
id
)
{
switch
(
id
)
{
case
BUTTON_CLEAR_DECK
:
{
case
BUTTON_CLEAR_DECK
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
mainGame
->
soundEffectPlayer
->
doPressButton
();
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
mainGame
->
SetStaticText
(
mainGame
->
stQMessage
,
370
,
mainGame
->
textFont
,
dataManager
.
GetSysString
(
1339
));
mainGame
->
SetStaticText
(
mainGame
->
stQMessage
,
370
,
mainGame
->
textFont
,
dataManager
.
GetSysString
(
1339
));
mainGame
->
PopupElement
(
mainGame
->
wQuery
);
mainGame
->
PopupElement
(
mainGame
->
wQuery
);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
prev_operation
=
id
;
prev_operation
=
id
;
break
;
break
;
}
}
...
@@ -198,11 +198,11 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
...
@@ -198,11 +198,11 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
int
sel
=
mainGame
->
cbDBDecks
->
getSelected
();
int
sel
=
mainGame
->
cbDBDecks
->
getSelected
();
if
(
sel
==
-
1
)
if
(
sel
==
-
1
)
break
;
break
;
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
mainGame
->
wRenameDeck
->
setText
(
dataManager
.
GetSysString
(
1362
));
mainGame
->
wRenameDeck
->
setText
(
dataManager
.
GetSysString
(
1362
));
mainGame
->
ebREName
->
setText
(
mainGame
->
cbDBDecks
->
getItem
(
sel
));
mainGame
->
ebREName
->
setText
(
mainGame
->
cbDBDecks
->
getItem
(
sel
));
mainGame
->
PopupElement
(
mainGame
->
wRenameDeck
);
mainGame
->
PopupElement
(
mainGame
->
wRenameDeck
);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
prev_operation
=
id
;
prev_operation
=
id
;
prev_sel
=
sel
;
prev_sel
=
sel
;
break
;
break
;
...
@@ -240,12 +240,12 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
...
@@ -240,12 +240,12 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
int
sel
=
mainGame
->
cbDBDecks
->
getSelected
();
int
sel
=
mainGame
->
cbDBDecks
->
getSelected
();
if
(
sel
==
-
1
)
if
(
sel
==
-
1
)
break
;
break
;
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
wchar_t
textBuffer
[
256
];
wchar_t
textBuffer
[
256
];
myswprintf
(
textBuffer
,
L"%ls
\n
%ls"
,
mainGame
->
cbDBDecks
->
getItem
(
sel
),
dataManager
.
GetSysString
(
1337
));
myswprintf
(
textBuffer
,
L"%ls
\n
%ls"
,
mainGame
->
cbDBDecks
->
getItem
(
sel
),
dataManager
.
GetSysString
(
1337
));
mainGame
->
SetStaticText
(
mainGame
->
stQMessage
,
370
*
mainGame
->
xScale
,
mainGame
->
textFont
,
textBuffer
);
mainGame
->
SetStaticText
(
mainGame
->
stQMessage
,
370
*
mainGame
->
xScale
,
mainGame
->
textFont
,
textBuffer
);
mainGame
->
PopupElement
(
mainGame
->
wQuery
);
mainGame
->
PopupElement
(
mainGame
->
wQuery
);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
prev_operation
=
id
;
prev_operation
=
id
;
prev_sel
=
sel
;
prev_sel
=
sel
;
mainGame
->
soundEffectPlayer
->
doDelete
();
mainGame
->
soundEffectPlayer
->
doDelete
();
...
@@ -253,10 +253,10 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
...
@@ -253,10 +253,10 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
}
}
case
BUTTON_LEAVE_GAME
:
{
case
BUTTON_LEAVE_GAME
:
{
if
(
is_modified
&&
!
mainGame
->
chkIgnoreDeckChanges
->
isChecked
())
{
if
(
is_modified
&&
!
mainGame
->
chkIgnoreDeckChanges
->
isChecked
())
{
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
mainGame
->
SetStaticText
(
mainGame
->
stQMessage
,
3
70
*
mainGame
->
xScale
,
mainGame
->
text
Font
,
dataManager
.
GetSysString
(
1356
));
mainGame
->
SetStaticText
(
mainGame
->
stQMessage
,
3
10
,
mainGame
->
gui
Font
,
dataManager
.
GetSysString
(
1356
));
mainGame
->
PopupElement
(
mainGame
->
wQuery
);
mainGame
->
PopupElement
(
mainGame
->
wQuery
);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
prev_operation
=
id
;
prev_operation
=
id
;
break
;
break
;
}
}
...
@@ -432,10 +432,10 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
...
@@ -432,10 +432,10 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
}
}
case
COMBOBOX_DBDECKS
:
{
case
COMBOBOX_DBDECKS
:
{
if
(
is_modified
&&
!
mainGame
->
chkIgnoreDeckChanges
->
isChecked
())
{
if
(
is_modified
&&
!
mainGame
->
chkIgnoreDeckChanges
->
isChecked
())
{
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
mainGame
->
SetStaticText
(
mainGame
->
stQMessage
,
370
*
mainGame
->
xScale
,
mainGame
->
textFont
,
dataManager
.
GetSysString
(
1356
));
mainGame
->
SetStaticText
(
mainGame
->
stQMessage
,
370
*
mainGame
->
xScale
,
mainGame
->
textFont
,
dataManager
.
GetSysString
(
1356
));
mainGame
->
PopupElement
(
mainGame
->
wQuery
);
mainGame
->
PopupElement
(
mainGame
->
wQuery
);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
prev_operation
=
id
;
prev_operation
=
id
;
break
;
break
;
}
}
...
...
Classes/gframe/duelclient.cpp
View file @
3ce37cde
This diff is collapsed.
Click to expand it.
Classes/gframe/game.cpp
View file @
3ce37cde
...
@@ -1045,7 +1045,7 @@ void Game::MainLoop() {
...
@@ -1045,7 +1045,7 @@ void Game::MainLoop() {
}
}
driver
->
enableMaterial2D
(
false
);
driver
->
enableMaterial2D
(
false
);
#endif
#endif
gMutex
.
L
ock
();
gMutex
.
l
ock
();
if
(
dInfo
.
isStarted
)
{
if
(
dInfo
.
isStarted
)
{
DrawBackImage
(
imageManager
.
tBackGround
);
DrawBackImage
(
imageManager
.
tBackGround
);
DrawBackGround
();
DrawBackGround
();
...
@@ -1074,7 +1074,7 @@ void Game::MainLoop() {
...
@@ -1074,7 +1074,7 @@ void Game::MainLoop() {
DrawGUI
();
DrawGUI
();
DrawSpec
();
DrawSpec
();
#endif
#endif
gMutex
.
U
nlock
();
gMutex
.
u
nlock
();
if
(
signalFrame
>
0
)
{
if
(
signalFrame
>
0
)
{
signalFrame
--
;
signalFrame
--
;
if
(
!
signalFrame
)
if
(
!
signalFrame
)
...
...
Classes/gframe/game.h
View file @
3ce37cde
...
@@ -163,9 +163,7 @@ public:
...
@@ -163,9 +163,7 @@ public:
return
focus
&&
focus
->
hasType
(
type
);
return
focus
&&
focus
->
hasType
(
type
);
}
}
// don't merge
// don't merge
std
::
mutex
gMutex
;
Mutex
gMutex
;
Mutex
gBuffer
;
Signal
frameSignal
;
Signal
frameSignal
;
Signal
actionSignal
;
Signal
actionSignal
;
Signal
replaySignal
;
Signal
replaySignal
;
...
...
Classes/gframe/menu_handler.cpp
View file @
3ce37cde
...
@@ -90,9 +90,9 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
...
@@ -90,9 +90,9 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
hints
.
ai_flags
=
EVUTIL_AI_ADDRCONFIG
;
hints
.
ai_flags
=
EVUTIL_AI_ADDRCONFIG
;
int
status
=
evutil_getaddrinfo
(
hostname
,
port
,
&
hints
,
&
answer
);
int
status
=
evutil_getaddrinfo
(
hostname
,
port
,
&
hints
,
&
answer
);
if
(
status
!=
0
)
{
if
(
status
!=
0
)
{
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
mainGame
->
env
->
addMessageBox
(
L""
,
dataManager
.
GetSysString
(
1412
));
mainGame
->
env
->
addMessageBox
(
L""
,
dataManager
.
GetSysString
(
1412
));
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
break
;
break
;
}
else
{
}
else
{
sockaddr_in
*
sin
=
((
struct
sockaddr_in
*
)
answer
->
ai_addr
);
sockaddr_in
*
sin
=
((
struct
sockaddr_in
*
)
answer
->
ai_addr
);
...
@@ -266,12 +266,12 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
...
@@ -266,12 +266,12 @@ 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
;
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
wchar_t
textBuffer
[
256
];
wchar_t
textBuffer
[
256
];
myswprintf
(
textBuffer
,
L"%ls
\n
%ls"
,
mainGame
->
lstReplayList
->
getListItem
(
sel
),
dataManager
.
GetSysString
(
1363
));
myswprintf
(
textBuffer
,
L"%ls
\n
%ls"
,
mainGame
->
lstReplayList
->
getListItem
(
sel
),
dataManager
.
GetSysString
(
1363
));
mainGame
->
SetStaticText
(
mainGame
->
stQMessage
,
370
*
mainGame
->
xScale
,
mainGame
->
textFont
,
textBuffer
);
mainGame
->
SetStaticText
(
mainGame
->
stQMessage
,
370
*
mainGame
->
xScale
,
mainGame
->
textFont
,
textBuffer
);
mainGame
->
PopupElement
(
mainGame
->
wQuery
);
mainGame
->
PopupElement
(
mainGame
->
wQuery
);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
prev_operation
=
id
;
prev_operation
=
id
;
prev_sel
=
sel
;
prev_sel
=
sel
;
break
;
break
;
...
@@ -280,11 +280,11 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
...
@@ -280,11 +280,11 @@ 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
;
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
mainGame
->
wReplaySave
->
setText
(
dataManager
.
GetSysString
(
1364
));
mainGame
->
wReplaySave
->
setText
(
dataManager
.
GetSysString
(
1364
));
mainGame
->
ebRSName
->
setText
(
mainGame
->
lstReplayList
->
getListItem
(
sel
));
mainGame
->
ebRSName
->
setText
(
mainGame
->
lstReplayList
->
getListItem
(
sel
));
mainGame
->
PopupElement
(
mainGame
->
wReplaySave
);
mainGame
->
PopupElement
(
mainGame
->
wReplaySave
);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
prev_operation
=
id
;
prev_operation
=
id
;
prev_sel
=
sel
;
prev_sel
=
sel
;
break
;
break
;
...
...
Classes/gframe/mymutex.h
deleted
100644 → 0
View file @
0b80fb71
#ifndef MUTEX_H
#define MUTEX_H
#ifdef _WIN32
#include <windows.h>
class
Mutex
{
public:
Mutex
()
{
InitializeCriticalSection
(
&
_mutex
);
}
~
Mutex
()
{
DeleteCriticalSection
(
&
_mutex
);
}
void
Lock
()
{
EnterCriticalSection
(
&
_mutex
);
}
void
Unlock
()
{
LeaveCriticalSection
(
&
_mutex
);
}
bool
TryLock
()
{
return
TryEnterCriticalSection
(
&
_mutex
)
==
TRUE
;
}
private:
CRITICAL_SECTION
_mutex
;
};
#else // _WIN32
#include <pthread.h>
class
Mutex
{
public:
Mutex
()
{
pthread_mutex_init
(
&
mutex_t
,
NULL
);
}
~
Mutex
()
{
pthread_mutex_destroy
(
&
mutex_t
);
}
void
Lock
()
{
pthread_mutex_lock
(
&
mutex_t
);
}
void
Unlock
()
{
pthread_mutex_unlock
(
&
mutex_t
);
}
bool
TryLock
()
{
return
!
pthread_mutex_trylock
(
&
mutex_t
);
}
private:
pthread_mutex_t
mutex_t
;
};
#endif // _WIN32
#endif // MUTEX_H
Classes/gframe/replay_mode.cpp
View file @
3ce37cde
...
@@ -90,7 +90,7 @@ int ReplayMode::ReplayThread() {
...
@@ -90,7 +90,7 @@ int ReplayMode::ReplayThread() {
exit_pending
=
false
;
exit_pending
=
false
;
current_step
=
0
;
current_step
=
0
;
if
(
mainGame
->
dInfo
.
isReplaySkiping
)
if
(
mainGame
->
dInfo
.
isReplaySkiping
)
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
while
(
is_continuing
&&
!
exit_pending
)
{
while
(
is_continuing
&&
!
exit_pending
)
{
int
result
=
process
(
pduel
);
int
result
=
process
(
pduel
);
int
len
=
result
&
0xffff
;
int
len
=
result
&
0xffff
;
...
@@ -99,7 +99,7 @@ int ReplayMode::ReplayThread() {
...
@@ -99,7 +99,7 @@ int ReplayMode::ReplayThread() {
get_message
(
pduel
,
(
byte
*
)
engineBuffer
);
get_message
(
pduel
,
(
byte
*
)
engineBuffer
);
is_continuing
=
ReplayAnalyze
(
engineBuffer
,
len
);
is_continuing
=
ReplayAnalyze
(
engineBuffer
,
len
);
if
(
is_restarting
)
{
if
(
is_restarting
)
{
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
is_restarting
=
false
;
is_restarting
=
false
;
mainGame
->
dInfo
.
isReplaySkiping
=
true
;
mainGame
->
dInfo
.
isReplaySkiping
=
true
;
Restart
(
false
);
Restart
(
false
);
...
@@ -125,7 +125,7 @@ int ReplayMode::ReplayThread() {
...
@@ -125,7 +125,7 @@ int ReplayMode::ReplayThread() {
mainGame
->
dInfo
.
isFinished
=
false
;
mainGame
->
dInfo
.
isFinished
=
false
;
mainGame
->
dInfo
.
isReplaySkiping
=
false
;
mainGame
->
dInfo
.
isReplaySkiping
=
false
;
mainGame
->
dField
.
RefreshAllCards
();
mainGame
->
dField
.
RefreshAllCards
();
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
}
}
skip_step
=
step
;
skip_step
=
step
;
current_step
=
0
;
current_step
=
0
;
...
@@ -135,7 +135,7 @@ int ReplayMode::ReplayThread() {
...
@@ -135,7 +135,7 @@ int ReplayMode::ReplayThread() {
if
(
mainGame
->
dInfo
.
isReplaySkiping
)
{
if
(
mainGame
->
dInfo
.
isReplaySkiping
)
{
mainGame
->
dInfo
.
isReplaySkiping
=
false
;
mainGame
->
dInfo
.
isReplaySkiping
=
false
;
mainGame
->
dField
.
RefreshAllCards
();
mainGame
->
dField
.
RefreshAllCards
();
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
}
}
EndDuel
();
EndDuel
();
return
0
;
return
0
;
...
@@ -228,26 +228,26 @@ void ReplayMode::EndDuel() {
...
@@ -228,26 +228,26 @@ void ReplayMode::EndDuel() {
end_duel
(
pduel
);
end_duel
(
pduel
);
if
(
!
is_closing
)
{
if
(
!
is_closing
)
{
mainGame
->
actionSignal
.
Reset
();
mainGame
->
actionSignal
.
Reset
();
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
mainGame
->
stMessage
->
setText
(
dataManager
.
GetSysString
(
1501
));
mainGame
->
stMessage
->
setText
(
dataManager
.
GetSysString
(
1501
));
if
(
mainGame
->
wCardSelect
->
isVisible
())
if
(
mainGame
->
wCardSelect
->
isVisible
())
mainGame
->
HideElement
(
mainGame
->
wCardSelect
);
mainGame
->
HideElement
(
mainGame
->
wCardSelect
);
mainGame
->
PopupElement
(
mainGame
->
wMessage
);
mainGame
->
PopupElement
(
mainGame
->
wMessage
);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
mainGame
->
actionSignal
.
Wait
();
mainGame
->
actionSignal
.
Wait
();
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
mainGame
->
dInfo
.
isStarted
=
false
;
mainGame
->
dInfo
.
isStarted
=
false
;
mainGame
->
dInfo
.
isFinished
=
true
;
mainGame
->
dInfo
.
isFinished
=
true
;
mainGame
->
dInfo
.
isReplay
=
false
;
mainGame
->
dInfo
.
isReplay
=
false
;
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
mainGame
->
closeDoneSignal
.
Reset
();
mainGame
->
closeDoneSignal
.
Reset
();
mainGame
->
closeSignal
.
Set
();
mainGame
->
closeSignal
.
Set
();
mainGame
->
closeDoneSignal
.
Wait
();
mainGame
->
closeDoneSignal
.
Wait
();
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
mainGame
->
ShowElement
(
mainGame
->
wReplay
);
mainGame
->
ShowElement
(
mainGame
->
wReplay
);
mainGame
->
stTip
->
setVisible
(
false
);
mainGame
->
stTip
->
setVisible
(
false
);
mainGame
->
device
->
setEventReceiver
(
&
mainGame
->
menuHandler
);
mainGame
->
device
->
setEventReceiver
(
&
mainGame
->
menuHandler
);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
if
(
exit_on_return
)
if
(
exit_on_return
)
mainGame
->
device
->
closeDevice
();
mainGame
->
device
->
closeDevice
();
}
}
...
@@ -291,9 +291,9 @@ bool ReplayMode::ReplayAnalyze(char* msg, unsigned int len) {
...
@@ -291,9 +291,9 @@ bool ReplayMode::ReplayAnalyze(char* msg, unsigned int len) {
return
true
;
return
true
;
}
}
if
(
is_swaping
)
{
if
(
is_swaping
)
{
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
mainGame
->
dField
.
ReplaySwap
();
mainGame
->
dField
.
ReplaySwap
();
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
is_swaping
=
false
;
is_swaping
=
false
;
}
}
char
*
offset
=
pbuf
;
char
*
offset
=
pbuf
;
...
@@ -304,12 +304,12 @@ bool ReplayMode::ReplayAnalyze(char* msg, unsigned int len) {
...
@@ -304,12 +304,12 @@ bool ReplayMode::ReplayAnalyze(char* msg, unsigned int len) {
if
(
mainGame
->
dInfo
.
isReplaySkiping
)
{
if
(
mainGame
->
dInfo
.
isReplaySkiping
)
{
mainGame
->
dInfo
.
isReplaySkiping
=
false
;
mainGame
->
dInfo
.
isReplaySkiping
=
false
;
mainGame
->
dField
.
RefreshAllCards
();
mainGame
->
dField
.
RefreshAllCards
();
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
}
}
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
mainGame
->
stMessage
->
setText
(
L"Error occurs."
);
mainGame
->
stMessage
->
setText
(
L"Error occurs."
);
mainGame
->
PopupElement
(
mainGame
->
wMessage
);
mainGame
->
PopupElement
(
mainGame
->
wMessage
);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
mainGame
->
actionSignal
.
Reset
();
mainGame
->
actionSignal
.
Reset
();
mainGame
->
actionSignal
.
Wait
();
mainGame
->
actionSignal
.
Wait
();
return
false
;
return
false
;
...
@@ -323,7 +323,7 @@ bool ReplayMode::ReplayAnalyze(char* msg, unsigned int len) {
...
@@ -323,7 +323,7 @@ bool ReplayMode::ReplayAnalyze(char* msg, unsigned int len) {
if
(
mainGame
->
dInfo
.
isReplaySkiping
)
{
if
(
mainGame
->
dInfo
.
isReplaySkiping
)
{
mainGame
->
dInfo
.
isReplaySkiping
=
false
;
mainGame
->
dInfo
.
isReplaySkiping
=
false
;
mainGame
->
dField
.
RefreshAllCards
();
mainGame
->
dField
.
RefreshAllCards
();
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
}
}
pbuf
+=
2
;
pbuf
+=
2
;
DuelClient
::
ClientAnalyze
(
offset
,
pbuf
-
offset
);
DuelClient
::
ClientAnalyze
(
offset
,
pbuf
-
offset
);
...
@@ -505,7 +505,7 @@ bool ReplayMode::ReplayAnalyze(char* msg, unsigned int len) {
...
@@ -505,7 +505,7 @@ bool ReplayMode::ReplayAnalyze(char* msg, unsigned int len) {
if
(
skip_turn
==
0
)
{
if
(
skip_turn
==
0
)
{
mainGame
->
dInfo
.
isReplaySkiping
=
false
;
mainGame
->
dInfo
.
isReplaySkiping
=
false
;
mainGame
->
dField
.
RefreshAllCards
();
mainGame
->
dField
.
RefreshAllCards
();
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
}
}
}
}
player
=
BufferIO
::
ReadInt8
(
pbuf
);
player
=
BufferIO
::
ReadInt8
(
pbuf
);
...
@@ -842,7 +842,7 @@ bool ReplayMode::ReplayAnalyze(char* msg, unsigned int len) {
...
@@ -842,7 +842,7 @@ bool ReplayMode::ReplayAnalyze(char* msg, unsigned int len) {
mainGame
->
dInfo
.
isFinished
=
false
;
mainGame
->
dInfo
.
isFinished
=
false
;
mainGame
->
dInfo
.
isReplaySkiping
=
false
;
mainGame
->
dInfo
.
isReplaySkiping
=
false
;
mainGame
->
dField
.
RefreshAllCards
();
mainGame
->
dField
.
RefreshAllCards
();
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
}
}
}
}
if
(
is_pausing
)
{
if
(
is_pausing
)
{
...
...
Classes/gframe/single_mode.cpp
View file @
3ce37cde
...
@@ -67,7 +67,7 @@ int SingleMode::SinglePlayThread() {
...
@@ -67,7 +67,7 @@ int SingleMode::SinglePlayThread() {
rh
.
version
=
PRO_VERSION
;
rh
.
version
=
PRO_VERSION
;
rh
.
flag
=
REPLAY_SINGLE_MODE
;
rh
.
flag
=
REPLAY_SINGLE_MODE
;
rh
.
seed
=
seed
;
rh
.
seed
=
seed
;
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
mainGame
->
HideElement
(
mainGame
->
wSinglePlay
);
mainGame
->
HideElement
(
mainGame
->
wSinglePlay
);
mainGame
->
ClearCardInfo
();
mainGame
->
ClearCardInfo
();
mainGame
->
wCardImg
->
setVisible
(
true
);
mainGame
->
wCardImg
->
setVisible
(
true
);
...
@@ -81,7 +81,7 @@ int SingleMode::SinglePlayThread() {
...
@@ -81,7 +81,7 @@ int SingleMode::SinglePlayThread() {
mainGame
->
dInfo
.
isFinished
=
false
;
mainGame
->
dInfo
.
isFinished
=
false
;
mainGame
->
dInfo
.
isSingleMode
=
true
;
mainGame
->
dInfo
.
isSingleMode
=
true
;
mainGame
->
device
->
setEventReceiver
(
&
mainGame
->
dField
);
mainGame
->
device
->
setEventReceiver
(
&
mainGame
->
dField
);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
char
engineBuffer
[
0x1000
];
char
engineBuffer
[
0x1000
];
is_closing
=
false
;
is_closing
=
false
;
is_continuing
=
true
;
is_continuing
=
true
;
...
@@ -113,7 +113,7 @@ int SingleMode::SinglePlayThread() {
...
@@ -113,7 +113,7 @@ int SingleMode::SinglePlayThread() {
}
}
}
}
last_replay
.
EndRecord
();
last_replay
.
EndRecord
();
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
time_t
nowtime
=
time
(
NULL
);
time_t
nowtime
=
time
(
NULL
);
tm
*
localedtime
=
localtime
(
&
nowtime
);
tm
*
localedtime
=
localtime
(
&
nowtime
);
wchar_t
timetext
[
40
];
wchar_t
timetext
[
40
];
...
@@ -122,7 +122,7 @@ int SingleMode::SinglePlayThread() {
...
@@ -122,7 +122,7 @@ int SingleMode::SinglePlayThread() {
if
(
!
mainGame
->
chkAutoSaveReplay
->
isChecked
())
{
if
(
!
mainGame
->
chkAutoSaveReplay
->
isChecked
())
{
mainGame
->
wReplaySave
->
setText
(
dataManager
.
GetSysString
(
1340
));
mainGame
->
wReplaySave
->
setText
(
dataManager
.
GetSysString
(
1340
));
mainGame
->
PopupElement
(
mainGame
->
wReplaySave
);
mainGame
->
PopupElement
(
mainGame
->
wReplaySave
);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
mainGame
->
replaySignal
.
Reset
();
mainGame
->
replaySignal
.
Reset
();
mainGame
->
replaySignal
.
Wait
();
mainGame
->
replaySignal
.
Wait
();
}
else
{
}
else
{
...
@@ -131,26 +131,26 @@ int SingleMode::SinglePlayThread() {
...
@@ -131,26 +131,26 @@ int SingleMode::SinglePlayThread() {
myswprintf
(
msgbuf
,
dataManager
.
GetSysString
(
1367
),
timetext
);
myswprintf
(
msgbuf
,
dataManager
.
GetSysString
(
1367
),
timetext
);
mainGame
->
SetStaticText
(
mainGame
->
stACMessage
,
310
,
mainGame
->
guiFont
,
msgbuf
);
mainGame
->
SetStaticText
(
mainGame
->
stACMessage
,
310
,
mainGame
->
guiFont
,
msgbuf
);
mainGame
->
PopupElement
(
mainGame
->
wACMessage
,
20
);
mainGame
->
PopupElement
(
mainGame
->
wACMessage
,
20
);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
mainGame
->
WaitFrameSignal
(
30
);
mainGame
->
WaitFrameSignal
(
30
);
}
}
if
(
mainGame
->
actionParam
)
if
(
mainGame
->
actionParam
)
last_replay
.
SaveReplay
(
mainGame
->
ebRSName
->
getText
());
last_replay
.
SaveReplay
(
mainGame
->
ebRSName
->
getText
());
end_duel
(
pduel
);
end_duel
(
pduel
);
if
(
!
is_closing
)
{
if
(
!
is_closing
)
{
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
mainGame
->
dInfo
.
isStarted
=
false
;
mainGame
->
dInfo
.
isStarted
=
false
;
mainGame
->
dInfo
.
isFinished
=
true
;
mainGame
->
dInfo
.
isFinished
=
true
;
mainGame
->
dInfo
.
isSingleMode
=
false
;
mainGame
->
dInfo
.
isSingleMode
=
false
;
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
mainGame
->
closeDoneSignal
.
Reset
();
mainGame
->
closeDoneSignal
.
Reset
();
mainGame
->
closeSignal
.
Set
();
mainGame
->
closeSignal
.
Set
();
mainGame
->
closeDoneSignal
.
Wait
();
mainGame
->
closeDoneSignal
.
Wait
();
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
mainGame
->
ShowElement
(
mainGame
->
wSinglePlay
);
mainGame
->
ShowElement
(
mainGame
->
wSinglePlay
);
mainGame
->
stTip
->
setVisible
(
false
);
mainGame
->
stTip
->
setVisible
(
false
);
mainGame
->
device
->
setEventReceiver
(
&
mainGame
->
menuHandler
);
mainGame
->
device
->
setEventReceiver
(
&
mainGame
->
menuHandler
);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
mainGame
->
SaveConfig
();
mainGame
->
SaveConfig
();
if
(
exit_on_return
)
if
(
exit_on_return
)
mainGame
->
device
->
closeDevice
();
mainGame
->
device
->
closeDevice
();
...
@@ -721,9 +721,9 @@ bool SingleMode::SinglePlayAnalyze(char* msg, unsigned int len) {
...
@@ -721,9 +721,9 @@ bool SingleMode::SinglePlayAnalyze(char* msg, unsigned int len) {
pbuf
++
;
pbuf
++
;
DuelClient
::
ClientAnalyze
(
offset
,
pbuf
-
offset
);
DuelClient
::
ClientAnalyze
(
offset
,
pbuf
-
offset
);
SinglePlayReload
();
SinglePlayReload
();
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
mainGame
->
dField
.
RefreshAllCards
();
mainGame
->
dField
.
RefreshAllCards
();
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
break
;
break
;
}
}
case
MSG_AI_NAME
:
{
case
MSG_AI_NAME
:
{
...
@@ -745,10 +745,10 @@ bool SingleMode::SinglePlayAnalyze(char* msg, unsigned int len) {
...
@@ -745,10 +745,10 @@ bool SingleMode::SinglePlayAnalyze(char* msg, unsigned int len) {
pbuf
+=
len
+
1
;
pbuf
+=
len
+
1
;
memcpy
(
msgbuf
,
begin
,
len
+
1
);
memcpy
(
msgbuf
,
begin
,
len
+
1
);
BufferIO
::
DecodeUTF8
(
msgbuf
,
msg
);
BufferIO
::
DecodeUTF8
(
msgbuf
,
msg
);
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
mainGame
->
SetStaticText
(
mainGame
->
stMessage
,
310
*
mainGame
->
xScale
,
mainGame
->
textFont
,
msg
);
mainGame
->
SetStaticText
(
mainGame
->
stMessage
,
310
*
mainGame
->
xScale
,
mainGame
->
textFont
,
msg
);
mainGame
->
PopupElement
(
mainGame
->
wMessage
);
mainGame
->
PopupElement
(
mainGame
->
wMessage
);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
mainGame
->
actionSignal
.
Reset
();
mainGame
->
actionSignal
.
Reset
();
mainGame
->
actionSignal
.
Wait
();
mainGame
->
actionSignal
.
Wait
();
break
;
break
;
...
...
libcore/jni/cn_garymb_ygomobile_core_IrrlichtBridge.cpp
View file @
3ce37cde
...
@@ -179,9 +179,9 @@ JNIEXPORT jbyteArray JNICALL Java_cn_garymb_ygomobile_core_IrrlichtBridge_native
...
@@ -179,9 +179,9 @@ JNIEXPORT jbyteArray JNICALL Java_cn_garymb_ygomobile_core_IrrlichtBridge_native
static
void
*
join_game_thread
(
void
*
param
)
{
static
void
*
join_game_thread
(
void
*
param
)
{
ygo
::
mainGame
->
externalSignal
.
Wait
();
ygo
::
mainGame
->
externalSignal
.
Wait
();
ygo
::
mainGame
->
gMutex
.
L
ock
();
ygo
::
mainGame
->
gMutex
.
l
ock
();
if
(
ygo
::
mainGame
->
dInfo
.
isStarted
)
{
if
(
ygo
::
mainGame
->
dInfo
.
isStarted
)
{
ygo
::
mainGame
->
gMutex
.
U
nlock
();
ygo
::
mainGame
->
gMutex
.
u
nlock
();
return
NULL
;
return
NULL
;
}
}
irr
::
android
::
YGOGameOptions
options
=
irr
::
android
::
YGOGameOptions
(
param
);
irr
::
android
::
YGOGameOptions
options
=
irr
::
android
::
YGOGameOptions
(
param
);
...
@@ -219,7 +219,7 @@ static void* join_game_thread(void* param) {
...
@@ -219,7 +219,7 @@ static void* join_game_thread(void* param) {
event
.
GUIEvent
.
Caller
=
ygo
::
mainGame
->
btnJoinHost
;
event
.
GUIEvent
.
Caller
=
ygo
::
mainGame
->
btnJoinHost
;
ygo
::
mainGame
->
device
->
postEventFromUser
(
event
);
ygo
::
mainGame
->
device
->
postEventFromUser
(
event
);
// }
// }
exit:
ygo
::
mainGame
->
gMutex
.
U
nlock
();
exit:
ygo
::
mainGame
->
gMutex
.
u
nlock
();
free
(
param
);
free
(
param
);
return
NULL
;
return
NULL
;
...
...
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