Skip to content
This repository was archived by the owner on May 21, 2025. It is now read-only.

Commit eaff369

Browse files
committed
Initial commit
0 parents  commit eaff369

21 files changed

+14055
-0
lines changed

.gitignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
Glorious-Eggroll/
2+
mk/
3+
gstkrkr-i386.so
4+
gstkrkr-x86_64.so
5+
krkrwine-i386.dll
6+
krkrwine-x86_64.dll
7+
run32.exe
8+
run64.exe
9+
*.wmv
10+
*.WMV
11+
*.mpg
12+
*.mpeg

Makefile

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
# SPDX-License-Identifier: LGPL-2.0-or-later
2+
3+
FLAGS := -Wall
4+
ifeq ($(OPT),1)
5+
FLAGS := -Os -s -g0 -fno-rtti -Wall
6+
endif
7+
8+
all: gstkrkr-x86_64.so gstkrkr-i386.so krkrwine-x86_64.dll krkrwine-i386.dll
9+
10+
clean:
11+
-rm gstkrkr-x86_64.so gstkrkr-i386.so krkrwine-x86_64.dll krkrwine-i386.dll
12+
-rm run32.exe run64.exe krmovie.dll
13+
14+
MINGW32 = i686-w64-mingw32-g++-win32 -std=c++20 -fno-exceptions -gdwarf-4 -static-libgcc -static-libstdc++ $(FLAGS)
15+
MINGW64 = x86_64-w64-mingw32-g++-win32 -std=c++20 -fno-exceptions -gdwarf-4 -static-libgcc -static-libstdc++ $(FLAGS)
16+
17+
gstkrkr-x86_64.so: gstkrkr.c Makefile
18+
gcc gstkrkr.c -shared -fPIC -std=c99 -DPLUGINARCH=x86_64 -o gstkrkr-x86_64.so -g $(shell pkg-config --cflags --libs gstreamer-1.0) -fvisibility=hidden -Wl,--no-undefined $(FLAGS)
19+
20+
# must use -std=c##, the default (gnu##) predefines the symbol i386
21+
gstkrkr-i386.so: gstkrkr.c Makefile
22+
gcc -m32 gstkrkr.c -shared -fPIC -std=c99 -DPLUGINARCH=i386 -o gstkrkr-i386.so $(shell pkg-config --personality=i386-linux-gnu --cflags --libs gstreamer-1.0) -fvisibility=hidden -Wl,--no-undefined $(FLAGS)
23+
24+
krkrwine-x86_64.dll: krkrwine.cpp Makefile
25+
$(MINGW64) krkrwine.cpp -shared -fPIC -o krkrwine-x86_64.dll -lole32
26+
27+
krkrwine-i386.dll: krkrwine.cpp Makefile
28+
$(MINGW32) krkrwine.cpp -shared -fPIC -o krkrwine-i386.dll -lole32
29+
30+
prepare:
31+
cp $(EGGROLL)/files/lib64/gstreamer-1.0/libgstmpegpsdemux.so Glorious-Eggroll/x86_64-libgstmpegpsdemux.so
32+
cp $(EGGROLL)/files/lib64/gstreamer-1.0/libgstasf.so Glorious-Eggroll/x86_64-libgstasf.so
33+
cp $(EGGROLL)/files/lib64/libgstcodecparsers-1.0.so.0 Glorious-Eggroll/x86_64-libgstcodecparsers-1.0.so.0
34+
cp $(EGGROLL)/files/lib64/libavcodec.so.58 Glorious-Eggroll/x86_64-libavcodec.so.58
35+
cp $(EGGROLL)/files/lib64/libavutil.so.56 Glorious-Eggroll/x86_64-libavutil.so.56
36+
cp $(EGGROLL)/files/lib64/libavfilter.so.7 Glorious-Eggroll/x86_64-libavfilter.so.7
37+
cp $(EGGROLL)/files/lib64/libavformat.so.58 Glorious-Eggroll/x86_64-libavformat.so.58
38+
cp $(EGGROLL)/files/lib64/libavdevice.so.58 Glorious-Eggroll/x86_64-libavdevice.so.58
39+
cp $(EGGROLL)/files/lib64/libswresample.so.3 Glorious-Eggroll/x86_64-libswresample.so.3
40+
cp $(EGGROLL)/files/lib64/libswscale.so.5 Glorious-Eggroll/x86_64-libswscale.so.5
41+
cp $(EGGROLL)/files/lib/gstreamer-1.0/libgstmpegpsdemux.so Glorious-Eggroll/i386-libgstmpegpsdemux.so
42+
cp $(EGGROLL)/files/lib/gstreamer-1.0/libgstasf.so Glorious-Eggroll/i386-libgstasf.so
43+
cp $(EGGROLL)/files/lib/libgstcodecparsers-1.0.so.0 Glorious-Eggroll/i386-libgstcodecparsers-1.0.so.0
44+
cp $(EGGROLL)/files/lib/libavcodec.so.58 Glorious-Eggroll/i386-libavcodec.so.58
45+
cp $(EGGROLL)/files/lib/libavutil.so.56 Glorious-Eggroll/i386-libavutil.so.56
46+
cp $(EGGROLL)/files/lib/libavfilter.so.7 Glorious-Eggroll/i386-libavfilter.so.7
47+
cp $(EGGROLL)/files/lib/libavformat.so.58 Glorious-Eggroll/i386-libavformat.so.58
48+
cp $(EGGROLL)/files/lib/libavdevice.so.58 Glorious-Eggroll/i386-libavdevice.so.58
49+
cp $(EGGROLL)/files/lib/libswresample.so.3 Glorious-Eggroll/i386-libswresample.so.3
50+
cp $(EGGROLL)/files/lib/libswscale.so.5 Glorious-Eggroll/i386-libswscale.so.5
51+
52+
53+
krkrwine.tar.gz: | Glorious-Eggroll/x86_64-libgstmpegpsdemux.so
54+
$(MAKE) clean
55+
$(MAKE) OPT=1
56+
-rm krkrwine.tar.gz
57+
tar -czvf krkrwine.tar.gz --transform='s%^%krkrwine/%' --show-transformed-names README.md install.py gstkrkr-i386.so gstkrkr-x86_64.so krkrwine-i386.dll krkrwine-x86_64.dll Glorious-Eggroll/
58+
59+
60+
# The following is various debug tools. If you're just trying to compile krkrwine, you don't need them;
61+
# if you're trying to debug or patch this program, you may find some of them useful. (Some of them are hardcoded for my own use.)
62+
63+
run32.exe: runner.cpp Makefile
64+
$(MINGW32) runner.cpp -o run32.exe -lole32 -ld3d9
65+
66+
run64.exe: runner.cpp Makefile
67+
$(MINGW64) runner.cpp -o run64.exe -lole32 -ld3d9 -lgdi32
68+
69+
run: krkrwine-x86_64.dll gstkrkr-x86_64.so run64.exe
70+
GST_DEBUG_NO_COLOR=1 WINEDEBUG=+warn,+error,+fixme timeout 10 wine run64.exe 2>&1 | guidfilt
71+
72+
run32: krkrwine-i386.dll gstkrkr-i386.so run32.exe
73+
GST_DEBUG_NO_COLOR=1 timeout 10 wine run32.exe 2>&1 | guidfilt
74+
75+
runv: krkrwine-x86_64.dll gstkrkr-x86_64.so run64.exe
76+
GST_DEBUG_NO_COLOR=1 GST_DEBUG=6 WINEDEBUG=trace+quartz,warn+quartz timeout 10 wine run64.exe 2>&1 | guidfilt | head -n2000 | tee e.log
77+
78+
mk/microkiri.exe:
79+
echo 'Download and extract microkiri from https://bugs.winehq.org/show_bug.cgi?id=9127#c102 to the mk/ subdirectory'
80+
mkdir mk
81+
false
82+
mk/_rmovie.dll: mk/microkiri.exe
83+
mv mk/krmovie.dll mk/_rmovie.dll
84+
krmovie.dll: fake-krmovie.cpp Makefile
85+
$(MINGW32) fake-krmovie.cpp -shared -fPIC -o krmovie.dll -lole32 -ld3d9
86+
rmk: krmovie.dll krkrwine-i386.dll mk/_rmovie.dll
87+
-rm mk/krmovie.dll
88+
cp krmovie.dll mk/krmovie.dll
89+
LC_ALL=ja_JP wine mk/microkiri.exe
90+
91+
rmkd: krmovie.dll krkrwine-i386.dll mk/_rmovie.dll
92+
-rm mk/krmovie.dll
93+
cp krmovie.dll mk/krmovie.dll
94+
LC_ALL=ja_JP wine ~/tools/mingw64-11.2.0/bin/gdb.exe -ex "set disassemble-next-line on" -ex "set disassembly-flavor intel" mk/microkiri.exe
95+
96+
rwa: krkrwine-i386.dll gstkrkr-i386.so krmovie.dll
97+
LC_ALL=ja_JP wine /games/wine/waga/waga/waga.exe
98+
rwas: krkrwine-i386.dll gstkrkr-i386.so krmovie.dll
99+
LC_ALL=ja_JP timeout 7 wine /games/wine/waga/waga/waga.exe
100+
101+
wau:
102+
mv /games/wine/waga/waga/plugin/_rmovie.dll /games/wine/waga/waga/plugin/krmovie.dll
103+
wai:
104+
mv -n /games/wine/waga/waga/plugin/krmovie.dll /games/wine/waga/waga/plugin/_rmovie.dll
105+
ln -s $(shell realpath .)/krmovie.dll /games/wine/waga/waga/plugin/krmovie.dll
106+
107+
X1_HOME = /home/walrus/mount/x1/home/x1/
108+
X1_PROTON = $(X1_HOME)steam/steamapps/common/"Proton 8.0"/
109+
X1_PFX = $(X1_PROTON)dist/share/default_pfx/
110+
X1_DLL = $(X1_PFX)drive_c/windows/syswow64/krkrwine.dll
111+
X1_EXE = $(X1_HOME)Desktop/a.exe
112+
X1_GST = $(X1_PROTON)dist/lib/gstreamer-1.0/gstkrkr-i386.so
113+
ax1: run32.exe krkrwine-i386.dll gstkrkr-i386.so
114+
-rm $(X1_DLL) $(X1_EXE) $(X1_GST)
115+
cp krkrwine-i386.dll $(X1_DLL)
116+
cp run32.exe $(X1_EXE)
117+
cp gstkrkr-i386.so $(X1_GST)
118+
119+
installx1: all
120+
./install.py $(X1_PROTON)
121+
122+
installx2: all
123+
./install.py /home/walrus/mount/x2/home/x2/steam/steamapps/common/"Proton 8.0"/
124+
125+
X2_WAGAPATH = /home/walrus/mount/x2/home/x2/steam/steamapps/common/"WAGAMAMA HIGH SPEC"
126+
waux2:
127+
mv $(X2_WAGAPATH)/plugin/_rmovie.dll $(X2_WAGAPATH)/plugin/krmovie.dll
128+
waix2: krmovie.dll
129+
mv -n $(X2_WAGAPATH)/plugin/krmovie.dll $(X2_WAGAPATH)/plugin/_rmovie.dll
130+
cp krmovie.dll $(X2_WAGAPATH)/plugin/krmovie.dll

