Skip to content

Commit 73ecb7c

Browse files
committed
Windows work
1 parent ddeceee commit 73ecb7c

File tree

6 files changed

+48
-25
lines changed

6 files changed

+48
-25
lines changed

README.md

+37-21
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
# twad - terminal wad launcher
22

3-
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.
3+
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.
44

55
## Start **classic DOOM** with a **classic terminal user interface**
66

7-
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.
8-
9-
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...
7+
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...
108

119
## Now with experimental **Windows support**
1210

1311
**Watch Out**: This tool is still in early state and might contain bugs.
1412

15-
![demo](demo.gif)
13+
![demo](readme_assets/demo.gif)
14+
15+
![demo on windows](readme_assets/twad_windows.png)
1616

1717
# Features
1818

@@ -26,6 +26,7 @@ Needless to say that this mostly was designed for *nix systems. However, meanwhi
2626
* Collect some stats from the cames console output as well as playtime and so on (not sending it anywhere)
2727
* Collect stats from savegames
2828
* Run games from rofi or dmenu
29+
* Import .zip files containing mods
2930
* Separate savegame / demo folders for games (in **~/.config/twad/...***)
3031
* Responsive layout (kind of)
3132

@@ -54,7 +55,13 @@ go get -u github.com/zmnpl/twad
5455

5556
***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**.
5657

57-
An example could look like this:
58+
1) Setup your **DOOMWADDIR** as described above
59+
2) twad's first start will ask you to configure your **DOOMWADDIR** in the options
60+
3) Within twad create games
61+
4) Add mods to your games
62+
666) __Rip and Tear__
63+
64+
## An example could look like this
5865
```bash
5966
~/DOOM ❯❯❯ tree
6067
.
@@ -73,30 +80,39 @@ An example could look like this:
7380
├── doom2.wad
7481
└── doom.wad
7582
```
76-
1) Setup your **DOOMWADDIR** as described above
77-
2) twad's first start will ask you to configure your **DOOMWADDIR** in the options
78-
3) Within twad create games
79-
4) Add mods to your games
80-
666) __Rip and Tear__
83+
84+
## Or this on Windows
85+
```cmd
86+
C:\DOOM\> dir
87+
.
88+
├── Ashes 2063
89+
│   ├── Ashes2063Maps115.wad
90+
│   └── Ashes2063Mod115.pk3
91+
├── Back To Saturn X e1
92+
│   ├── btsx_e1a.wad
93+
│   ├── btsx_e1b.wad
94+
│   └── btsx_e1.deh
95+
├── D4T
96+
│   └── D4Tv2.5.pk3
97+
├── Sigil
98+
│ ├── SIGIL_COMPAT.wad
99+
│ └── SIGIL.wad
100+
├── doom2.wad
101+
└── doom.wad
102+
```
103+
81104

82105
## More on DOOMWADDIR
83106

84-
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)
107+
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)
85108

86109
An alternative/additional method is to add paths to the respective source ports config. For *zdoom* ports it could look like this:
87110
```bash
88111
# in your doom engine .ini
89112
[FileSearch.Directories]
90-
PATH=/home/doomguy/Doom # path to DOOMWADDIR
113+
PATH=/home/doomguy/DOOM # path to DOOMWADDIR
91114
```
92115

93-
There is flag in the options which lets Twad try to do this automatically for these engines if it finds the respective config:
94-
- **Zandronum** *(~/.config/zandronum/zandronum.ini)*
95-
- **LZDoom** *(~/.config/lzdoom/lzdoom.ini)*
96-
- **GZDoom** *(~/.config/gzdoom/gzdoom.ini)*
97-
98-
If you are using something different, please configure it accoridingly or send in an issue or pull request ;)
99-
100116
# Rofi Mode
101117

102118
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
107123
```
108124
**For instant Rip & Tear** bind this to a keyboard shortcut
109125

110-
![rofimode](rofimode.png)
126+
![rofimode](readme_assets/rofimode.png)
111127

112128

113129
# Plans / Ideas

games/game.go

+9
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"path"
88
"path/filepath"
99
"regexp"
10+
"runtime"
1011
"sort"
1112
"strconv"
1213
"strings"
@@ -185,6 +186,11 @@ func (g *Game) getLaunchParams(rcfg runconfig) []string {
185186
params = append(params, g.getSaveDir())
186187
}
187188

189+
// stats for zdoom on windows
190+
if sourcePortFamily(g.SourcePort) == zdoom && runtime.GOOS == "windows" {
191+
params = append(params, "-stdout")
192+
}
193+
188194
// stats for chocolate doom and ports
189195
if sourcePortFamily(g.SourcePort) == chocolate {
190196
params = append(params, "-statdump")
@@ -418,6 +424,9 @@ func (g *Game) Demos() ([]os.DirEntry, error) {
418424
}
419425
sort.Slice(demos, func(i, j int) bool {
420426
foo, err := demos[i].Info()
427+
if err != nil {
428+
return false
429+
}
421430
bar, err := demos[j].Info()
422431
if err != nil {
423432
return true

games/gameList.go

+2-4
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,19 @@ type GameList []Game
1515
var (
1616
once sync.Once
1717
instance GameList
18-
config *cfg.Cfg
1918
changeListeners []func()
2019
gamesJSONName = "games.json"
2120
)
2221

2322
func init() {
24-
config = cfg.Instance()
2523
GetInstance()
2624
changeListeners = make([]func(), 0)
2725
}
2826

2927
// GetInstance sets up and returns the singleton instance of games
3028
func GetInstance() GameList {
3129
once.Do(func() {
32-
instance = make(GameList, 0, 0)
30+
instance = make(GameList, 0)
3331
loadGames()
3432
})
3533
return instance
@@ -125,7 +123,7 @@ func loadGames() error {
125123
return err
126124
}
127125

128-
for i, _ := range instance {
126+
for i := range instance {
129127
go instance[i].ReadLatestStats()
130128
}
131129

demo.gif readme_assets/demo.gif

File renamed without changes.
File renamed without changes.

readme_assets/twad_windows.png

67.6 KB
Loading

0 commit comments

Comments
 (0)