WineHQ

256 Color Mode: Difference between revisions

(→‎Xephyr: added a note about using the Xorg palette instead of the Windows palette)
(stressed need for compatible window manager, changed example program from xterm to Wine file explorer, removed instructions for defunct VNC program, added back note about registry just in case, improved formatting generally)
Line 1: Line 1:
The X server can't switch from 24bpp* mode to 8bpp** mode. Nevertheless, Wine (in general) can run software that uses 8bpp graphics by internally converting bitmaps to formats compatible with the current X server mode (e.g. 24bpp). This is also true for 8bpp DirectDraw games such as Starcraft, C&C Red Alert and Total Annihilation. Such games will output a fixme message
The X server can't switch from <abbr title="24bpp = 24-bit color = 16 million colors = Truecolor">24bpp</abbr> mode to <abbr title="8bpp = 8-bit color = 256 colors = color index mode">8bpp</abbr> mode. Nevertheless, Wine (in general) can run software that uses 8bpp graphics by internally converting bitmaps to formats compatible with the current X server mode (e.g. 24bpp). This is also true for 8bpp DirectDraw games such as Starcraft, C&C Red Alert and Total Annihilation. Such games will output a fixme message


  fixme:x11drv:X11DRV_desktop_SetCurrentMode Cannot change screen BPP from 32 to 8
  fixme:x11drv:X11DRV_desktop_SetCurrentMode Cannot change screen BPP from 32 to 8


