Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
3eb2c05
Move file decoding to internal package.
redtoad Oct 8, 2023
fe41dc8
Put everything in publicly usable package savegame.
redtoad Oct 8, 2023
2c02b44
Rename structs after files.
redtoad Oct 8, 2023
1b6e425
Add Savegame to conveniently handle all data files.
redtoad Oct 8, 2023
3d0af15
Add support for reading WORLD.DAT
redtoad Nov 5, 2023
095dc93
Simplify loading world data.
redtoad Nov 5, 2023
6ea858e
Move resources package one level up and remove lib.
redtoad Nov 6, 2023
30433d4
Follow the original file structure for a better overview.
redtoad Nov 6, 2023
8ec96d7
Fix: Replace deprecated package.
redtoad Nov 6, 2023
5c6f8a4
Separate data file models from logic.
redtoad Nov 25, 2023
715137c
Collect Kaitai structs for data files (incomplete).
redtoad Nov 25, 2023
4b6b6a7
Start on geo conversion for world and craft data.
redtoad Nov 25, 2023
447890c
Move data file parsing to internal package.
redtoad Dec 23, 2023
15711ae
Add newline above package in generated file so it won't show up as pa…
redtoad Dec 23, 2023
c2a2ca6
Add package docs.
redtoad Dec 23, 2023
e62d52b
Improve error messages.
redtoad Dec 23, 2023
9355c66
Move Kaitai format descriptions to to level folder.
redtoad Dec 25, 2023
138d527
Move use of restruct to internal package.
redtoad Dec 26, 2023
7c7abf9
Support for all fields in LOC.DAT
redtoad Dec 27, 2023
6c304d9
Remove deprecated functions to load and save files.
redtoad Jan 3, 2024
123b05a
Fix: Financial data are all 32 bit values.
redtoad Jan 3, 2024
7a047e1
Add marshalling and unmarshalling to an from bytes.
redtoad Jan 3, 2024
2b0923f
Automatically generate strings for BASE_DAT enums.
redtoad Sep 22, 2024
8f88aed
Generate enums for CRAFT.DAT
redtoad Sep 22, 2024
4b63887
Generate enums for LOC.DAT
redtoad Sep 22, 2024
c6a6c05
Gnerate enums for SOLDIER.DAT
redtoad Sep 22, 2024
f04f576
Rename remaining fies for consitency.
redtoad Sep 22, 2024
9e43a15
Merge branch 'extract-enums' into timemachine
redtoad Sep 22, 2024
565187e
Use convenience types to interact with underlying data of savegame.
redtoad Sep 23, 2024
b60e672
Bugfix: Fix geo coordinate conversion.
redtoad Sep 23, 2024
76d95ee
Improve error reporting.
redtoad Sep 23, 2024
56de438
Fix null-terminated string handling in DAT file parsing. (#7)
redtoad Jan 30, 2026
0a0ac1e
Add CLAUDE.md with development workflow guidelines.
redtoad Jan 30, 2026
aee9c74
Fix cmd/editor build errors (#9)
redtoad Jan 30, 2026
2da6758
Fix bugs and extend savegame package for web editor
redtoad Jan 30, 2026
b383905
Add savegame-editor Go backend with JSON API
redtoad Jan 30, 2026
9448255
Add Svelte frontend and build integration for savegame editor
redtoad Jan 31, 2026
a5a5d10
Normalize armor values in savegame editor API
redtoad Jan 31, 2026
c201a9b
Replace unchecked type assertions with typed request structs
redtoad Jan 31, 2026
62a5679
Use path.Base instead of filepath.Base for URL path handling
redtoad Jan 31, 2026
c7e4610
Add per-savegame RWMutex for concurrent request safety
redtoad Jan 31, 2026
27f01e7
Bind HTTP server to localhost by default
redtoad Jan 31, 2026
1e4ce8f
Use uint8 for TransferData 1-byte fields
redtoad Jan 31, 2026
a03d4be
Fix null JSON arrays causing frontend crash
redtoad Jan 31, 2026
a545d61
Add base name column to Crafts tab
redtoad Jan 31, 2026
ee5d68e
Add Locations() method and /locations API endpoint
redtoad Jan 31, 2026
4086fdd
Add Globe tab with interactive 3D map of game locations
redtoad Jan 31, 2026
276dc1e
Fix GPUShaderStage crash in browsers without WebGPU
redtoad Jan 31, 2026
6892961
Serve earth texture locally instead of from CDN
redtoad Jan 31, 2026
c92629f
Use dalight earth instead.
redtoad Jan 31, 2026
574d967
Add animated flight path arcs for in-flight craft on Globe
redtoad Feb 1, 2026
a236e95
Add UFO next waypoint arcs and mission type to globe
redtoad Feb 1, 2026
4822cbe
Add pre-commit testing and go generate instructions to CLAUDE.md
redtoad Feb 1, 2026
5c6ddb8
Rerun go generate.
redtoad Feb 1, 2026
4b3f1dc
Ignore build from goreleaser.
redtoad Feb 1, 2026
729b5c2
Merge pull request #10 from redtoad/feature/savegame-editor
redtoad Feb 1, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@
/.nova/
/.vscode/

dist/
/dist/
/cmd/**/dist/

*.png

GAME/
cmd/savegame-editor/frontend/node_modules/

GAME/
debug.log
GOG_Galaxy_X-Com_UFO_Defense.exe
12 changes: 12 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ before:
hooks:
- go mod tidy
- go generate ./...
- npm --prefix cmd/savegame-editor/frontend install
- npm --prefix cmd/savegame-editor/frontend run build

builds:
- id: "image-server"
Expand All @@ -17,6 +19,16 @@ builds:
- windows
- darwin

- id: "savegame-editor"
main: ./cmd/savegame-editor/
binary: savegame-editor
env:
- CGO_ENABLED=0
goos:
- linux
- windows
- darwin

archives:
- format: tar.gz
# this name template makes the OS and Arch compatible with the results of `uname`.
Expand Down
19 changes: 19 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# CLAUDE.md

## Branching

- When starting a new task, always create a new branch with prefix `feature/` for new features and `fix/` for bugfixes. Only create a new branch when working on `main` or `master`.

## Commits

- Before each commit make sure that all tests are passing.
- Commit often.
- Never force-push.

## Testing

- Before each test run `go generate ./...`.
- Always make sure that tests run successfully before considering a task complete.
- Loading of ALL savegame files must be tested with a round-trip (load and save identical to original).
- Always update tests and docs when making changes.
- Make sure that all examples (in `examples/`) and CLI tools (in `cmd/`, each in its own subdirectory) still run after making changes.
73 changes: 73 additions & 0 deletions cmd/editor/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
package main

import (
"flag"
"fmt"
"log"
"os"

"golang.org/x/text/currency"
"golang.org/x/text/language"
"golang.org/x/text/message"

"github.com/redtoad/xcom-editor/internal/geoscape"
"github.com/redtoad/xcom-editor/savegame"
)

func FinishAllConstructions(path string) {

}

func main() {

rootPath := flag.String("path", ".", "save game path")
flag.Parse()

pathBasesFile := *rootPath + string(os.PathSeparator) + "BASE.DAT"
if _, err := os.Stat(pathBasesFile); os.IsNotExist(err) {
log.Fatalf("could not open file: %v", err)
}

sg, _ := savegame.Load(*rootPath + string(os.PathSeparator))
curr := currency.USD.Amount(sg.Financials.CurrentBalance)
p := message.NewPrinter(language.AmericanEnglish)
p.Printf("%v\n", curr)

for no := 0; no < len(sg.BasesData.Bases); no++ {
base := &sg.BasesData.Bases[no]
fmt.Printf("%d %s (%v)\n", no, base.Name, base.Active)
if !base.Active {
continue
}
for no, cell := range base.Grid {
if no%6 == 0 {
println()
}
fmt.Print(cell.String())
}
println()
fmt.Printf("%v\n", base.Grid)
fmt.Printf("%v\n", base.DaysToCompletion)

// complete constructions in progress
for i := 0; i < len(base.Grid); i++ {
if base.Grid[i] != geoscape.Empty && base.DaysToCompletion[i] > 0 {
base.DaysToCompletion[i] = 0
}
}

// increase Elirium-115
//Elirium115 := 60
//base.Inventory[Elirium115] = 0x7f

AlienAlloys := 88
base.Inventory[AlienAlloys] = 0x7f

}

fmt.Printf("Storing %s...\n", sg.Path)
if err := sg.Save(); err != nil {
log.Fatalf("could not save game: %v\n", err)
}

}
2 changes: 1 addition & 1 deletion cmd/image-server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"time"

"github.com/gorilla/mux"
"github.com/redtoad/xcom-editor/lib/resources"
"github.com/redtoad/xcom-editor/resources"
)

var (
Expand Down
Loading