README.md

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
krkrwine
2+
========
3+
4+
This program implements various missing functionality in Wine / Proton, such that videos work properly in Kirikiri-based visual novels. (Other games are not targetted by krkrwine, but they may be improved as well.)
5+
6+
Installation - Linux/Proton
7+
---------------------------
8+
9+
Simply run ./install.py ~/steam/steamapps/common/Proton\ 8.0/, and it will install into every current and future game using that Proton. Installing krkrwine into Glorious Eggroll should work too, though this is untested.
10+
11+
krkrwine does not replace any existing files, and Steam's updater ignores files it doesn't recognize; therefore, you don't need to reinstall krkrwine if Proton updates. (However, if you reinstall Proton, or download a new Proton version, you obviously need to reinstall krkrwine too.)
12+
13+
krkrwine is only tested in Proton 8.0; I don't think it'll break too hard in anything else, but it's untested.
14+
15+
Installation - Linux/Wine
16+
-------------------------
17+
18+
On Debian,
19+
20+
- sudo apt install gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-libav gstreamer1.0-plugins-good:i386 gstreamer1.0-plugins-bad:i386 gstreamer1.0-plugins-ugly:i386 gstreamer1.0-libav:i386
21+
- ./install.py --wine
22+
23+
On other distros, the package names are different.
24+
25+
Note that on Debian, gstreamer1.0-libav is not part of, or a dependency of, gstreamer1.0-plugins-good, -bad, nor -ugly; it must be installed separately. I haven't checked other distros.
26+
27+
install.py will obey the WINEPREFIX environment variable, if set.
28+
29+
gstkrkr will not be installed; it does nothing useful if you have the above plugins and don't have protonmediaconverter. If you want them anyways for development purposes, you can copy or link them to ~/.local/share/gstreamer-1.0/plugins/.
30+
31+
Installation - macOS
32+
--------------------
33+
34+
See the Linux/Wine steps, it'll probably work. However, it's untested, and I can't help you if it breaks.
35+
36+
Installation - Windows
37+
----------------------
38+
39+
Don't. All relevant functionality is already in place on every Windows edition I'm aware of, and some parts of this program depend on Wine internals that are different on Windows.
40+
41+
Compilation
42+
-----------
43+
44+
- Download and extract your favorite release of Glorious Eggroll (I use 8.4; no real reason, I just picked one)
45+
- sudo apt install make gcc libgstreamer1.0-dev gcc-multilib libgstreamer1.0-dev:i386 g++-mingw-w64-i686-win32 g++-mingw-w64-x86-64-win32
46+
- make prepare EGGROLL=/home/user/steam/compatibilitytools.d/GE-Proton8-4/
47+
- make
48+
- ./install.py /home/user/steam/steamapps/common/Proton\ 8.0/
49+
If desired, you may acquire i686-w64-mingw32-g++-win32 and x86_64-w64-mingw32-g++-win32 programs from elsewhere. I use https://winlibs.com/ in Wine.
50+
51+
License
52+
-------
53+
54+
krkrwine itself is LGPL-2.0, same as Wine and GStreamer. Some test programs are GPL-2.0, since they contain code copied from Kirikiri.
55+
56+
The Glorious-Eggroll subdirectory of the releases is, as the name implies, copied from a Glorious Eggroll release. They're either LGPL-2.0 or GPL-2.0, depending on how they were compiled; I didn't check.
57+
58+
Upstreaming
59+
-----------
60+
61+
Ideally, this project would be unnecessary. As such, I'm offering bounties on fixing the Windows-side issues in upstream Wine.
62+
63+
- $250 - CLSID_MPEG1Splitter video output, and CLSID_CMpegVideoCodec (these objects may use GStreamer, of course)
64+
- $25 - CLSID_MPEG1Splitter IAMStreamSelect (doesn't need to be fully implemented, just needs the parts Kirikiri uses)
65+
- $25 - CLSID_VideoMixingRenderer9 ChangeD3DDevice and NotifyEvent
66+
- $500 - WMCreateSyncReader compressed output, CLSID_CWMADecMediaObject, and CLSID_CWMVDecMediaObject
67+
- $100 - Direct3D 9 on WS_CHILD windows under wined3d
68+
- $25 - make WMSyncReader resize its allocator, so it can output RGB32 properly
69+
- $100 - figure out what's going on with the memory allocator and VFW_E_NOT_COMMITTED, and solve it
70+
- $0 - anything involving gstkrkr and Proton's GStreamer. That's a patent issue; it's a question for lawyers, not programmers. It's only needed in Proton, not vanilla Wine.
71+
- Anything that Kirikiri needs but isn't in the above list - that's a bug in this readme, contact me
72+
73+
I can't do it myself; I've debugged some things too hard, and have single-stepped and disassembled Windows DLLs.
74+
75+
You are allowed, but not required, to base such efforts on this project. My architecture is very different from Wine's existing objects, and many of them are implemented in an awful way, so most of my code is unusable; but you're welcome to look for hints on the objects' expected behavior, or otherwise use them to help implement yours. You may also use the Kirikiri source code, <https://github.com/krkrz/krkr2/tree/master/kirikiri2/trunk>
76+
77+
To claim a bounty, post at <https://github.com/Alcaro/krkrwine/discussions/1>, or email me at sir@walrus.se. These bounties can be combined with similar offers made by others.
78+
79+
If I see any of the above implemented, but nobody claims the bounty, I will donate it to Wine.

0 commit comments

Comments
 (0)