but for practical purposes it can be ignored. Although the general support for such conversion is there, there may be bugs affecting specific software, and performance is often not on par with native Windows installations. Search [http://bugs.winehq.org/query.cgi Bugzilla] and the [http://appdb.winehq.org/ AppDB] for known issues with individual applications.
but for practical purposes it can be ignored. Although the general support for such conversion is there, there may be bugs affecting specific software, and performance is often not on par with native Windows installations. Search [https://bugs.winehq.org/query.cgi Bugzilla] and the [https://appdb.winehq.org/ AppDB] for known issues with individual applications.


* "24bpp" = 24-bit color = 16 million colors = Truecolor
If your application says that it needs 8bpp or 256 colors even though you have millions of colors available, you may be able to get it working with one of the workarounds below.
 
* "8bpp" = 8-bit color = 256 colors = color index mode


== Workarounds ==
== Workarounds ==
 
There are at least three ways to provide 8bpp to applications. These include:
If your application says that it needs 8bpp or 256 colors even though you have millions of colors available, you may be able to get it working with one of the workarounds below. Any of four major methods are suggested to provide 8bpp to applications. These include:


* Xephyr (preferred)
* Xephyr (preferred)
* Xnest
* Xnest
* VNC
* xinit
* Xinit
* Change Preferences (Mac OS X only)
* Change Preferences (Mac OS X only)


=== Stage 1: Creating a new X11 display ===


The instructions below allow you to create a new X11 display, with 256 colors, and with an xterm running within it. But:
The instructions below allow you to create a new X11 display, with 256 colors, and with a Wine file explorer running within it. But bear in mind:
* Wherever :1 is written you may use :''n'' instead, where ''n'' is an unused display number. The default display is usually :0.
* '''You must use a window manager''', and the window manager must be one that supports color palettes (e.g. [http://openbox.org/wiki/Main_Page Openbox]).
* If your shell doesn't accept the <tt>DISPLAY=:1 xterm</tt> syntax, you may need to use something like <tt>env DISPLAY=:1 xterm</tt> instead.
* Wherever <code>:1</code> is written you may use <code>:''n''</code> instead, where ''n'' is an unused display number. The default display is usually <code>:0</code>.
* See also [http://bugs.winehq.org/show_bug.cgi?id=7334 bug 7334].
* If your shell doesn't accept the <code>DISPLAY=:1 xterm</code> syntax, you may need to use something like <code>env DISPLAY=:1 wine explorer</code> instead.


==== Xephyr ====
=== Xephyr ===
Once you have installed Xephyr (Ubuntu: package xserver-xephyr, in universe), you should be able to run something like the following:
Once you have installed [https://www.freedesktop.org/wiki/Software/Xephyr/ Xephyr] (Ubuntu: package xserver-xephyr, in universe), you should be able to run something like the following:


  Xephyr :1 -ac -screen 800x600x8 &
  Xephyr :1 -ac -screen 800x600x8 &
  DISPLAY=:1 xterm
  DISPLAY=:1 openbox &
DISPLAY=:1 wine explorer


This will create a 800x600 display, in a window, with 8-bit color, and display an xterm in it.
This will create a 800x600 display, in a window, with 8-bit color, and display a Wine file explorer in it.


In some cases, you may get better results by starting Xephyr with the parameter <code>-cc 2</code> to use the default Xorg palette (StaticColor) instead of the default Windows palette (PseudoColor).
In some cases, you may get better results by starting Xephyr with the parameter <code>-cc 2</code> to use the default Xorg palette (StaticColor) instead of the default Windows palette (PseudoColor).


==== Xnest ====
=== Xnest ===
Once you have installed Xnest (Ubuntu: package xnest, in main), you should be able to run the following:
Once you have installed [https://www.x.org/archive/X11R7.5/doc/man/man1/Xnest.1.html Xnest] (Ubuntu: package xnest, in main), you should be able to run the following:


  Xnest :1 -depth 8 &
  Xnest :1 -depth 8 &
  DISPLAY=:1 xterm
  DISPLAY=:1 openbox &
 
DISPLAY=:1 wine explorer
This will create a display in a window, with 8-bit color, and display an xterm in it. Xnest depends on the parent X11 for various things; in some cases Xnest won't work (-depth 8 fails on many systems).
 
==== VNC ====
Once you have installed VNC (Ubuntu: packages vnc4server and xvnc4viewer, in universe), you should be able to run the following:


vnc4server :1 -cc 3 -depth 8 -geometry 640x480 -localhost}
This will create a display in a window, with 8-bit color, and display an xterm in it. Xnest depends on the parent X11 server for various things; in some cases Xnest won't work (<code>-depth 8</code> fails on many systems).
Then issue the command:


xvnc4viewer :1
=== xinit ===
This will create a virtual 8bpp display (in this example, a 640x480 window containing the virtual screen).  This is known as !PseudoColor mode in the VNC documentation.
 
==== Xinit ====
Of course you can use just plain ol' X, but that will only work if your modern video card still supports palettized 8bpp displays.
Of course you can use just plain ol' X, but that will only work if your modern video card still supports palettized 8bpp displays.


cd "~/.wine/drive_c/Program Files/My game/"
  xinit /usr/bin/xterm -- :1 -ac -depth 8
  xinit /usr/bin/wine "my game.exe" -- :1 -ac -depth 8


Or for something more sophisticated use xterm:
Then in xterm:


  xinit /usr/bin/xterm -- :1 -ac -depth 8
  openbox &
   
  wine explorer


You can switch between several running X servers and consoles by using the Ctrl+Alt+F1 ... Ctrl+Alt+F10 keyboard shortcuts. On Ubuntu, the initial X server is on tty7 (Ctrl+Alt+F7), and the new X server will be on tty9 (Ctrl+Alt+F9).
You can switch between several running X servers and consoles by using the Ctrl+Alt+F1 ... Ctrl+Alt+F10 keyboard shortcuts. On Ubuntu, the initial X server is on tty7 (Ctrl+Alt+F7), and the new X server will be on tty9 (Ctrl+Alt+F9).


Note: You may get a "user not authorized to run the X server, aborting" error message (this happens on Debian and Ubuntu). To work around this, either run xinit as root (or with sudo), or change the "allowed_users=console" line in /etc/X11/Xwrapper.config to read "allowed_users=anybody". If you run xinit as root, a root shell will be running in the xterm, so you need to start another xterm as your normal user (switch back to your main X server, and run {{{DISPLAY=:1 xterm}}} in a non-root shell). Remember: Don't run Wine as root!
Note: You may get a "user not authorized to run the X server, aborting" error message (this happens on Debian and Ubuntu). To work around this, either run xinit as root (or with sudo), or change the <code>allowed_users=console</code> line in /etc/X11/Xwrapper.config to read <code>allowed_users=anybody</code>. If you run xinit as root, a root shell will be running in the xterm, so you need to start another xterm as your normal user (switch back to your main X server, and run <code>DISPLAY=:1 xterm</code> in a non-root shell). Remember: Don't run Wine as root!


==== Change Preferences (Mac OS X only) ====
=== Change Preferences (Mac OS X only) ===
The X server that ships with MacOS X has a preferences setting for the color depth, simply set it where you want it and restart the X server. Done.
The X server that ships with MacOS X has a preferences setting for the color depth, simply set it where you want it and restart the X server. Done.


=== Stage 2: Using the new display ===
=== Finishing Touches ===
The default background is either an eye-watering mesh pattern or a solid black. You can change it to gray with:


To run commands in the xterm on the new display, you need to move the mouse cursor over its window (without a window manager, X11 uses focus-follows-mouse). It is a good idea to run the following commands in the new xterm, as the variable $DISPLAY will be set correctly. You can run commands from another terminal, but be sure to prepend "{{{DISPLAY=:1 }}}" to them.
xsetroot -solid gray50
 
First, you need a window manager.
 
metacity &


You can of course use another window manager, but note that compositing WMs like compiz may not work. The default background is either an eye-watering mesh pattern or a solid black. You can change it to gray with:
Instead of <code>gray50</code>, you can use any X11 color name or a hex color value <code>rgb:''RR''/''GG''/''BB''</code>.
 
xsetroot -solid gray50


Instead of gray50, you can use any X11 color name or a hex color value rgb:''RR''/''GG''/''BB''. You can start Wine in the new display with:
When you're finished, you can close the new display. This will kill all programs that were running in it. If you used xinit, type <code>exit</code> in the xterm that appeared initially.


cd "$HOME/.wine/drive_c/Program Files/<etc>"
If the colors in your Windows program still don't look right, you can try setting <code>HKEY_CURRENT_USER\Software\Wine\X11 Driver\ClientSideGraphics</code> to <code>N</code> in the registry (see [[Useful Registry Keys]]).
wine <program> <etc>
When you're finished, you can close the new display. This will kill all programs that were running in it. If you used Xinit, type <tt>exit</tt> in the xterm that appeared initially.
----
----
[[Category:Graphics]]
[[Category:Graphics]]

Revision as of 03:59, 29 March 2022

The X server can't switch from 24bpp mode to 8bpp mode. Nevertheless, Wine (in general) can run software that uses 8bpp graphics by internally converting bitmaps to formats compatible with the current X server mode (e.g. 24bpp). This is also true for 8bpp DirectDraw games such as Starcraft, C&C Red Alert and Total Annihilation. Such games will output a fixme message

fixme:x11drv:X11DRV_desktop_SetCurrentMode Cannot change screen BPP from 32 to 8

but for practical purposes it can be ignored. Although the general support for such conversion is there, there may be bugs affecting specific software, and performance is often not on par with native Windows installations. Search Bugzilla and the AppDB for known issues with individual applications.

If your application says that it needs 8bpp or 256 colors even though you have millions of colors available, you may be able to get it working with one of the workarounds below.

Workarounds

There are at least three ways to provide 8bpp to applications. These include:

  • Xephyr (preferred)
  • Xnest
  • xinit
  • Change Preferences (Mac OS X only)


The instructions below allow you to create a new X11 display, with 256 colors, and with a Wine file explorer running within it. But bear in mind:

  • You must use a window manager, and the window manager must be one that supports color palettes (e.g. Openbox).
  • Wherever :1 is written you may use :n instead, where n is an unused display number. The default display is usually :0.
  • If your shell doesn't accept the DISPLAY=:1 xterm syntax, you may need to use something like env DISPLAY=:1 wine explorer instead.

Xephyr

Once you have installed Xephyr (Ubuntu: package xserver-xephyr, in universe), you should be able to run something like the following:

Xephyr :1 -ac -screen 800x600x8 &
DISPLAY=:1 openbox &
DISPLAY=:1 wine explorer

This will create a 800x600 display, in a window, with 8-bit color, and display a Wine file explorer in it.

In some cases, you may get better results by starting Xephyr with the parameter -cc 2 to use the default Xorg palette (StaticColor) instead of the default Windows palette (PseudoColor).

Xnest

Once you have installed Xnest (Ubuntu: package xnest, in main), you should be able to run the following:

Xnest :1 -depth 8 &
DISPLAY=:1 openbox &
DISPLAY=:1 wine explorer

This will create a display in a window, with 8-bit color, and display an xterm in it. Xnest depends on the parent X11 server for various things; in some cases Xnest won't work (-depth 8 fails on many systems).

xinit

Of course you can use just plain ol' X, but that will only work if your modern video card still supports palettized 8bpp displays.

xinit /usr/bin/xterm -- :1 -ac -depth 8

Then in xterm:

openbox &
wine explorer

You can switch between several running X servers and consoles by using the Ctrl+Alt+F1 ... Ctrl+Alt+F10 keyboard shortcuts. On Ubuntu, the initial X server is on tty7 (Ctrl+Alt+F7), and the new X server will be on tty9 (Ctrl+Alt+F9).

Note: You may get a "user not authorized to run the X server, aborting" error message (this happens on Debian and Ubuntu). To work around this, either run xinit as root (or with sudo), or change the allowed_users=console line in /etc/X11/Xwrapper.config to read allowed_users=anybody. If you run xinit as root, a root shell will be running in the xterm, so you need to start another xterm as your normal user (switch back to your main X server, and run DISPLAY=:1 xterm in a non-root shell). Remember: Don't run Wine as root!

Change Preferences (Mac OS X only)

The X server that ships with MacOS X has a preferences setting for the color depth, simply set it where you want it and restart the X server. Done.

Finishing Touches

The default background is either an eye-watering mesh pattern or a solid black. You can change it to gray with:

xsetroot -solid gray50

Instead of gray50, you can use any X11 color name or a hex color value rgb:RR/GG/BB.

When you're finished, you can close the new display. This will kill all programs that were running in it. If you used xinit, type exit in the xterm that appeared initially.

If the colors in your Windows program still don't look right, you can try setting HKEY_CURRENT_USER\Software\Wine\X11 Driver\ClientSideGraphics to N in the registry (see Useful Registry Keys).


This page was last edited on 29 March 2022, at 03:59.