diff --git a/README.md b/README.md index 0c4c5a7..2534f07 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,18 @@ # twad - terminal wad launcher -If you love __DOOM__ and love your terminal like me, then you might like this. **twad** is a terminal based WAD manager and launcher for doom source ports. At it's core twad lets you set up a multitude of WAD file combinations, store them and launch them with a couple of key strokes. It is light weight and blazing fast to use. +If you love __DOOM__ and love your terminal then **twad** is for you. **twad** is a terminal based WAD manager and launcher for doom source ports. At it's core twad lets you set up a multitude of WAD file combinations, store them and launch them with a couple of key strokes. It is light weight and fast to use. ## Start **classic DOOM** with a **classic terminal user interface** -Twad let's you stay in the terminal and on your keyboard as long as possible until you decide to **rip and tear**. Simple as that. - -Needless to say that this mostly was designed for *nix systems. However, meanwhile I've added some OS-sensitive stuff and cross compiled for Windows. Actually it works quite well. So... +Twad let's you stay in the terminal and on your keyboard as long as possible until you decide to **rip and tear**. Simple as that. Needless to say that this mostly was designed for *nix systems. However, meanwhile I've added some OS-sensitive behaviour and cross compiled for Windows. Actually it works quite well. So... ## Now with experimental **Windows support** **Watch Out**: This tool is still in early state and might contain bugs. -![demo](demo.gif) +![demo](readme_assets/demo.gif) + +![demo on windows](readme_assets/twad_windows.png) # Features @@ -26,6 +26,7 @@ Needless to say that this mostly was designed for *nix systems. However, meanwhi * Collect some stats from the cames console output as well as playtime and so on (not sending it anywhere) * Collect stats from savegames * Run games from rofi or dmenu +* Import .zip files containing mods * Separate savegame / demo folders for games (in **~/.config/twad/...***) * Responsive layout (kind of) @@ -54,7 +55,13 @@ go get -u github.com/zmnpl/twad ***twad*** assumes, you have **one folder**, where your IWADs are located. All your pwads (mapsets, gameplay mods, ...) need to be in the same or subfolder of this. The folder, where you put your IWADs is known to source ports as **DOOMWADDIR**. -An example could look like this: +1) Setup your **DOOMWADDIR** as described above +2) twad's first start will ask you to configure your **DOOMWADDIR** in the options +3) Within twad create games +4) Add mods to your games +666) __Rip and Tear__ + +## An example could look like this ```bash ~/DOOM ❯❯❯ tree . @@ -73,30 +80,39 @@ An example could look like this: ├── doom2.wad └── doom.wad ``` -1) Setup your **DOOMWADDIR** as described above -2) twad's first start will ask you to configure your **DOOMWADDIR** in the options -3) Within twad create games -4) Add mods to your games -666) __Rip and Tear__ + +## Or this on Windows +```cmd +C:\DOOM\> dir +. +├── Ashes 2063 +│   ├── Ashes2063Maps115.wad +│   └── Ashes2063Mod115.pk3 +├── Back To Saturn X e1 +│   ├── btsx_e1a.wad +│   ├── btsx_e1b.wad +│   └── btsx_e1.deh +├── D4T +│   └── D4Tv2.5.pk3 +├── Sigil +│ ├── SIGIL_COMPAT.wad +│ └── SIGIL.wad +├── doom2.wad +└── doom.wad +``` + ## More on DOOMWADDIR -Your DOOM source port needs to know about the base folder of your mods and IWADs to work properly, since ***twad*** uses relative paths. ***twad**'s default method for this is to set the ***DOOMWADDIR*** environment variable when starting a game. This is only set for the current game session. (Should you already have set DOOMWADDIR, twad will shadow it with whatever is set in its configuration) +Your DOOM source port needs to know about the base folder of your mods and IWADs to work properly, since ***twad*** uses relative paths. ***twad***'s default method for this is to set the ***DOOMWADDIR*** environment variable when starting a game. This is only set for the current game session. (Should you already have set DOOMWADDIR, twad will shadow it with whatever is set in its configuration) An alternative/additional method is to add paths to the respective source ports config. For *zdoom* ports it could look like this: ```bash # in your doom engine .ini [FileSearch.Directories] -PATH=/home/doomguy/Doom # path to DOOMWADDIR +PATH=/home/doomguy/DOOM # path to DOOMWADDIR ``` -There is flag in the options which lets Twad try to do this automatically for these engines if it finds the respective config: -- **Zandronum** *(~/.config/zandronum/zandronum.ini)* -- **LZDoom** *(~/.config/lzdoom/lzdoom.ini)* -- **GZDoom** *(~/.config/gzdoom/gzdoom.ini)* - -If you are using something different, please configure it accoridingly or send in an issue or pull request ;) - # Rofi Mode You can use [***rofi***](https://github.com/davatorium/rofi) or [***dmenu***](https://tools.suckless.org/dmenu/) to launch your games. Run twad like this to use the respective programm. This will open rofi/dmenu and show a list of all games you already have. Select one you want to play and hit enter. Of course this will also track your statistics. @@ -107,7 +123,7 @@ twad --dmenu ``` **For instant Rip & Tear** bind this to a keyboard shortcut -![rofimode](rofimode.png) +![rofimode](readme_assets/rofimode.png) # Plans / Ideas diff --git a/games/game.go b/games/game.go index 21a8170..16feb67 100644 --- a/games/game.go +++ b/games/game.go @@ -7,6 +7,7 @@ import ( "path" "path/filepath" "regexp" + "runtime" "sort" "strconv" "strings" @@ -185,6 +186,11 @@ func (g *Game) getLaunchParams(rcfg runconfig) []string { params = append(params, g.getSaveDir()) } + // stats for zdoom on windows + if sourcePortFamily(g.SourcePort) == zdoom && runtime.GOOS == "windows" { + params = append(params, "-stdout") + } + // stats for chocolate doom and ports if sourcePortFamily(g.SourcePort) == chocolate { params = append(params, "-statdump") @@ -418,6 +424,9 @@ func (g *Game) Demos() ([]os.DirEntry, error) { } sort.Slice(demos, func(i, j int) bool { foo, err := demos[i].Info() + if err != nil { + return false + } bar, err := demos[j].Info() if err != nil { return true diff --git a/games/gameList.go b/games/gameList.go index 1a13fa5..493278c 100644 --- a/games/gameList.go +++ b/games/gameList.go @@ -15,13 +15,11 @@ type GameList []Game var ( once sync.Once instance GameList - config *cfg.Cfg changeListeners []func() gamesJSONName = "games.json" ) func init() { - config = cfg.Instance() GetInstance() changeListeners = make([]func(), 0) } @@ -29,7 +27,7 @@ func init() { // GetInstance sets up and returns the singleton instance of games func GetInstance() GameList { once.Do(func() { - instance = make(GameList, 0, 0) + instance = make(GameList, 0) loadGames() }) return instance @@ -125,7 +123,7 @@ func loadGames() error { return err } - for i, _ := range instance { + for i := range instance { go instance[i].ReadLatestStats() } diff --git a/demo.gif b/readme_assets/demo.gif similarity index 100% rename from demo.gif rename to readme_assets/demo.gif diff --git a/rofimode.png b/readme_assets/rofimode.png similarity index 100% rename from rofimode.png rename to readme_assets/rofimode.png diff --git a/readme_assets/twad_windows.png b/readme_assets/twad_windows.png new file mode 100644 index 0000000..c2fea25 Binary files /dev/null and b/readme_assets/twad_windows.png differ