Task 807: .WITNESS_CAMPAIGN File Format
Task 807: .WITNESS_CAMPAIGN File Format
File Format Specifications for .WITNESS_CAMPAIGN
The .WITNESS_CAMPAIGN file format is a proprietary binary save file used by the game The Witness, developed by Thekla, Inc. It stores player progress, including solved puzzles, environmental discoveries, obelisk completions, and other game state data. Detailed internal specifications, such as header structures or data encoding, are not publicly documented, as the format is not intended for external use or modification. Information about the format is derived from community discussions and game behavior observations, indicating that these files are paired with corresponding .png screenshots for load menu thumbnails and are typically several hundred kilobytes in size for completed games.
1. List of Properties Intrinsic to the File System
The properties intrinsic to the .WITNESS_CAMPAIGN file format within a file system are the standard metadata attributes associated with any file. These include:
- File name (e.g., "save0.witness_campaign")
- File extension (".witness_campaign")
- File size (in bytes)
- Creation timestamp
- Last modification timestamp
- Last access timestamp
- File permissions (read, write, execute for owner, group, and others)
- Owner user ID
- Group ID
- File type (binary file)
- Full path in the file system
These attributes are managed by the operating system and are not specific to the internal content of the file.
2. Two Direct Download Links for .WITNESS_CAMPAIGN Files
Direct download links for individual .WITNESS_CAMPAIGN files are not readily available, as they are typically distributed within archives (e.g., ZIP or 7Z files) on community sites. However, the following pages provide downloadable archives containing .WITNESS_CAMPAIGN files:
- https://www.thetechgame.com/Downloads/id=234932/the-witness-game-save.html (Contains a ZIP archive with a 100% completed save file; extract to obtain the .witness_campaign file.)
- https://savegame.pro/pc-the-witness-savegame/ (Contains a 7Z archive with a 100% completed save file; extract to obtain the .witness_campaign file.)
To access the files, download the archive from the respective page, extract it, and locate the .witness_campaign file inside.
3. Ghost Blog Embedded HTML JavaScript for Drag-and-Drop File Dump
The following is an HTML page with embedded JavaScript that can be embedded in a Ghost blog post. It allows users to drag and drop a .WITNESS_CAMPAIGN file, then displays the available file system properties (limited to browser-accessible metadata: name, size, type, and last modified date).
Drag and Drop .WITNESS_CAMPAIGN File
4. Python Class for Handling .WITNESS_CAMPAIGN Files
The following Python class opens a .WITNESS_CAMPAIGN file, reads its binary content, allows writing the content back (or modified), and prints the file system properties using os.stat.
import os
import stat
import time
class WitnessCampaignHandler:
def __init__(self, filepath):
self.filepath = filepath
self.data = None
def read(self):
"""Read the binary data from the file."""
with open(self.filepath, 'rb') as f:
self.data = f.read()
def write(self, output_path=None):
"""Write the binary data back to the file or a new path."""
if self.data is None:
raise ValueError("No data to write. Call read() first.")
path = output_path or self.filepath
with open(path, 'wb') as f:
f.write(self.data)
def print_properties(self):
"""Print file system properties."""
st = os.stat(self.filepath)
print(f"File Name: {os.path.basename(self.filepath)}")
print(f"File Extension: {os.path.splitext(self.filepath)[1]}")
print(f"File Size: {st.st_size} bytes")
print(f"Creation Time: {time.ctime(st.st_ctime)}")
print(f"Last Modification Time: {time.ctime(st.st_mtime)}")
print(f"Last Access Time: {time.ctime(st.st_atime)}")
print(f"Permissions: {stat.filemode(st.st_mode)}")
print(f"Owner UID: {st.st_uid}")
print(f"Group GID: {st.st_gid}")
print(f"File Type: Binary")
print(f"Full Path: {os.path.abspath(self.filepath)}")
# Example usage:
# handler = WitnessCampaignHandler('path/to/file.witness_campaign')
# handler.read()
# handler.print_properties()
# handler.write('path/to/new_file.witness_campaign')
5. Java Class for Handling .WITNESS_CAMPAIGN Files
The following Java class opens a .WITNESS_CAMPAIGN file, reads its binary content, allows writing the content back, and prints the file system properties using java.nio.file.
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.attribute.BasicFileAttributes;
import java.nio.file.attribute.PosixFileAttributes;
import java.nio.file.attribute.PosixFilePermissions;
public class WitnessCampaignHandler {
private final Path filepath;
private byte[] data;
public WitnessCampaignHandler(String filepath) {
this.filepath = Paths.get(filepath);
}
public void read() throws IOException {
data = Files.readAllBytes(filepath);
}
public void write(String outputPath) throws IOException {
if (data == null) {
throw new IllegalStateException("No data to write. Call read() first.");
}
Path path = outputPath != null ? Paths.get(outputPath) : filepath;
Files.write(path, data);
}
public void printProperties() throws IOException {
BasicFileAttributes attrs = Files.readAttributes(filepath, BasicFileAttributes.class);
System.out.println("File Name: " + filepath.getFileName());
System.out.println("File Extension: " + filepath.toString().substring(filepath.toString().lastIndexOf('.')));
System.out.println("File Size: " + attrs.size() + " bytes");
System.out.println("Creation Time: " + attrs.creationTime());
System.out.println("Last Modification Time: " + attrs.lastModifiedTime());
System.out.println("Last Access Time: " + attrs.lastAccessTime());
if (Files.getFileStore(filepath).supportsFileAttributeView("posix")) {
PosixFileAttributes posixAttrs = Files.readAttributes(filepath, PosixFileAttributes.class);
System.out.println("Permissions: " + PosixFilePermissions.toString(posixAttrs.permissions()));
System.out.println("Owner: " + posixAttrs.owner());
System.out.println("Group: " + posixAttrs.group());
}
System.out.println("File Type: Binary");
System.out.println("Full Path: " + filepath.toAbsolutePath());
}
// Example usage:
// public static void main(String[] args) throws IOException {
// WitnessCampaignHandler handler = new WitnessCampaignHandler("path/to/file.witness_campaign");
// handler.read();
// handler.printProperties();
// handler.write("path/to/new_file.witness_campaign");
// }
}
6. JavaScript Class for Handling .WITNESS_CAMPAIGN Files (Node.js)
The following JavaScript class (for Node.js) opens a .WITNESS_CAMPAIGN file, reads its binary content, allows writing the content back, and prints the file system properties using fs.stat.
const fs = require('fs');
const path = require('path');
class WitnessCampaignHandler {
constructor(filepath) {
this.filepath = filepath;
this.data = null;
}
read() {
this.data = fs.readFileSync(this.filepath);
}
write(outputPath = null) {
if (this.data === null) {
throw new Error('No data to write. Call read() first.');
}
const targetPath = outputPath || this.filepath;
fs.writeFileSync(targetPath, this.data);
}
printProperties() {
const stats = fs.statSync(this.filepath);
console.log(`File Name: ${path.basename(this.filepath)}`);
console.log(`File Extension: ${path.extname(this.filepath)}`);
console.log(`File Size: ${stats.size} bytes`);
console.log(`Creation Time: ${stats.birthtime.toISOString()}`);
console.log(`Last Modification Time: ${stats.mtime.toISOString()}`);
console.log(`Last Access Time: ${stats.atime.toISOString()}`);
console.log(`Permissions: ${stats.mode.toString(8)}`);
console.log(`Owner UID: ${stats.uid}`);
console.log(`Group GID: ${stats.gid}`);
console.log(`File Type: Binary`);
console.log(`Full Path: ${path.resolve(this.filepath)}`);
}
}
// Example usage:
// const handler = new WitnessCampaignHandler('path/to/file.witness_campaign');
// handler.read();
// handler.printProperties();
// handler.write('path/to/new_file.witness_campaign');
7. C Class for Handling .WITNESS_CAMPAIGN Files
The following C code defines a struct acting as a class-like object for opening a .WITNESS_CAMPAIGN file, reading its binary content, allowing writing the content back, and printing the file system properties using stat.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <time.h>
#include <unistd.h>
typedef struct {
char* filepath;
unsigned char* data;
size_t size;
} WitnessCampaignHandler;
void init_handler(WitnessCampaignHandler* handler, const char* filepath) {
handler->filepath = strdup(filepath);
handler->data = NULL;
handler->size = 0;
}
void read_handler(WitnessCampaignHandler* handler) {
FILE* file = fopen(handler->filepath, "rb");
if (!file) {
perror("Error opening file");
return;
}
fseek(file, 0, SEEK_END);
handler->size = ftell(file);
fseek(file, 0, SEEK_SET);
handler->data = malloc(handler->size);
if (handler->data) {
fread(handler->data, 1, handler->size, file);
}
fclose(file);
}
void write_handler(WitnessCampaignHandler* handler, const char* output_path) {
if (!handler->data) {
fprintf(stderr, "No data to write. Call read first.\n");
return;
}
const char* path = output_path ? output_path : handler->filepath;
FILE* file = fopen(path, "wb");
if (!file) {
perror("Error opening file for writing");
return;
}
fwrite(handler->data, 1, handler->size, file);
fclose(file);
}
void print_properties(WitnessCampaignHandler* handler) {
struct stat st;
if (stat(handler->filepath, &st) != 0) {
perror("Error getting file stats");
return;
}
char* base = strrchr(handler->filepath, '/');
base = base ? base + 1 : handler->filepath;
char* ext = strrchr(base, '.');
printf("File Name: %s\n", base);
printf("File Extension: %s\n", ext ? ext : "");
printf("File Size: %ld bytes\n", st.st_size);
printf("Creation Time: %s", ctime(&st.st_ctime));
printf("Last Modification Time: %s", ctime(&st.st_mtime));
printf("Last Access Time: %s", ctime(&st.st_atime));
printf("Permissions: %o\n", st.st_mode & 0777);
printf("Owner UID: %d\n", st.st_uid);
printf("Group GID: %d\n", st.st_gid);
printf("File Type: Binary\n");
char abs_path[PATH_MAX];
realpath(handler->filepath, abs_path);
printf("Full Path: %s\n", abs_path);
}
void free_handler(WitnessCampaignHandler* handler) {
free(handler->filepath);
free(handler->data);
}
// Example usage:
// int main() {
// WitnessCampaignHandler handler;
// init_handler(&handler, "path/to/file.witness_campaign");
// read_handler(&handler);
// print_properties(&handler);
// write_handler(&handler, "path/to/new_file.witness_campaign");
// free_handler(&handler);
// return 0;
// }