Skip to content

Commit

Permalink
Pass game file version verification information to gpgnet4ta
Browse files Browse the repository at this point in the history
  • Loading branch information
Axle1975 committed Jan 13, 2024
1 parent d5814d3 commit 149ede7
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 1 deletion.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version=unspecified
javafxPlatform=unspecified
faf_ice_adapter_version=3.2.2
faf_uid_version=4.0.4
gpgnet4ta_version=v2024.01.12
gpgnet4ta_version=v2024.01.13
taftoolbox_version=2023.10.21
javassist.version=3.28.0-GA
coverallsGradlePluginVersion=2.10.1
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.faforever.client.preferences.MaxPacketSizeOption;
import com.faforever.client.preferences.PreferencesService;
import com.faforever.client.preferences.TotalAnnihilationPrefs;
import com.faforever.client.update.ClientConfiguration;
import lombok.RequiredArgsConstructor;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
Expand Down Expand Up @@ -121,6 +122,19 @@ private List<String> getGpgNet4TaCommand(
"--maxpacketsize", String.valueOf(maxPacketSize)
));

try {
preferencesService.getRemotePreferences().getGameFilesWhitelist().stream()
.filter(entry -> entry.getModTechnical().equals(gameMod))
.filter(entry -> entry.getWhitelist() != null)
.findFirst()
.ifPresent(entry -> {
command.add("--verify");
command.add(entry.getWhitelist());
});
} catch (IOException e) {
logger.error("[getGpgNet4TaCommand] Unable to get remote preferences! Not setting any game files whitelists ...");
}

if (isRated) {
command.add("--israted");
}
Expand Down
10 changes: 10 additions & 0 deletions src/main/java/com/faforever/client/game/GameService.java
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@
import static com.faforever.client.fa.MapTool.MAP_DETAIL_COLUMN_ARCHIVE;
import static com.faforever.client.fa.MapTool.MAP_DETAIL_COLUMN_CRC;
import static com.faforever.client.fa.MapTool.MAP_DETAIL_COLUMN_NAME;
import static com.faforever.client.leaderboard.LeaderboardService.DEFAULT_RATING_TYPE;
import static com.github.nocatch.NoCatch.noCatch;
import static java.util.Arrays.asList;
import static java.util.concurrent.CompletableFuture.completedFuture;
Expand Down Expand Up @@ -1218,6 +1219,15 @@ private void onGameInfo(GameInfoMessage gameInfoMessage) {
final boolean isGameCurrentGame = Objects.equals(currentGame.get(), game) ||
Objects.equals(getRunningGameUid(), game.getId());

if (isGameCurrentGame) {
if (DEFAULT_RATING_TYPE.equals(game.getRatingType())) {
this.totalAnnihilationService.sendToConsole("/disable_game_file_version_verify");
}
else if (game.getRatingType() != null){
this.totalAnnihilationService.sendToConsole("/enable_game_file_version_verify");
}
}

if (GameStatus.ENDED == game.getStatus()) {
removeGame(gameInfoMessage);
if (currentPlayerOptional.isEmpty() || !isGameCurrentGame) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ public class ClientConfiguration {
List<Integer> recommendedMaps;
List<Endpoints> endpoints;
GitHubRepo gitHubRepo;
List<GameFilesWhitelistEntry> gameFilesWhitelist;

@Data
public static class GameFilesWhitelistEntry {
String modTechnical;
String whitelist; // eg "tdraw.dll:c42d5a5c,ca919ee7;totala.exe:deadbeef"
}

@Data
public static class GitHubRepo {
Expand Down

0 comments on commit 149ede7

Please sign in to comment.