@@ -24,15 +24,30 @@ private static bool CheckSignatures(Action<int, BaseEventData> action, int id, B
2424 return true ;
2525 }
2626
27- string signature = string . Empty ;
27+ string stateChecksum = string . Empty ;
2828 try
2929 {
30- signature = File . ReadAllText ( Path . Combine ( Application . persistentDataPath , $ "{ gameId } .signatures") ) ;
30+ Plugin . logger . LogInfo ( $ "Getting checksum for state { gameId } ") ;
31+ stateChecksum = File . ReadAllText ( Path . Combine ( Application . persistentDataPath , $ "{ gameId } .signatures") ) ;
32+ Plugin . logger . LogInfo ( $ "Checksum found.") ;
3133 }
32- catch { }
33- if ( signature == string . Empty ) return true ;
34- if ( Plugin . config . debug ) return true ;
35- if ( checksum != signature )
34+ catch
35+ {
36+ Plugin . logger . LogInfo ( $ "Failed to get checksum.") ;
37+ }
38+ if ( stateChecksum == string . Empty )
39+ {
40+ Plugin . logger . LogInfo ( $ "State checksum is empty, ignoring.") ;
41+ return true ;
42+ }
43+ bool doChecksumsMatch = stateChecksum == checksum ;
44+ Plugin . logger . LogInfo ( $ "State checksum: '{ stateChecksum } ', global checksum: '{ checksum } ', comparison result : { doChecksumsMatch } ") ;
45+ if ( Plugin . config . debug )
46+ {
47+ Plugin . logger . LogInfo ( $ "Debug detected, ignoring.") ;
48+ return true ;
49+ }
50+ if ( ! doChecksumsMatch )
3651 {
3752 PopupManager . GetBasicPopup ( new (
3853 Localization . Get ( "polymod.signature.mismatch" ) ,
@@ -135,9 +150,9 @@ private static void GameManager_MatchEnded(bool localPlayerIsWinner, ScoreDetail
135150 [ HarmonyPatch ( typeof ( ClientBase ) , nameof ( ClientBase . CreateSession ) , typeof ( GameSettings ) , typeof ( Il2CppSystem . Guid ) ) ]
136151 private static void ClientBase_CreateSession ( GameSettings settings , Il2CppSystem . Guid gameId )
137152 {
138- File . WriteAllLinesAsync (
153+ File . WriteAllTextAsync (
139154 Path . Combine ( Application . persistentDataPath , $ "{ gameId } .signatures") ,
140- new string [ ] { checksum }
155+ checksum
141156 ) ;
142157 }
143158
0 commit comments