Coder Social home page Coder Social logo

rdoeffinger / xwa_ddraw_d3d11 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jeremyansel/xwa_ddraw_d3d11

59.0 59.0 2.0 449 KB

Direct3D 11 implementation of DDraw.dll for XWA

License: MIT License

C++ 96.76% C 0.40% Makefile 0.41% HLSL 2.44%

xwa_ddraw_d3d11's People

Contributors

jarikomppa avatar jeremyansel avatar rdoeffinger avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

xwa_ddraw_d3d11's Issues

Joystick deadzone investigation

Some joysticks seem to have issue with e.g. drifting if the in-game deadzone handling is patched out.
It is of course possible to just leave that enabled by default, but it generally seems too extreme by default and makes it hard to aim for anyone with good joysticks.
So this ticket is meant for collecting data on different joysticks/gamepads to see if there is a reasonable compromise.
To collect data run the JoystickStats.exe file (download from release page: https://github.com/rdoeffinger/xwa_ddraw_d3d11/releases/download/v1.5.13/JoystickStats.exe ). Move the joystick, then let it return to center position and press button/"A" button.
Let it run for a bit without moving the joystick and copy-paste the output line (to copy press Ctrl+M, mark text, press enter).
Example for my Logitech Extreme 3D pro:
Try 1:
winmm: 32511,32767 min: 32511,32767 max:32511,32767

Try 2:
winmm: 32767,32767 min: 32767,32767 max:32767,32767

Try 3:
winmm: 32767,32511 min: 32767,32511 max:32767,32511

As you can see, normally the position is stable once the joystick is in center (min and max are the same), however it doesn't always return to exact center but is a bit above 200 units (less than 1% as it uses the full 0 to 65535 range) off.

InvertYAxis should be set to 1 and JoystickEmul should be set to 0 by default

My issue is that my Y axis was not inverted. Pulling on the stick should pitch the craft up. I did not have this issue with the previous ddraw versions. Other people had this issue as well.

I believe I also recall an issue with someone who had to force the joystick emulation to off as it was messing with his physical joystick.

For those who do need Joystick emulation support, they can turn it on manually in the config, but most people will be using a joystick or controller of some sort so this should be set to off by default.

EDIT: It might be ok with JoystickEmul to -1 as default, but the InvertYAxis definitely should be set to 1.

AVI support cutscene request

Hi,

I like to upscale cutscene for XvT with AI the and I ask if is possible add avi support for cutscene.

Thanks !

When MSAA is disabled this causes graphical corruption when running with ReShade

I thought I would put this in as it has been recently seen in XWA as well here: https://www.xwaupgrade.com/phpBB3/viewtopic.php?p=157850#p157850

The fix suggested here does work for XVT BOP as well which involves enabling MSAA via the cfg file to remove the graphical corruption that occurs when using the most recent version of ReShade in either games.

Like many other's I'm using the 60 fps patch and when MSAA is turned off I constantly get the maxed 60fps. When MSAA is turned on for me I'm dropping to 10-15 fps in the same mission to around 45-50 fps in XvT BOP.

It is only a minor drop but I have a i7 4770 running at ~4GHz and an nvidia 660 ti and even though that's not high spec I would have thought it would still handle 60 fps easily with MSAA enabled. I'm using all default opts no other mods.

The version of ReShade I normally use is 3.1.1.242 which gets this bug to occur about 1 in 20 missions. The latest version of ReShade causes it constantly.

Fix XWING95/TIE95 keyboard input in bordered windowed mode or provide borderless "windowed" mode (was "DxWnd support")

As awesome as this is, it's annoying that it's stuck to full screen. I'd appreciate it if you found a way to get it to work under DxWnd, which can be found at https://sourceforge.net/projects/dxwnd/

Without the d3d11 wrapper, I'm able to use a windowed fullscreen mode. Unfortunately with my tests with X-Wing 95 and Tie Fighter 95, true windowed mode doesn't seem to work, but I am able to alt tab out of the window or get the cursor out of the window just fine. If you can get that at least working again, I'd really appreciate it. As it happens, it appears that new versions os XWAUCP and DSUCP come bundled with this by default, which makes it even more important for full compatibility.

Crash in windowed mode in the hangar

Hello,
Justagai has reported an issue:

I forgot to mention Reimar's ddraw in windowed mode outright crashes the game in the hangar. I'll try to get some event viewer logs uploaded later.

See http://www.xwaupgrade.com/phpBB3/viewtopic.php?p=156268#p156268

Faulting application name: XWINGALLIANCE.EXE, version: 2.0.0.2, time stamp: 0x3765a9b7
Faulting module name: USER32.dll, version: 10.0.17134.376, time stamp: 0xbeaa4463
Exception code: 0xc00000fd
Fault offset: 0x00026fbb
Faulting process id: 0x22f0
Faulting application start time: 0x01d49a9ac72ad9ef
Faulting application path: D:\GOG Games\Star Wars - X-Wing Alliance\XWINGALLIANCE.EXE
Faulting module path: C:\WINDOWS\System32\USER32.dll
Report Id: de2060d5-b4ac-4f55-8160-d2b10b05b3e9
Faulting package full name: 
Faulting package-relative application ID: 

X-Wing (1998) and TIE Fighter (1998) Run at 10 FPS with AMD Drivers Above 16.12.1

When running TIE Fighter with the newest AMD 17.1.1. drivers the game runs at around half the speed it should. This is with an RX 480. Previously using the 16.12.1 drivers and this version saw no performance issues. Switching back to the standard ddraw.dll fixed the issue, confirming it is an issue with the DirectX11 ddraw.dll and not the game in general.

Additional testing confirms that the AMD 16.12.2 drive also causes the same issue.

Note that this issue does not appear in X-Wing vs. TIE Fighter. I was unable to test X-Wing Alliance.

To replicate: Install the latest AMD drivers and run any mission in the Windows Collector Edition of TIE Fighter or X-Wing. The FPS should be around 10 FPS even though the game should run at 30.

workaround: rolling drivers back to 16.12.1 resolves the issue.

Crash when 3D hardware is turned on

A friend of mine is having a crash to desktop when turning on 3D Hardware and going in flight. Its fine when he runs on 16-bit.

Here is the event viewer log of the crash:

unknown

Bugged mipmap setting

Setting "Hardware Mip Mapping" to anything above "off" in Hardware only video option ingame menu gives an error when trying to load a game. Ignoring that still loads the game but all the 3d objects become white and textureless.

Untitled0
Untitled1

Joystick Option Request

I noticed from the last time i used it, you've added a throttle switch option on ddraw.cfg to switch from the annoying right analog to the triggers on xinput controllers (awesome actually, Thanks), and I have a request if would be possible, to assign the throttle to null input ? or off ? I use steam controller profile, and I find that the throttle option is rather useless to have, if you are either full stop or full throttle most of the time, or matching speeds, i rather give up 3 functions on my controller, since i use the triggers mostly to change action layers. Thanks !

Whole screen dims out when targeting capital ships

Using v1.5.10 rc1 on stock XWA (GOG install) leads to the whole screen being dimmed whenever a capital ship (e.g. cruiser/star destroyer) is targeted. Once a fighter-class ship is targeted, the dimming is gone.

No additional patches were activated, but I've tested with the 60fps patch and still had the same result.

The issue does not appear when @JeremyAnsel's latest version is used.

XWA Map and targeting issues

There seems to be some weird bug from the latest development of the ddraw (not from 1.5.7) that causes a strange issue with the map:

image

Interestingly, if a large ship is targeted this happens:

image

It seems familiar to the 32-bit rendering issue a while back. Did something get reverted or changed?

Request to make compatible with XBox One pad on Windows 7/later

For some reason, xwa_ddraw stops the throttle (right or left trigger) working correct for TIE Fighter (1998). My OS is Windows 7 64-bit.

I tested as follows:

  1. Installed TIE Fighter (1998) from GOG.
  2. Installed a XBox One pad via USB (wired).
  3. Launched and run the program using software mode.

In this case, the right trigger works in increments to increase/decrease the throttle (I presume this is the correct behaviour). But obviously I can't run in 3D mode with the above.

  1. Installed xwing ddraw (I tried both 1.5.9 and 1.5.10_rc2).
  2. Edited ddraw.cfg and set XInputTriggerAsThrottle to 2 ("right trigger as throttle").
  3. Launched and tested the game.

So what happens is the throttle is 100% by default. If I hold down (and keep holding down) the right trigger it will go down to 0%. Release it and it goes back up to 100%. So I presume this isn't the way it should be, a fix or workaround would be appreciated.

Gamepad speed control with trigger

Hi,

While using ddraw.dll for older games xwing, tie fighter & x-wing vs tie-fighter, the ability of using gamepad triggers as throttle axis is lost. I mean, there is an optional throttle implementation in the new config file but it is not working as the original game file i.e. pressing right trigger increase power while pressing left trigger decrease power. Is it possible to put this setting as an option?

-Mehmet

XWA Crashes with 3D Hardware turned off

This isn't really a priority but more of a "huh" type of deal. I wanted to see how a certain memory address would react with 3D Hardware turned off but it seems to crash immediately at the start of a mission.

Event viewer logs:

crash.zip

EDIT: If a fix disrupts 3D hardware in any way, then I'd rather keep no 3D hardware broken

Direct3DTexture:Load error

Getting Direct3DTextue:Load error "Incorrect parameter".

After closing the dialog window, the game is left in this state. No textures are loaded.

image


OS: Windows 10 21H1 (19043.906)
CPU: R5 3600X
GPU: RX 580 8 GB
AMD drivers: 21.4.1 (27.20.21002.112)

xwing special edition [gog] (XWING95.EXE) ddraw downgrade video quality

Hi,

I have tried to replace to apply this patch to xwing95.exe but the quality is it is worse than before (too much pixel effect).

I the past I have tried this patch with xvt and I get better result, but not with xwing95.exe.

In both casse I have set: ScalingType = 1 (smoother, alpha blended scaling).

I need to use this patch becouse convert old ddraw to ddraw 11 and allow me to record cutscene and work.

But not the pixels are more evident.

Thare is a way to solve ?

Thanks !

request gamma correction for ScalingType 1

Hi,

I play to xvt and with this update there is a huge improvement.

When I set ScalingType 1 the anti-alisiang work good, but the gamma is more dark.

I ask is possible add a gamma correction.

Thank You !

Request to add relative mouse to joystick motion

Hi there, just started playing X-Wing (1998) again and thanks to your work, it's very playable on Windows 10. I would however like to request relative mouse (to joystick) motion (like in FPS/arcade flight games) so I don't have to bring back the mouse to the exact location it was for level flight. This will also allow me to map mouse movement to my Xbox controller (via steam input) so I could navigate menus using the controller as well.
Thanks!

Benchmark color conversion

Hello,
I've run a few benchmark to compare lookup vs compute color conversion.

Here is the result;

compare 5 OK
compare 6 OK
bench_lookup: 28.2832 ms        4286578691 41943043 4286578688 41943043
bench_compute: 41.4348 ms       4286578691 41943043 4286578688 41943043
bench_compute_simd: 24.7041 ms  4286578691 41943043 4286578688 41943043
bench_colorkey: 16.5983 ms      4286578691 41943043 4286578688 4267704323
bench_colorkey_simd: 14.2981 ms 4286578691 41943043 4286578688 4267704323
bench_colorkey_skip_lookup: 26.9225 ms  4286578691 41943043 4286578688 4267704323
bench_colorkey_skip_compute: 38.8146 ms 4286578691 41943043 4286578688 4267704323

I've used this code:

#include <iostream>
#include <string>
#include <chrono>

const int g_loopCount = 0x1000000 + 3;

unsigned short g_srcArray16[g_loopCount];
unsigned int g_srcArray32[g_loopCount];
unsigned short g_dstArray16[g_loopCount];
unsigned int g_dstArray32[g_loopCount];

void initGlobalArray()
{
	for (int i = 0; i < g_loopCount; i++)
	{
		g_srcArray16[i] = (unsigned short)i;
		g_srcArray32[i] = (unsigned int)i;
		g_dstArray16[i] = (unsigned short)i;
		g_dstArray32[i] = (unsigned int)i;
	}
}

void sumGlobalArray()
{
	unsigned int sumSrc16 = 0;
	unsigned int sumSrc32 = 0;
	unsigned int sumDst16 = 0;
	unsigned int sumDst32 = 0;

	for (int i = 0; i < g_loopCount; i++)
	{
		sumSrc16 += g_srcArray16[i];
		sumSrc32 += g_srcArray32[i];
		sumDst16 += g_dstArray16[i];
		sumDst32 += g_dstArray32[i];
	}

	std::cout << "\t" << sumSrc16 << " " << sumSrc32 << " " << sumDst16 << " " << sumDst32 << std::endl;
}

void measure(const char* name, void(*fct)())
{
	auto start = std::chrono::high_resolution_clock::now();

	if (fct)
	{
		fct();
	}

	auto end = std::chrono::high_resolution_clock::now();
	std::chrono::duration<double, std::milli> ellapsed = end - start;

	std::cout << name << ": " << ellapsed.count() << " ms";
}

unsigned char convertColorB8G8R8X8toB5G6R5_15(unsigned char c)
{
	return (c * (0x1F * 2) + 0xFF) / (0xFF * 2);
}

unsigned char convertColorB8G8R8X8toB5G6R5_16(unsigned char c)
{
	return (c * (0x3F * 2) + 0xFF) / (0xFF * 2);
}

unsigned char convertColorB8G8R8X8toB5G6R5_25(unsigned char c)
{
	return (c * 7967 + 32768) >> 16;
}

unsigned char convertColorB8G8R8X8toB5G6R5_26(unsigned char c)
{
	return (c * 16191 + 32768) >> 16;
}

void compare5()
{
	std::cout << "compare 5";

	bool error = false;

	for (int i = 0; i < 256; i++)
	{
		unsigned char c = (unsigned char)i;

		unsigned char c1 = convertColorB8G8R8X8toB5G6R5_15(c);
		unsigned char c2 = convertColorB8G8R8X8toB5G6R5_25(c);

		if (c1 != c2)
		{
			error = true;
			break;
		}
	}

	std::cout << (error ? " ERROR" : " OK") << std::endl;
}

void compare6()
{
	std::cout << "compare 6";

	bool error = false;

	for (int i = 0; i < 256; i++)
	{
		unsigned char c = (unsigned char)i;

		unsigned char c1 = convertColorB8G8R8X8toB5G6R5_16(c);
		unsigned char c2 = convertColorB8G8R8X8toB5G6R5_26(c);

		if (c1 != c2)
		{
			error = true;
			break;
		}
	}

	std::cout << (error ? " ERROR" : " OK") << std::endl;
}

class ColorConverterTables
{
public:
	ColorConverterTables()
	{
		// X8toX5, X8toX6
		for (unsigned int c = 0; c < 0x100; c++)
		{
			this->X8toX5[c] = (c * (0x1F * 2) + 0xFF) / (0xFF * 2);
			this->X8toX6[c] = (c * (0x3F * 2) + 0xFF) / (0xFF * 2);
		}
	}

	unsigned char X8toX5[0x100];
	unsigned char X8toX6[0x100];
};

ColorConverterTables g_colorConverterTables;

unsigned short convert32to16_lookup(unsigned int color32)
{
	unsigned int red = (color32 & 0xFF0000) >> 16;
	unsigned int green = (color32 & 0xFF00) >> 8;
	unsigned int blue = color32 & 0xFF;

	red = g_colorConverterTables.X8toX5[red];
	green = g_colorConverterTables.X8toX6[green];
	blue = g_colorConverterTables.X8toX5[blue];

	unsigned short color16 = (red << 11) | (green << 5) | blue;
	return color16;
}

void bench_lookup()
{
	unsigned short* dst = g_dstArray16;
	unsigned int* src = g_srcArray32;
	int size = g_loopCount;

	for (int i = 0; i < size; i++)
	{
		unsigned int color32 = src[i];

		unsigned char red = (unsigned char)((color32 & 0xFF0000) >> 16);
		unsigned char green = (unsigned char)((color32 & 0xFF00) >> 8);
		unsigned char blue = (unsigned char)(color32 & 0xFF);

		red = g_colorConverterTables.X8toX5[red];
		green = g_colorConverterTables.X8toX6[green];
		blue = g_colorConverterTables.X8toX5[blue];

		unsigned int color16 = (red << 11) | (green << 5) | blue;

		dst[i] = color16;
	}
}

void bench_compute()
{
	unsigned short* dst = g_dstArray16;
	unsigned int* src = g_srcArray32;
	int size = g_loopCount;

	for (int i = 0; i < size; i++)
	{
		unsigned int color32 = src[i];

		unsigned char red = (unsigned char)((color32 & 0xFF0000) >> 16);
		unsigned char green = (unsigned char)((color32 & 0xFF00) >> 8);
		unsigned char blue = (unsigned char)(color32 & 0xFF);

		red = (red * 7967 + 32768) >> 16;
		green = (green * 16191 + 32768) >> 16;
		blue = (blue * 7967 + 32768) >> 16;

		unsigned int color16 = (red << 11) | (green << 5) | blue;

		dst[i] = color16;
	}
}

unsigned short convert32to16_compute(unsigned int color32)
{
	unsigned int red = (color32 & 0xFF0000) >> 16;
	unsigned int green = (color32 & 0xFF00) >> 8;
	unsigned int blue = color32 & 0xFF;

	red = (red * 7967 + 32768) >> 16;
	green = (green * 16191 + 32768) >> 16;
	blue = (blue * 7967 + 32768) >> 16;

	unsigned short color16 = (red << 11) | (green << 5) | blue;
	return color16;
}

void bench_compute_simd()
{
	unsigned short* dst = g_dstArray16;
	unsigned int* src = g_srcArray32;
	int size = g_loopCount;

	for (int i = 0; i < size; i++)
	{
		dst[i] = convert32to16_compute(src[i]);
	}
}

void bench_colorkey()
{
	unsigned int* dst = g_dstArray32;
	unsigned int* src = g_srcArray32;
	int size = g_loopCount;

	for (int i = 0; i < size; i++)
	{
		unsigned int color32 = src[i];

		if (color32 == 0x200000)
		{
			dst[i] = 0xff000000;
		}
		else
		{
			dst[i] = color32 & 0xffffff;
		}
	}
}

unsigned int convert32Colorkey(unsigned int color32)
{
	if (color32 == 0x200000)
	{
		color32 = 0xff000000;
	}
	else
	{
		color32 = color32 & 0xffffff;
	}

	return color32;
}

void bench_colorkey_simd()
{
	unsigned int* dst = g_dstArray32;
	unsigned int* src = g_srcArray32;
	int size = g_loopCount;

	for (int i = 0; i < size; i++)
	{
		dst[i] = convert32Colorkey(src[i]);
	}
}

void bench_colorkey_skip_lookup()
{
	unsigned short* dst = g_dstArray16;
	unsigned int* src = g_srcArray32;
	int size = g_loopCount;

	for (int i = 0; i < size; i++)
	{
		unsigned int color32 = src[i];

		if (color32 == 0x200000)
			continue;

		dst[i] = convert32to16_lookup(color32);
	}
}

void bench_colorkey_skip_compute()
{
	unsigned short* dst = g_dstArray16;
	unsigned int* src = g_srcArray32;
	int size = g_loopCount;

	for (int i = 0; i < size; i++)
	{
		unsigned int color32 = src[i];

		if (color32 == 0x200000)
			continue;

		dst[i] = convert32to16_compute(color32);
	}
}

#define BENCH(fct) measure(#fct, (fct)); sumGlobalArray();

void main()
{
	compare5();
	compare6();

	initGlobalArray();

	BENCH(bench_lookup);
	BENCH(bench_compute);
	BENCH(bench_compute_simd);
	BENCH(bench_colorkey);
	BENCH(bench_colorkey_simd);
	BENCH(bench_colorkey_skip_lookup);
	BENCH(bench_colorkey_skip_compute);
}

It seems that compute is faster than lookup when SIMD is used, and lookup is faster than compute when SIMD is not used.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.